From 0ebd85f364c284c9c1f4e69a97525ef1df779cf5 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sat, 27 Apr 2019 23:54:30 +0900 Subject: [PATCH] Integration with OGSLib --- .gitignore | 44 +- .gitmodules | 3 + Makefile.am | 37 +- README.md | 97 +- acinclude.m4 | 108 - build/git-version-gen | 227 ++ build/osc-upload.sh | 91 + configure.ac | 415 +-- debian/changelog | 6 + debian/control | 33 +- debian/rules | 10 +- {support/docker => docker}/README.md | 22 +- {support/docker => docker}/build/Dockerfile | 0 {support/docker => docker}/build/setup.sh | 0 .../centos/7/base/Dockerfile | 0 .../docker => docker}/centos/7/dev/Dockerfile | 0 .../docker => docker}/centos/7/dev/setup.sh | 0 {support/docker => docker}/centos/latest | 0 {support/docker => docker}/check.sh | 0 .../debian/jessie/base/Dockerfile | 0 {support/docker => docker}/debian/jessie/dev | 0 {support/docker => docker}/debian/latest | 0 {support/docker => docker}/debian/stable | 0 .../debian/stretch/base/Dockerfile | 0 {support/docker => docker}/debian/stretch/dev | 0 .../docker => docker}/docker-compose.run.yml | 0 .../docker => docker}/docker-compose.test.yml | 0 {support/docker => docker}/docker-compose.yml | 0 .../fedora/27/base/Dockerfile | 0 .../fedora/27/dev/Dockerfile | 0 .../docker => docker}/fedora/27/dev/setup.sh | 0 {support/docker => docker}/fedora/latest | 0 {support/docker => docker}/package/Dockerfile | 0 {support/docker => docker}/ubuntu/artful | 0 .../ubuntu/bionic/base/Dockerfile | 0 .../ubuntu/bionic/dev/Dockerfile | 2 + .../ubuntu/bionic/dev/setup.sh | 0 {support/docker => docker}/ubuntu/latest | 0 .../ubuntu/trusty/base/Dockerfile | 0 {support/docker => docker}/ubuntu/trusty/dev | 0 {support/docker => docker}/ubuntu/xenial | 0 {support/docker => docker}/webui/Dockerfile | 0 lib/Makefile.am | 11 +- lib/asn1c/Makefile.am | 1163 +++++++++ lib/{s1ap/asn1c => asn1c/common}/ANY.c | 0 lib/{s1ap/asn1c => asn1c/common}/ANY.h | 0 lib/{s1ap/asn1c => asn1c/common}/BIT_STRING.c | 0 lib/{s1ap/asn1c => asn1c/common}/BIT_STRING.h | 0 .../asn1c => asn1c/common}/BIT_STRING_oer.c | 0 lib/{s1ap/asn1c => asn1c/common}/BOOLEAN.c | 0 lib/{s1ap/asn1c => asn1c/common}/BOOLEAN.h | 0 lib/{s1ap/asn1c => asn1c/common}/INTEGER.c | 0 lib/{s1ap/asn1c => asn1c/common}/INTEGER.h | 0 .../asn1c => asn1c/common}/INTEGER_oer.c | 0 lib/{s1ap/asn1c => asn1c/common}/NULL.c | 0 lib/{s1ap/asn1c => asn1c/common}/NULL.h | 0 .../asn1c => asn1c/common}/NativeEnumerated.c | 0 .../asn1c => asn1c/common}/NativeEnumerated.h | 0 .../common}/NativeEnumerated_oer.c | 0 .../asn1c => asn1c/common}/NativeInteger.c | 0 .../asn1c => asn1c/common}/NativeInteger.h | 0 .../common}/NativeInteger_oer.c | 0 .../common}/OBJECT_IDENTIFIER.c | 0 .../common}/OBJECT_IDENTIFIER.h | 0 .../asn1c => asn1c/common}/OCTET_STRING.c | 0 .../asn1c => asn1c/common}/OCTET_STRING.h | 0 .../asn1c => asn1c/common}/OCTET_STRING_oer.c | 0 lib/{s1ap/asn1c => asn1c/common}/OPEN_TYPE.c | 0 lib/{s1ap/asn1c => asn1c/common}/OPEN_TYPE.h | 0 .../asn1c => asn1c/common}/OPEN_TYPE_oer.c | 0 .../asn1c => asn1c/common}/PrintableString.c | 0 .../asn1c => asn1c/common}/PrintableString.h | 0 .../asn1c => asn1c/common}/asn_SEQUENCE_OF.c | 0 .../asn1c => asn1c/common}/asn_SEQUENCE_OF.h | 0 lib/{s1ap/asn1c => asn1c/common}/asn_SET_OF.c | 0 lib/{s1ap/asn1c => asn1c/common}/asn_SET_OF.h | 0 .../asn1c => asn1c/common}/asn_application.c | 0 .../asn1c => asn1c/common}/asn_application.h | 0 .../asn1c => asn1c/common}/asn_bit_data.c | 0 .../asn1c => asn1c/common}/asn_bit_data.h | 0 lib/{s1ap/asn1c => asn1c/common}/asn_codecs.h | 0 .../asn1c => asn1c/common}/asn_codecs_prim.c | 0 .../asn1c => asn1c/common}/asn_codecs_prim.h | 0 .../asn1c => asn1c/common}/asn_internal.c | 0 .../asn1c => asn1c/common}/asn_internal.h | 13 +- lib/{s1ap/asn1c => asn1c/common}/asn_ioc.h | 0 .../asn1c => asn1c/common}/asn_random_fill.c | 0 .../asn1c => asn1c/common}/asn_random_fill.h | 0 lib/{s1ap/asn1c => asn1c/common}/asn_system.h | 4 + .../asn1c => asn1c/common}/ber_decoder.c | 0 .../asn1c => asn1c/common}/ber_decoder.h | 0 .../asn1c => asn1c/common}/ber_tlv_length.c | 0 .../asn1c => asn1c/common}/ber_tlv_length.h | 0 .../asn1c => asn1c/common}/ber_tlv_tag.c | 0 .../asn1c => asn1c/common}/ber_tlv_tag.h | 0 .../asn1c => asn1c/common}/constr_CHOICE.c | 0 .../asn1c => asn1c/common}/constr_CHOICE.h | 0 .../common}/constr_CHOICE_oer.c | 0 .../asn1c => asn1c/common}/constr_SEQUENCE.c | 0 .../asn1c => asn1c/common}/constr_SEQUENCE.h | 0 .../common}/constr_SEQUENCE_OF.c | 0 .../common}/constr_SEQUENCE_OF.h | 0 .../common}/constr_SEQUENCE_oer.c | 0 .../asn1c => asn1c/common}/constr_SET_OF.c | 0 .../asn1c => asn1c/common}/constr_SET_OF.h | 0 .../common}/constr_SET_OF_oer.c | 0 .../asn1c => asn1c/common}/constr_TYPE.c | 0 .../asn1c => asn1c/common}/constr_TYPE.h | 4 +- .../asn1c => asn1c/common}/constraints.c | 0 .../asn1c => asn1c/common}/constraints.h | 0 .../asn1c => asn1c/common}/der_encoder.c | 0 .../asn1c => asn1c/common}/der_encoder.h | 0 .../asn1c => asn1c/common}/oer_decoder.c | 0 .../asn1c => asn1c/common}/oer_decoder.h | 0 .../asn1c => asn1c/common}/oer_encoder.c | 0 .../asn1c => asn1c/common}/oer_encoder.h | 0 .../asn1c => asn1c/common}/oer_support.c | 0 .../asn1c => asn1c/common}/oer_support.h | 0 .../asn1c => asn1c/common}/per_decoder.c | 0 .../asn1c => asn1c/common}/per_decoder.h | 0 .../asn1c => asn1c/common}/per_encoder.c | 0 .../asn1c => asn1c/common}/per_encoder.h | 0 .../asn1c => asn1c/common}/per_opentype.c | 0 .../asn1c => asn1c/common}/per_opentype.h | 0 .../asn1c => asn1c/common}/per_support.c | 0 .../asn1c => asn1c/common}/per_support.h | 0 .../asn1c => asn1c/common}/xer_decoder.c | 0 .../asn1c => asn1c/common}/xer_decoder.h | 0 .../asn1c => asn1c/common}/xer_encoder.c | 0 .../asn1c => asn1c/common}/xer_encoder.h | 0 .../asn1c => asn1c/common}/xer_support.c | 0 .../asn1c => asn1c/common}/xer_support.h | 0 .../s1ap}/S1AP_Additional-GUTI.c | 2 +- .../s1ap}/S1AP_Additional-GUTI.h | 2 +- .../S1AP_AdditionalCSFallbackIndicator.c | 2 +- .../S1AP_AdditionalCSFallbackIndicator.h | 2 +- .../S1AP_AllocationAndRetentionPriority.c | 2 +- .../S1AP_AllocationAndRetentionPriority.h | 2 +- .../s1ap}/S1AP_AreaScopeOfMDT.c | 2 +- .../s1ap}/S1AP_AreaScopeOfMDT.h | 2 +- .../S1AP_AssistanceDataForCECapableUEs.c | 2 +- .../S1AP_AssistanceDataForCECapableUEs.h | 2 +- .../s1ap}/S1AP_AssistanceDataForPaging.c | 2 +- .../s1ap}/S1AP_AssistanceDataForPaging.h | 2 +- .../S1AP_AssistanceDataForRecommendedCells.c | 2 +- .../S1AP_AssistanceDataForRecommendedCells.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BPLMNs.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BPLMNs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_BearerType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_BearerType.h | 2 +- ...1AP_Bearers-SubjectToStatusTransfer-Item.c | 2 +- ...1AP_Bearers-SubjectToStatusTransfer-Item.h | 2 +- ...S1AP_Bearers-SubjectToStatusTransferList.c | 2 +- ...S1AP_Bearers-SubjectToStatusTransferList.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BitRate.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BitRate.h | 2 +- .../s1ap}/S1AP_BroadcastCancelledAreaList.c | 2 +- .../s1ap}/S1AP_BroadcastCancelledAreaList.h | 2 +- .../s1ap}/S1AP_BroadcastCompletedAreaList.c | 2 +- .../s1ap}/S1AP_BroadcastCompletedAreaList.h | 2 +- .../s1ap}/S1AP_CE-mode-B-SupportIndicator.c | 2 +- .../s1ap}/S1AP_CE-mode-B-SupportIndicator.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CELevel.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CELevel.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CGI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CGI.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CI.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CNDomain.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CNDomain.h | 2 +- .../s1ap}/S1AP_COUNTValueExtended.c | 2 +- .../s1ap}/S1AP_COUNTValueExtended.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_COUNTvalue.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_COUNTvalue.h | 2 +- .../s1ap}/S1AP_COUNTvaluePDCP-SNlength18.c | 2 +- .../s1ap}/S1AP_COUNTvaluePDCP-SNlength18.h | 2 +- .../s1ap}/S1AP_CSFallbackIndicator.c | 2 +- .../s1ap}/S1AP_CSFallbackIndicator.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-Id.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-Id.h | 2 +- .../s1ap}/S1AP_CSG-IdList-Item.c | 2 +- .../s1ap}/S1AP_CSG-IdList-Item.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CSG-IdList.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CSG-IdList.h | 2 +- .../s1ap}/S1AP_CSGMembershipInfo.c | 2 +- .../s1ap}/S1AP_CSGMembershipInfo.h | 2 +- .../s1ap}/S1AP_CSGMembershipStatus.c | 2 +- .../s1ap}/S1AP_CSGMembershipStatus.h | 2 +- .../s1ap}/S1AP_CancelledCellinEAI-Item.c | 2 +- .../s1ap}/S1AP_CancelledCellinEAI-Item.h | 2 +- .../s1ap}/S1AP_CancelledCellinEAI.c | 2 +- .../s1ap}/S1AP_CancelledCellinEAI.h | 2 +- .../s1ap}/S1AP_CancelledCellinTAI-Item.c | 2 +- .../s1ap}/S1AP_CancelledCellinTAI-Item.h | 2 +- .../s1ap}/S1AP_CancelledCellinTAI.c | 2 +- .../s1ap}/S1AP_CancelledCellinTAI.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cause.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cause.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CauseMisc.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CauseMisc.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CauseNas.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CauseNas.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CauseProtocol.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CauseProtocol.h | 2 +- .../s1ap}/S1AP_CauseRadioNetwork.c | 2 +- .../s1ap}/S1AP_CauseRadioNetwork.h | 2 +- .../s1ap}/S1AP_CauseTransport.c | 2 +- .../s1ap}/S1AP_CauseTransport.h | 2 +- .../s1ap}/S1AP_Cdma2000HORequiredIndication.c | 2 +- .../s1ap}/S1AP_Cdma2000HORequiredIndication.h | 2 +- .../s1ap}/S1AP_Cdma2000HOStatus.c | 2 +- .../s1ap}/S1AP_Cdma2000HOStatus.h | 2 +- .../s1ap}/S1AP_Cdma2000OneXMEID.c | 2 +- .../s1ap}/S1AP_Cdma2000OneXMEID.h | 2 +- .../s1ap}/S1AP_Cdma2000OneXMSI.c | 2 +- .../s1ap}/S1AP_Cdma2000OneXMSI.h | 2 +- .../s1ap}/S1AP_Cdma2000OneXPilot.c | 2 +- .../s1ap}/S1AP_Cdma2000OneXPilot.h | 2 +- .../s1ap}/S1AP_Cdma2000OneXRAND.c | 2 +- .../s1ap}/S1AP_Cdma2000OneXRAND.h | 2 +- .../s1ap}/S1AP_Cdma2000OneXSRVCCInfo.c | 2 +- .../s1ap}/S1AP_Cdma2000OneXSRVCCInfo.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Cdma2000PDU.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Cdma2000PDU.h | 2 +- .../s1ap}/S1AP_Cdma2000RATType.c | 2 +- .../s1ap}/S1AP_Cdma2000RATType.h | 2 +- .../s1ap}/S1AP_Cdma2000SectorID.c | 2 +- .../s1ap}/S1AP_Cdma2000SectorID.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Cell-Size.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Cell-Size.h | 2 +- .../s1ap}/S1AP_CellAccessMode.c | 2 +- .../s1ap}/S1AP_CellAccessMode.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CellBasedMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CellBasedMDT.h | 2 +- .../s1ap}/S1AP_CellID-Broadcast-Item.c | 2 +- .../s1ap}/S1AP_CellID-Broadcast-Item.h | 2 +- .../s1ap}/S1AP_CellID-Broadcast.c | 2 +- .../s1ap}/S1AP_CellID-Broadcast.h | 2 +- .../s1ap}/S1AP_CellID-Cancelled-Item.c | 2 +- .../s1ap}/S1AP_CellID-Cancelled-Item.h | 2 +- .../s1ap}/S1AP_CellID-Cancelled.c | 2 +- .../s1ap}/S1AP_CellID-Cancelled.h | 2 +- .../s1ap}/S1AP_CellIdListforMDT.c | 2 +- .../s1ap}/S1AP_CellIdListforMDT.h | 2 +- ..._CellIdentifierAndCELevelForCECapableUEs.c | 2 +- ..._CellIdentifierAndCELevelForCECapableUEs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CellIdentity.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CellIdentity.h | 2 +- .../s1ap}/S1AP_CellTrafficTrace.c | 2 +- .../s1ap}/S1AP_CellTrafficTrace.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CellType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_CellType.h | 2 +- .../s1ap}/S1AP_CompletedCellinEAI-Item.c | 2 +- .../s1ap}/S1AP_CompletedCellinEAI-Item.h | 2 +- .../s1ap}/S1AP_CompletedCellinEAI.c | 2 +- .../s1ap}/S1AP_CompletedCellinEAI.h | 2 +- .../s1ap}/S1AP_CompletedCellinTAI-Item.c | 2 +- .../s1ap}/S1AP_CompletedCellinTAI-Item.h | 2 +- .../s1ap}/S1AP_CompletedCellinTAI.c | 2 +- .../s1ap}/S1AP_CompletedCellinTAI.h | 2 +- .../S1AP_ConcurrentWarningMessageIndicator.c | 2 +- .../S1AP_ConcurrentWarningMessageIndicator.h | 2 +- .../S1AP_ConnectionEstablishmentIndication.c | 2 +- .../S1AP_ConnectionEstablishmentIndication.h | 2 +- .../s1ap}/S1AP_Correlation-ID.c | 2 +- .../s1ap}/S1AP_Correlation-ID.h | 2 +- .../s1ap}/S1AP_Coverage-Level.c | 2 +- .../s1ap}/S1AP_Coverage-Level.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Criticality.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Criticality.h | 2 +- .../S1AP_CriticalityDiagnostics-IE-Item.c | 2 +- .../S1AP_CriticalityDiagnostics-IE-Item.h | 2 +- .../S1AP_CriticalityDiagnostics-IE-List.c | 2 +- .../S1AP_CriticalityDiagnostics-IE-List.h | 2 +- .../s1ap}/S1AP_CriticalityDiagnostics.c | 2 +- .../s1ap}/S1AP_CriticalityDiagnostics.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DCN-ID.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DCN-ID.h | 2 +- .../s1ap}/S1AP_DL-CP-SecurityInformation.c | 2 +- .../s1ap}/S1AP_DL-CP-SecurityInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_DL-Forwarding.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_DL-Forwarding.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_DL-NAS-MAC.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_DL-NAS-MAC.h | 2 +- .../s1ap}/S1AP_DLNASPDUDeliveryAckRequest.c | 2 +- .../s1ap}/S1AP_DLNASPDUDeliveryAckRequest.h | 2 +- .../s1ap}/S1AP_Data-Forwarding-Not-Possible.c | 2 +- .../s1ap}/S1AP_Data-Forwarding-Not-Possible.h | 2 +- .../s1ap}/S1AP_DataCodingScheme.c | 2 +- .../s1ap}/S1AP_DataCodingScheme.h | 2 +- .../s1ap}/S1AP_DeactivateTrace.c | 2 +- .../s1ap}/S1AP_DeactivateTrace.h | 2 +- ...S1AP_Direct-Forwarding-Path-Availability.c | 2 +- ...S1AP_Direct-Forwarding-Path-Availability.h | 2 +- .../s1ap}/S1AP_DownlinkNASTransport.c | 2 +- .../s1ap}/S1AP_DownlinkNASTransport.h | 2 +- ...1AP_DownlinkNonUEAssociatedLPPaTransport.c | 2 +- ...1AP_DownlinkNonUEAssociatedLPPaTransport.h | 2 +- .../s1ap}/S1AP_DownlinkS1cdma2000tunnelling.c | 2 +- .../s1ap}/S1AP_DownlinkS1cdma2000tunnelling.h | 2 +- .../S1AP_DownlinkUEAssociatedLPPaTransport.c | 2 +- .../S1AP_DownlinkUEAssociatedLPPaTransport.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_E-RAB-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_E-RAB-ID.h | 2 +- .../s1ap}/S1AP_E-RAB-IE-ContainerList.c | 2 +- .../s1ap}/S1AP_E-RAB-IE-ContainerList.h | 2 +- .../s1ap}/S1AP_E-RAB-IE-ContainerPairList.h | 2 +- .../s1ap}/S1AP_E-RABAdmittedItem.c | 2 +- .../s1ap}/S1AP_E-RABAdmittedItem.h | 2 +- .../s1ap}/S1AP_E-RABAdmittedList.c | 2 +- .../s1ap}/S1AP_E-RABAdmittedList.h | 2 +- .../s1ap}/S1AP_E-RABDataForwardingItem.c | 2 +- .../s1ap}/S1AP_E-RABDataForwardingItem.h | 2 +- .../S1AP_E-RABFailedToResumeItemResumeReq.c | 2 +- .../S1AP_E-RABFailedToResumeItemResumeReq.h | 2 +- .../S1AP_E-RABFailedToResumeItemResumeRes.c | 2 +- .../S1AP_E-RABFailedToResumeItemResumeRes.h | 2 +- .../S1AP_E-RABFailedToResumeListResumeReq.c | 2 +- .../S1AP_E-RABFailedToResumeListResumeReq.h | 2 +- .../S1AP_E-RABFailedToResumeListResumeRes.c | 2 +- .../S1AP_E-RABFailedToResumeListResumeRes.h | 2 +- .../S1AP_E-RABFailedToSetupItemHOReqAck.c | 2 +- .../S1AP_E-RABFailedToSetupItemHOReqAck.h | 2 +- .../S1AP_E-RABFailedtoSetupListHOReqAck.c | 2 +- .../S1AP_E-RABFailedtoSetupListHOReqAck.h | 2 +- .../s1ap}/S1AP_E-RABInformationList.c | 2 +- .../s1ap}/S1AP_E-RABInformationList.h | 2 +- .../s1ap}/S1AP_E-RABInformationListItem.c | 2 +- .../s1ap}/S1AP_E-RABInformationListItem.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_E-RABItem.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_E-RABItem.h | 2 +- .../s1ap}/S1AP_E-RABLevelQoSParameters.c | 2 +- .../s1ap}/S1AP_E-RABLevelQoSParameters.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_E-RABList.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_E-RABList.h | 2 +- .../s1ap}/S1AP_E-RABModificationConfirm.c | 2 +- .../s1ap}/S1AP_E-RABModificationConfirm.h | 2 +- .../s1ap}/S1AP_E-RABModificationIndication.c | 2 +- .../s1ap}/S1AP_E-RABModificationIndication.h | 2 +- .../s1ap}/S1AP_E-RABModifyItemBearerModConf.c | 2 +- .../s1ap}/S1AP_E-RABModifyItemBearerModConf.h | 2 +- .../s1ap}/S1AP_E-RABModifyItemBearerModRes.c | 2 +- .../s1ap}/S1AP_E-RABModifyItemBearerModRes.h | 2 +- .../s1ap}/S1AP_E-RABModifyListBearerModConf.c | 2 +- .../s1ap}/S1AP_E-RABModifyListBearerModConf.h | 2 +- .../s1ap}/S1AP_E-RABModifyListBearerModRes.c | 2 +- .../s1ap}/S1AP_E-RABModifyListBearerModRes.h | 2 +- .../s1ap}/S1AP_E-RABModifyRequest.c | 2 +- .../s1ap}/S1AP_E-RABModifyRequest.h | 2 +- .../s1ap}/S1AP_E-RABModifyResponse.c | 2 +- .../s1ap}/S1AP_E-RABModifyResponse.h | 2 +- ...1AP_E-RABNotToBeModifiedItemBearerModInd.c | 2 +- ...1AP_E-RABNotToBeModifiedItemBearerModInd.h | 2 +- ...1AP_E-RABNotToBeModifiedListBearerModInd.c | 2 +- ...1AP_E-RABNotToBeModifiedListBearerModInd.h | 2 +- .../s1ap}/S1AP_E-RABReleaseCommand.c | 2 +- .../s1ap}/S1AP_E-RABReleaseCommand.h | 2 +- .../s1ap}/S1AP_E-RABReleaseIndication.c | 2 +- .../s1ap}/S1AP_E-RABReleaseIndication.h | 2 +- .../S1AP_E-RABReleaseItemBearerRelComp.c | 2 +- .../S1AP_E-RABReleaseItemBearerRelComp.h | 2 +- .../S1AP_E-RABReleaseListBearerRelComp.c | 2 +- .../S1AP_E-RABReleaseListBearerRelComp.h | 2 +- .../s1ap}/S1AP_E-RABReleaseResponse.c | 2 +- .../s1ap}/S1AP_E-RABReleaseResponse.h | 2 +- .../s1ap}/S1AP_E-RABSetupItemBearerSURes.c | 2 +- .../s1ap}/S1AP_E-RABSetupItemBearerSURes.h | 2 +- .../s1ap}/S1AP_E-RABSetupItemCtxtSURes.c | 2 +- .../s1ap}/S1AP_E-RABSetupItemCtxtSURes.h | 2 +- .../s1ap}/S1AP_E-RABSetupListBearerSURes.c | 2 +- .../s1ap}/S1AP_E-RABSetupListBearerSURes.h | 2 +- .../s1ap}/S1AP_E-RABSetupListCtxtSURes.c | 2 +- .../s1ap}/S1AP_E-RABSetupListCtxtSURes.h | 2 +- .../s1ap}/S1AP_E-RABSetupRequest.c | 2 +- .../s1ap}/S1AP_E-RABSetupRequest.h | 2 +- .../s1ap}/S1AP_E-RABSetupResponse.c | 2 +- .../s1ap}/S1AP_E-RABSetupResponse.h | 2 +- .../S1AP_E-RABSubjecttoDataForwardingList.c | 2 +- .../S1AP_E-RABSubjecttoDataForwardingList.h | 2 +- .../S1AP_E-RABToBeModifiedItemBearerModInd.c | 2 +- .../S1AP_E-RABToBeModifiedItemBearerModInd.h | 2 +- .../S1AP_E-RABToBeModifiedItemBearerModReq.c | 2 +- .../S1AP_E-RABToBeModifiedItemBearerModReq.h | 2 +- .../S1AP_E-RABToBeModifiedListBearerModInd.c | 2 +- .../S1AP_E-RABToBeModifiedListBearerModInd.h | 2 +- .../S1AP_E-RABToBeModifiedListBearerModReq.c | 2 +- .../S1AP_E-RABToBeModifiedListBearerModReq.h | 2 +- .../S1AP_E-RABToBeSetupItemBearerSUReq.c | 2 +- .../S1AP_E-RABToBeSetupItemBearerSUReq.h | 2 +- .../s1ap}/S1AP_E-RABToBeSetupItemCtxtSUReq.c | 2 +- .../s1ap}/S1AP_E-RABToBeSetupItemCtxtSUReq.h | 2 +- .../s1ap}/S1AP_E-RABToBeSetupItemHOReq.c | 2 +- .../s1ap}/S1AP_E-RABToBeSetupItemHOReq.h | 2 +- .../S1AP_E-RABToBeSetupListBearerSUReq.c | 2 +- .../S1AP_E-RABToBeSetupListBearerSUReq.h | 2 +- .../s1ap}/S1AP_E-RABToBeSetupListCtxtSUReq.c | 2 +- .../s1ap}/S1AP_E-RABToBeSetupListCtxtSUReq.h | 2 +- .../s1ap}/S1AP_E-RABToBeSetupListHOReq.c | 2 +- .../s1ap}/S1AP_E-RABToBeSetupListHOReq.h | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedDLItem.c | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedDLItem.h | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedDLList.c | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedDLList.h | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedULItem.c | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedULItem.h | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedULList.c | 2 +- .../s1ap}/S1AP_E-RABToBeSwitchedULList.h | 2 +- .../s1ap}/S1AP_E-UTRAN-Trace-ID.c | 2 +- .../s1ap}/S1AP_E-UTRAN-Trace-ID.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EARFCN.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EARFCN.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ECGI-List.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ECGI-List.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ECGIList.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ECGIList.h | 2 +- .../s1ap}/S1AP_ECGIListForRestart.c | 2 +- .../s1ap}/S1AP_ECGIListForRestart.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-ID.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-ID.h | 2 +- ..._ENB-StatusTransfer-TransparentContainer.c | 2 +- ..._ENB-StatusTransfer-TransparentContainer.h | 2 +- .../s1ap}/S1AP_ENB-UE-S1AP-ID.c | 2 +- .../s1ap}/S1AP_ENB-UE-S1AP-ID.h | 2 +- .../s1ap}/S1AP_ENBCPRelocationIndication.c | 2 +- .../s1ap}/S1AP_ENBCPRelocationIndication.h | 2 +- .../s1ap}/S1AP_ENBConfigurationTransfer.c | 2 +- .../s1ap}/S1AP_ENBConfigurationTransfer.h | 2 +- .../s1ap}/S1AP_ENBConfigurationUpdate.c | 2 +- .../s1ap}/S1AP_ENBConfigurationUpdate.h | 2 +- .../S1AP_ENBConfigurationUpdateAcknowledge.c | 2 +- .../S1AP_ENBConfigurationUpdateAcknowledge.h | 2 +- .../S1AP_ENBConfigurationUpdateFailure.c | 2 +- .../S1AP_ENBConfigurationUpdateFailure.h | 2 +- .../s1ap}/S1AP_ENBDirectInformationTransfer.c | 2 +- .../s1ap}/S1AP_ENBDirectInformationTransfer.h | 2 +- ...1AP_ENBIndirectX2TransportLayerAddresses.c | 2 +- ...1AP_ENBIndirectX2TransportLayerAddresses.h | 2 +- .../s1ap}/S1AP_ENBStatusTransfer.c | 2 +- .../s1ap}/S1AP_ENBStatusTransfer.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLA.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLA.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLAs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLAs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2GTPTLAs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2GTPTLAs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2TLAs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ENBX2TLAs.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBname.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBname.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EPLMNs.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EPLMNs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_EUTRAN-CGI.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_EUTRAN-CGI.h | 2 +- .../S1AP_EUTRANRoundTripDelayEstimationInfo.c | 2 +- .../S1AP_EUTRANRoundTripDelayEstimationInfo.h | 2 +- .../S1AP_EmergencyAreaID-Broadcast-Item.c | 2 +- .../S1AP_EmergencyAreaID-Broadcast-Item.h | 2 +- .../s1ap}/S1AP_EmergencyAreaID-Broadcast.c | 2 +- .../s1ap}/S1AP_EmergencyAreaID-Broadcast.h | 2 +- .../S1AP_EmergencyAreaID-Cancelled-Item.c | 2 +- .../S1AP_EmergencyAreaID-Cancelled-Item.h | 2 +- .../s1ap}/S1AP_EmergencyAreaID-Cancelled.c | 2 +- .../s1ap}/S1AP_EmergencyAreaID-Cancelled.h | 2 +- .../s1ap}/S1AP_EmergencyAreaID.c | 2 +- .../s1ap}/S1AP_EmergencyAreaID.h | 2 +- .../s1ap}/S1AP_EmergencyAreaIDList.c | 2 +- .../s1ap}/S1AP_EmergencyAreaIDList.h | 2 +- .../S1AP_EmergencyAreaIDListForRestart.c | 2 +- .../S1AP_EmergencyAreaIDListForRestart.h | 2 +- .../s1ap}/S1AP_EncryptionAlgorithms.c | 2 +- .../s1ap}/S1AP_EncryptionAlgorithms.h | 2 +- .../s1ap}/S1AP_EnhancedCoverageRestricted.c | 2 +- .../s1ap}/S1AP_EnhancedCoverageRestricted.h | 2 +- .../s1ap}/S1AP_ErrorIndication.c | 2 +- .../s1ap}/S1AP_ErrorIndication.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_EventType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_EventType.h | 2 +- .../s1ap}/S1AP_ExpectedActivityPeriod.c | 2 +- .../s1ap}/S1AP_ExpectedActivityPeriod.h | 2 +- .../s1ap}/S1AP_ExpectedHOInterval.c | 2 +- .../s1ap}/S1AP_ExpectedHOInterval.h | 2 +- .../s1ap}/S1AP_ExpectedIdlePeriod.c | 2 +- .../s1ap}/S1AP_ExpectedIdlePeriod.h | 2 +- .../s1ap}/S1AP_ExpectedUEActivityBehaviour.c | 2 +- .../s1ap}/S1AP_ExpectedUEActivityBehaviour.h | 2 +- .../s1ap}/S1AP_ExpectedUEBehaviour.c | 2 +- .../s1ap}/S1AP_ExpectedUEBehaviour.h | 2 +- .../S1AP_Extended-UEIdentityIndexValue.c | 2 +- .../S1AP_Extended-UEIdentityIndexValue.h | 2 +- .../s1ap}/S1AP_ExtendedRNC-ID.c | 2 +- .../s1ap}/S1AP_ExtendedRNC-ID.h | 2 +- .../s1ap}/S1AP_ExtendedRepetitionPeriod.c | 2 +- .../s1ap}/S1AP_ExtendedRepetitionPeriod.h | 2 +- .../s1ap}/S1AP_ForbiddenInterRATs.c | 2 +- .../s1ap}/S1AP_ForbiddenInterRATs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenLACs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenLACs.h | 2 +- .../s1ap}/S1AP_ForbiddenLAs-Item.c | 2 +- .../s1ap}/S1AP_ForbiddenLAs-Item.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenLAs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenLAs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenTACs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenTACs.h | 2 +- .../s1ap}/S1AP_ForbiddenTAs-Item.c | 2 +- .../s1ap}/S1AP_ForbiddenTAs-Item.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenTAs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ForbiddenTAs.h | 2 +- .../s1ap}/S1AP_GBR-QosInformation.c | 2 +- .../s1ap}/S1AP_GBR-QosInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GERAN-Cell-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GERAN-Cell-ID.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GTP-TEID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GTP-TEID.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEI.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GUMMEIList.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GUMMEIList.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GUMMEIType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_GUMMEIType.h | 2 +- .../s1ap}/S1AP_GWContextReleaseIndication.c | 2 +- .../s1ap}/S1AP_GWContextReleaseIndication.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Global-ENB-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Global-ENB-ID.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFN.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFN.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_HFNModified.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_HFNModified.h | 2 +- .../s1ap}/S1AP_HFNforPDCP-SNlength18.c | 2 +- .../s1ap}/S1AP_HFNforPDCP-SNlength18.h | 2 +- .../s1ap}/S1AP_HandoverCancel.c | 2 +- .../s1ap}/S1AP_HandoverCancel.h | 2 +- .../s1ap}/S1AP_HandoverCancelAcknowledge.c | 2 +- .../s1ap}/S1AP_HandoverCancelAcknowledge.h | 2 +- .../s1ap}/S1AP_HandoverCommand.c | 2 +- .../s1ap}/S1AP_HandoverCommand.h | 2 +- .../s1ap}/S1AP_HandoverFailure.c | 2 +- .../s1ap}/S1AP_HandoverFailure.h | 2 +- .../s1ap}/S1AP_HandoverNotify.c | 2 +- .../s1ap}/S1AP_HandoverNotify.h | 2 +- .../s1ap}/S1AP_HandoverPreparationFailure.c | 2 +- .../s1ap}/S1AP_HandoverPreparationFailure.h | 2 +- .../s1ap}/S1AP_HandoverRequest.c | 2 +- .../s1ap}/S1AP_HandoverRequest.h | 2 +- .../s1ap}/S1AP_HandoverRequestAcknowledge.c | 2 +- .../s1ap}/S1AP_HandoverRequestAcknowledge.h | 2 +- .../s1ap}/S1AP_HandoverRequired.c | 2 +- .../s1ap}/S1AP_HandoverRequired.h | 2 +- .../s1ap}/S1AP_HandoverRestrictionList.c | 2 +- .../s1ap}/S1AP_HandoverRestrictionList.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_HandoverType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_HandoverType.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IMSI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IMSI.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ImmediateMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ImmediateMDT.h | 2 +- ...mationOnRecommendedCellsAndENBsForPaging.c | 2 +- ...mationOnRecommendedCellsAndENBsForPaging.h | 2 +- .../s1ap}/S1AP_InitialContextSetupFailure.c | 2 +- .../s1ap}/S1AP_InitialContextSetupFailure.h | 2 +- .../s1ap}/S1AP_InitialContextSetupRequest.c | 2 +- .../s1ap}/S1AP_InitialContextSetupRequest.h | 2 +- .../s1ap}/S1AP_InitialContextSetupResponse.c | 2 +- .../s1ap}/S1AP_InitialContextSetupResponse.h | 2 +- .../s1ap}/S1AP_InitialUEMessage.c | 2 +- .../s1ap}/S1AP_InitialUEMessage.h | 2 +- .../s1ap}/S1AP_InitiatingMessage.c | 2 +- .../s1ap}/S1AP_InitiatingMessage.h | 2 +- .../S1AP_IntegrityProtectionAlgorithms.c | 2 +- .../S1AP_IntegrityProtectionAlgorithms.h | 2 +- .../S1AP_IntendedNumberOfPagingAttempts.c | 2 +- .../S1AP_IntendedNumberOfPagingAttempts.h | 2 +- ...S1AP_Inter-SystemInformationTransferType.c | 2 +- ...S1AP_Inter-SystemInformationTransferType.h | 2 +- .../s1ap}/S1AP_InterfacesToTrace.c | 2 +- .../s1ap}/S1AP_InterfacesToTrace.h | 2 +- .../s1ap}/S1AP_KillAllWarningMessages.c | 2 +- .../s1ap}/S1AP_KillAllWarningMessages.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_KillRequest.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_KillRequest.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_KillResponse.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_KillResponse.h | 2 +- .../s1ap}/S1AP_L3-Information.c | 2 +- .../s1ap}/S1AP_L3-Information.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAC.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAC.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAI.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LHN-ID.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LHN-ID.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_LPPa-PDU.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_LPPa-PDU.h | 2 +- .../s1ap}/S1AP_LastVisitedCell-Item.c | 2 +- .../s1ap}/S1AP_LastVisitedCell-Item.h | 2 +- .../S1AP_LastVisitedEUTRANCellInformation.c | 2 +- .../S1AP_LastVisitedEUTRANCellInformation.h | 2 +- .../S1AP_LastVisitedGERANCellInformation.c | 2 +- .../S1AP_LastVisitedGERANCellInformation.h | 2 +- .../S1AP_LastVisitedUTRANCellInformation.c | 2 +- .../S1AP_LastVisitedUTRANCellInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Links-to-log.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Links-to-log.h | 2 +- .../s1ap}/S1AP_ListeningSubframePattern.c | 2 +- .../s1ap}/S1AP_ListeningSubframePattern.h | 2 +- .../s1ap}/S1AP_LocationReport.c | 2 +- .../s1ap}/S1AP_LocationReport.h | 2 +- .../s1ap}/S1AP_LocationReportingControl.c | 2 +- .../s1ap}/S1AP_LocationReportingControl.h | 2 +- .../S1AP_LocationReportingFailureIndication.c | 2 +- .../S1AP_LocationReportingFailureIndication.h | 2 +- .../s1ap}/S1AP_LoggedMBSFNMDT.c | 2 +- .../s1ap}/S1AP_LoggedMBSFNMDT.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_LoggedMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_LoggedMDT.h | 2 +- .../s1ap}/S1AP_LoggingDuration.c | 2 +- .../s1ap}/S1AP_LoggingDuration.h | 2 +- .../s1ap}/S1AP_LoggingInterval.c | 2 +- .../s1ap}/S1AP_LoggingInterval.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M-TMSI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M-TMSI.h | 2 +- .../s1ap}/S1AP_M1PeriodicReporting.c | 2 +- .../s1ap}/S1AP_M1PeriodicReporting.h | 2 +- .../s1ap}/S1AP_M1ReportingTrigger.c | 2 +- .../s1ap}/S1AP_M1ReportingTrigger.h | 2 +- .../s1ap}/S1AP_M1ThresholdEventA2.c | 2 +- .../s1ap}/S1AP_M1ThresholdEventA2.h | 2 +- .../s1ap}/S1AP_M3Configuration.c | 2 +- .../s1ap}/S1AP_M3Configuration.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M3period.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M3period.h | 2 +- .../s1ap}/S1AP_M4Configuration.c | 2 +- .../s1ap}/S1AP_M4Configuration.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M4period.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M4period.h | 2 +- .../s1ap}/S1AP_M5Configuration.c | 2 +- .../s1ap}/S1AP_M5Configuration.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M5period.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M5period.h | 2 +- .../s1ap}/S1AP_M6Configuration.c | 2 +- .../s1ap}/S1AP_M6Configuration.h | 2 +- .../s1ap}/S1AP_M6delay-threshold.c | 2 +- .../s1ap}/S1AP_M6delay-threshold.h | 2 +- .../s1ap}/S1AP_M6report-Interval.c | 2 +- .../s1ap}/S1AP_M6report-Interval.h | 2 +- .../s1ap}/S1AP_M7Configuration.c | 2 +- .../s1ap}/S1AP_M7Configuration.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M7period.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_M7period.h | 2 +- .../s1ap}/S1AP_MBSFN-ResultToLog.c | 2 +- .../s1ap}/S1AP_MBSFN-ResultToLog.h | 2 +- .../s1ap}/S1AP_MBSFN-ResultToLogInfo.c | 2 +- .../s1ap}/S1AP_MBSFN-ResultToLogInfo.h | 2 +- .../s1ap}/S1AP_MDT-Activation.c | 2 +- .../s1ap}/S1AP_MDT-Activation.h | 2 +- .../s1ap}/S1AP_MDT-Configuration.c | 2 +- .../s1ap}/S1AP_MDT-Configuration.h | 2 +- .../s1ap}/S1AP_MDT-Location-Info.c | 2 +- .../s1ap}/S1AP_MDT-Location-Info.h | 2 +- .../s1ap}/S1AP_MDTMode-Extension.c | 2 +- .../s1ap}/S1AP_MDTMode-Extension.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTMode.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTMode.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MDTPLMNList.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MDTPLMNList.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MME-Code.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MME-Code.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MME-Group-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MME-Group-ID.h | 2 +- .../s1ap}/S1AP_MME-UE-S1AP-ID.c | 2 +- .../s1ap}/S1AP_MME-UE-S1AP-ID.h | 2 +- .../s1ap}/S1AP_MMECPRelocationIndication.c | 2 +- .../s1ap}/S1AP_MMECPRelocationIndication.h | 2 +- .../s1ap}/S1AP_MMEConfigurationTransfer.c | 2 +- .../s1ap}/S1AP_MMEConfigurationTransfer.h | 2 +- .../s1ap}/S1AP_MMEConfigurationUpdate.c | 2 +- .../s1ap}/S1AP_MMEConfigurationUpdate.h | 2 +- .../S1AP_MMEConfigurationUpdateAcknowledge.c | 2 +- .../S1AP_MMEConfigurationUpdateAcknowledge.h | 2 +- .../S1AP_MMEConfigurationUpdateFailure.c | 2 +- .../S1AP_MMEConfigurationUpdateFailure.h | 2 +- .../s1ap}/S1AP_MMEDirectInformationTransfer.c | 2 +- .../s1ap}/S1AP_MMEDirectInformationTransfer.h | 2 +- .../s1ap}/S1AP_MMEPagingTarget.c | 2 +- .../s1ap}/S1AP_MMEPagingTarget.h | 2 +- .../s1ap}/S1AP_MMERelaySupportIndicator.c | 2 +- .../s1ap}/S1AP_MMERelaySupportIndicator.h | 2 +- .../s1ap}/S1AP_MMEStatusTransfer.c | 2 +- .../s1ap}/S1AP_MMEStatusTransfer.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEname.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEname.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MSClassmark2.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MSClassmark2.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MSClassmark3.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_MSClassmark3.h | 2 +- .../s1ap}/S1AP_ManagementBasedMDTAllowed.c | 2 +- .../s1ap}/S1AP_ManagementBasedMDTAllowed.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Masked-IMEISV.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Masked-IMEISV.h | 2 +- .../s1ap}/S1AP_MeasurementThresholdA2.c | 2 +- .../s1ap}/S1AP_MeasurementThresholdA2.h | 2 +- .../s1ap}/S1AP_MeasurementsToActivate.c | 2 +- .../s1ap}/S1AP_MeasurementsToActivate.h | 2 +- .../s1ap}/S1AP_MessageIdentifier.c | 2 +- .../s1ap}/S1AP_MessageIdentifier.h | 2 +- .../s1ap}/S1AP_MobilityInformation.c | 2 +- .../s1ap}/S1AP_MobilityInformation.h | 2 +- .../s1ap}/S1AP_MutingAvailabilityIndication.c | 2 +- .../s1ap}/S1AP_MutingAvailabilityIndication.h | 2 +- .../s1ap}/S1AP_MutingPatternInformation.c | 2 +- .../s1ap}/S1AP_MutingPatternInformation.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NAS-PDU.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NAS-PDU.h | 2 +- .../s1ap}/S1AP_NASDeliveryIndication.c | 2 +- .../s1ap}/S1AP_NASDeliveryIndication.h | 2 +- .../s1ap}/S1AP_NASNonDeliveryIndication.c | 2 +- .../s1ap}/S1AP_NASNonDeliveryIndication.h | 2 +- .../S1AP_NASSecurityParametersfromE-UTRAN.c | 2 +- .../S1AP_NASSecurityParametersfromE-UTRAN.h | 2 +- .../S1AP_NASSecurityParameterstoE-UTRAN.c | 2 +- .../S1AP_NASSecurityParameterstoE-UTRAN.h | 2 +- .../s1ap}/S1AP_NB-IoT-DefaultPagingDRX.c | 2 +- .../s1ap}/S1AP_NB-IoT-DefaultPagingDRX.h | 2 +- .../s1ap}/S1AP_NB-IoT-Paging-eDRX-Cycle.c | 2 +- .../s1ap}/S1AP_NB-IoT-Paging-eDRX-Cycle.h | 2 +- .../S1AP_NB-IoT-Paging-eDRXInformation.c | 2 +- .../S1AP_NB-IoT-Paging-eDRXInformation.h | 2 +- .../s1ap}/S1AP_NB-IoT-PagingTimeWindow.c | 2 +- .../s1ap}/S1AP_NB-IoT-PagingTimeWindow.h | 2 +- .../s1ap}/S1AP_NB-IoT-UEIdentityIndexValue.c | 2 +- .../s1ap}/S1AP_NB-IoT-UEIdentityIndexValue.h | 2 +- .../s1ap}/S1AP_NextPagingAreaScope.c | 2 +- .../s1ap}/S1AP_NextPagingAreaScope.h | 2 +- .../s1ap}/S1AP_NumberOfBroadcasts.c | 2 +- .../s1ap}/S1AP_NumberOfBroadcasts.h | 2 +- .../s1ap}/S1AP_NumberofBroadcastRequest.c | 2 +- .../s1ap}/S1AP_NumberofBroadcastRequest.h | 2 +- .../s1ap}/S1AP_OldBSS-ToNewBSS-Information.c | 2 +- .../s1ap}/S1AP_OldBSS-ToNewBSS-Information.h | 2 +- .../s1ap}/S1AP_OverloadAction.c | 2 +- .../s1ap}/S1AP_OverloadAction.h | 2 +- .../s1ap}/S1AP_OverloadResponse.c | 2 +- .../s1ap}/S1AP_OverloadResponse.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_OverloadStart.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_OverloadStart.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_OverloadStop.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_OverloadStop.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SN.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SN.h | 2 +- .../s1ap}/S1AP_PDCP-SNExtended.c | 2 +- .../s1ap}/S1AP_PDCP-SNExtended.h | 2 +- .../s1ap}/S1AP_PDCP-SNlength18.c | 2 +- .../s1ap}/S1AP_PDCP-SNlength18.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PLMNidentity.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PLMNidentity.h | 2 +- .../s1ap}/S1AP_PS-ServiceNotAvailable.c | 2 +- .../s1ap}/S1AP_PS-ServiceNotAvailable.h | 2 +- .../s1ap}/S1AP_PWSFailureIndication.c | 2 +- .../s1ap}/S1AP_PWSFailureIndication.h | 2 +- .../s1ap}/S1AP_PWSRestartIndication.c | 2 +- .../s1ap}/S1AP_PWSRestartIndication.h | 2 +- .../s1ap}/S1AP_PWSfailedECGIList.c | 2 +- .../s1ap}/S1AP_PWSfailedECGIList.h | 2 +- .../s1ap}/S1AP_Paging-eDRX-Cycle.c | 2 +- .../s1ap}/S1AP_Paging-eDRX-Cycle.h | 2 +- .../s1ap}/S1AP_Paging-eDRXInformation.c | 2 +- .../s1ap}/S1AP_Paging-eDRXInformation.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging.h | 2 +- .../s1ap}/S1AP_PagingAttemptCount.c | 2 +- .../s1ap}/S1AP_PagingAttemptCount.h | 2 +- .../s1ap}/S1AP_PagingAttemptInformation.c | 2 +- .../s1ap}/S1AP_PagingAttemptInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PagingDRX.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PagingDRX.h | 2 +- .../s1ap}/S1AP_PagingPriority.c | 2 +- .../s1ap}/S1AP_PagingPriority.h | 2 +- .../s1ap}/S1AP_PagingTimeWindow.c | 2 +- .../s1ap}/S1AP_PagingTimeWindow.h | 2 +- .../s1ap}/S1AP_PathSwitchRequest.c | 2 +- .../s1ap}/S1AP_PathSwitchRequest.h | 2 +- .../s1ap}/S1AP_PathSwitchRequestAcknowledge.c | 2 +- .../s1ap}/S1AP_PathSwitchRequestAcknowledge.h | 2 +- .../s1ap}/S1AP_PathSwitchRequestFailure.c | 2 +- .../s1ap}/S1AP_PathSwitchRequestFailure.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PedestrianUE.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PedestrianUE.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Port-Number.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Port-Number.h | 2 +- .../s1ap}/S1AP_Pre-emptionCapability.c | 2 +- .../s1ap}/S1AP_Pre-emptionCapability.h | 2 +- .../s1ap}/S1AP_Pre-emptionVulnerability.c | 2 +- .../s1ap}/S1AP_Pre-emptionVulnerability.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Presence.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Presence.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PriorityLevel.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PriorityLevel.h | 2 +- .../s1ap}/S1AP_PrivacyIndicator.c | 2 +- .../s1ap}/S1AP_PrivacyIndicator.h | 2 +- .../s1ap}/S1AP_PrivateIE-Container.c | 2 +- .../s1ap}/S1AP_PrivateIE-Container.h | 2 +- .../s1ap}/S1AP_PrivateIE-Field.c | 2 +- .../s1ap}/S1AP_PrivateIE-Field.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PrivateIE-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_PrivateIE-ID.h | 2 +- .../s1ap}/S1AP_PrivateMessage.c | 2 +- .../s1ap}/S1AP_PrivateMessage.h | 2 +- .../s1ap}/S1AP_ProSeAuthorized.c | 2 +- .../s1ap}/S1AP_ProSeAuthorized.h | 2 +- .../s1ap}/S1AP_ProSeDirectCommunication.c | 2 +- .../s1ap}/S1AP_ProSeDirectCommunication.h | 2 +- .../s1ap}/S1AP_ProSeDirectDiscovery.c | 2 +- .../s1ap}/S1AP_ProSeDirectDiscovery.h | 2 +- .../s1ap}/S1AP_ProSeUEtoNetworkRelaying.c | 2 +- .../s1ap}/S1AP_ProSeUEtoNetworkRelaying.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ProcedureCode.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ProcedureCode.h | 2 +- .../S1AP_ProtocolError-IE-ContainerList.h | 2 +- .../s1ap}/S1AP_ProtocolExtensionContainer.c | 2 +- .../s1ap}/S1AP_ProtocolExtensionContainer.h | 2 +- .../s1ap}/S1AP_ProtocolExtensionField.c | 2 +- .../s1ap}/S1AP_ProtocolExtensionField.h | 2 +- .../s1ap}/S1AP_ProtocolExtensionID.c | 2 +- .../s1ap}/S1AP_ProtocolExtensionID.h | 2 +- .../s1ap}/S1AP_ProtocolIE-Container.c | 2 +- .../s1ap}/S1AP_ProtocolIE-Container.h | 2 +- .../s1ap}/S1AP_ProtocolIE-ContainerList.c | 2 +- .../s1ap}/S1AP_ProtocolIE-ContainerList.h | 2 +- .../s1ap}/S1AP_ProtocolIE-ContainerPair.h | 2 +- .../s1ap}/S1AP_ProtocolIE-ContainerPairList.h | 2 +- .../s1ap}/S1AP_ProtocolIE-Field.c | 2 +- .../s1ap}/S1AP_ProtocolIE-Field.h | 2 +- .../s1ap}/S1AP_ProtocolIE-FieldPair.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ID.h | 2 +- .../s1ap}/S1AP_ProtocolIE-SingleContainer.c | 2 +- .../s1ap}/S1AP_ProtocolIE-SingleContainer.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_QCI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_QCI.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RAC.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RAC.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RAT-Type.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RAT-Type.h | 2 +- .../s1ap}/S1AP_RIMInformation.c | 2 +- .../s1ap}/S1AP_RIMInformation.h | 2 +- .../s1ap}/S1AP_RIMRoutingAddress.c | 2 +- .../s1ap}/S1AP_RIMRoutingAddress.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RIMTransfer.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RIMTransfer.h | 2 +- .../s1ap}/S1AP_RLFReportInformation.c | 2 +- .../s1ap}/S1AP_RLFReportInformation.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RNC-ID.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RNC-ID.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RRC-Container.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RRC-Container.h | 2 +- .../s1ap}/S1AP_RRC-Establishment-Cause.c | 2 +- .../s1ap}/S1AP_RRC-Establishment-Cause.h | 2 +- .../S1AP_ReceiveStatusOfULPDCPSDUsExtended.c | 2 +- .../S1AP_ReceiveStatusOfULPDCPSDUsExtended.h | 2 +- ...ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c | 2 +- ...ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h | 2 +- .../s1ap}/S1AP_ReceiveStatusofULPDCPSDUs.c | 2 +- .../s1ap}/S1AP_ReceiveStatusofULPDCPSDUs.h | 2 +- .../s1ap}/S1AP_RecommendedCellItem.c | 2 +- .../s1ap}/S1AP_RecommendedCellItem.h | 2 +- .../s1ap}/S1AP_RecommendedCellList.c | 2 +- .../s1ap}/S1AP_RecommendedCellList.h | 2 +- .../s1ap}/S1AP_RecommendedCellsForPaging.c | 2 +- .../s1ap}/S1AP_RecommendedCellsForPaging.h | 2 +- .../s1ap}/S1AP_RecommendedENBItem.c | 2 +- .../s1ap}/S1AP_RecommendedENBItem.h | 2 +- .../s1ap}/S1AP_RecommendedENBList.c | 2 +- .../s1ap}/S1AP_RecommendedENBList.h | 2 +- .../s1ap}/S1AP_RecommendedENBsForPaging.c | 2 +- .../s1ap}/S1AP_RecommendedENBsForPaging.h | 2 +- .../s1ap}/S1AP_RelativeMMECapacity.c | 2 +- .../s1ap}/S1AP_RelativeMMECapacity.h | 2 +- .../s1ap}/S1AP_RelayNode-Indicator.c | 2 +- .../s1ap}/S1AP_RelayNode-Indicator.h | 2 +- .../s1ap}/S1AP_RepetitionPeriod.c | 2 +- .../s1ap}/S1AP_RepetitionPeriod.h | 2 +- .../s1ap}/S1AP_ReportAmountMDT.c | 2 +- .../s1ap}/S1AP_ReportAmountMDT.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ReportArea.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ReportArea.h | 2 +- .../s1ap}/S1AP_ReportIntervalMDT.c | 2 +- .../s1ap}/S1AP_ReportIntervalMDT.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RequestType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_RequestType.h | 2 +- .../s1ap}/S1AP_RerouteNASRequest.c | 2 +- .../s1ap}/S1AP_RerouteNASRequest.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Reset.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Reset.h | 2 +- .../s1ap}/S1AP_ResetAcknowledge.c | 2 +- .../s1ap}/S1AP_ResetAcknowledge.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ResetAll.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ResetAll.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ResetType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ResetType.h | 2 +- .../s1ap}/S1AP_RetrieveUEInformation.c | 2 +- .../s1ap}/S1AP_RetrieveUEInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Routing-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_Routing-ID.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S-TMSI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S-TMSI.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_S1AP-PDU.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_S1AP-PDU.h | 2 +- .../s1ap}/S1AP_S1SetupFailure.c | 2 +- .../s1ap}/S1AP_S1SetupFailure.h | 2 +- .../s1ap}/S1AP_S1SetupRequest.c | 2 +- .../s1ap}/S1AP_S1SetupRequest.h | 2 +- .../s1ap}/S1AP_S1SetupResponse.c | 2 +- .../s1ap}/S1AP_S1SetupResponse.h | 2 +- .../s1ap}/S1AP_SONConfigurationTransfer.c | 2 +- .../s1ap}/S1AP_SONConfigurationTransfer.h | 2 +- .../s1ap}/S1AP_SONInformation-Extension.c | 2 +- .../s1ap}/S1AP_SONInformation-Extension.h | 2 +- .../s1ap}/S1AP_SONInformation.c | 2 +- .../s1ap}/S1AP_SONInformation.h | 2 +- .../s1ap}/S1AP_SONInformationReply.c | 2 +- .../s1ap}/S1AP_SONInformationReply.h | 2 +- .../s1ap}/S1AP_SONInformationReport.c | 2 +- .../s1ap}/S1AP_SONInformationReport.h | 2 +- .../s1ap}/S1AP_SONInformationRequest.c | 2 +- .../s1ap}/S1AP_SONInformationRequest.h | 2 +- .../s1ap}/S1AP_SRVCCHOIndication.c | 2 +- .../s1ap}/S1AP_SRVCCHOIndication.h | 2 +- .../s1ap}/S1AP_SRVCCOperationNotPossible.c | 2 +- .../s1ap}/S1AP_SRVCCOperationNotPossible.h | 2 +- .../s1ap}/S1AP_SRVCCOperationPossible.c | 2 +- .../s1ap}/S1AP_SRVCCOperationPossible.h | 2 +- .../s1ap}/S1AP_SecurityContext.c | 2 +- .../s1ap}/S1AP_SecurityContext.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SecurityKey.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SecurityKey.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SerialNumber.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SerialNumber.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedDCNs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedDCNs.h | 2 +- .../s1ap}/S1AP_ServedDCNsItem.c | 2 +- .../s1ap}/S1AP_ServedDCNsItem.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedGUMMEIs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedGUMMEIs.h | 2 +- .../s1ap}/S1AP_ServedGUMMEIsItem.c | 2 +- .../s1ap}/S1AP_ServedGUMMEIsItem.h | 2 +- .../s1ap}/S1AP_ServedGroupIDs.c | 2 +- .../s1ap}/S1AP_ServedGroupIDs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedMMECs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedMMECs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedPLMNs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_ServedPLMNs.h | 2 +- ...1AP_Source-ToTarget-TransparentContainer.c | 2 +- ...1AP_Source-ToTarget-TransparentContainer.h | 2 +- ...urceBSS-ToTargetBSS-TransparentContainer.c | 2 +- ...urceBSS-ToTargetBSS-TransparentContainer.h | 2 +- ...P_SourceOfUEActivityBehaviourInformation.c | 2 +- ...P_SourceOfUEActivityBehaviourInformation.h | 2 +- ...urceRNC-ToTargetRNC-TransparentContainer.c | 2 +- ...urceRNC-ToTargetRNC-TransparentContainer.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SourceeNB-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SourceeNB-ID.h | 2 +- ...urceeNB-ToTargeteNB-TransparentContainer.c | 2 +- ...urceeNB-ToTargeteNB-TransparentContainer.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_StratumLevel.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_StratumLevel.h | 2 +- .../s1ap}/S1AP_SubscriberProfileIDforRFP.c | 2 +- .../s1ap}/S1AP_SubscriberProfileIDforRFP.h | 2 +- .../s1ap}/S1AP_SuccessfulOutcome.c | 2 +- .../s1ap}/S1AP_SuccessfulOutcome.h | 2 +- .../s1ap}/S1AP_SupportedTAs-Item.c | 2 +- .../s1ap}/S1AP_SupportedTAs-Item.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SupportedTAs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_SupportedTAs.h | 2 +- .../s1ap}/S1AP_SynchronisationInformation.c | 2 +- .../s1ap}/S1AP_SynchronisationInformation.h | 2 +- .../s1ap}/S1AP_SynchronisationStatus.c | 2 +- .../s1ap}/S1AP_SynchronisationStatus.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TABasedMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TABasedMDT.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAC.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAC.h | 2 +- .../s1ap}/S1AP_TAI-Broadcast-Item.c | 2 +- .../s1ap}/S1AP_TAI-Broadcast-Item.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAI-Broadcast.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAI-Broadcast.h | 2 +- .../s1ap}/S1AP_TAI-Cancelled-Item.c | 2 +- .../s1ap}/S1AP_TAI-Cancelled-Item.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAI-Cancelled.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAI-Cancelled.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAIBasedMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAIBasedMDT.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIItem.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIItem.h | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIList.c | 2 +- lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIList.h | 2 +- .../s1ap}/S1AP_TAIListForRestart.c | 2 +- .../s1ap}/S1AP_TAIListForRestart.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAIListforMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAIListforMDT.h | 2 +- .../s1ap}/S1AP_TAIListforWarning.c | 2 +- .../s1ap}/S1AP_TAIListforWarning.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAListforMDT.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TAListforMDT.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TBCD-STRING.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TBCD-STRING.h | 2 +- ...1AP_Target-ToSource-TransparentContainer.c | 2 +- ...1AP_Target-ToSource-TransparentContainer.h | 2 +- ...rgetBSS-ToSourceBSS-TransparentContainer.c | 2 +- ...rgetBSS-ToSourceBSS-TransparentContainer.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TargetID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TargetID.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TargetRNC-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TargetRNC-ID.h | 2 +- ...rgetRNC-ToSourceRNC-TransparentContainer.c | 2 +- ...rgetRNC-ToSourceRNC-TransparentContainer.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TargeteNB-ID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TargeteNB-ID.h | 2 +- ...rgeteNB-ToSourceeNB-TransparentContainer.c | 2 +- ...rgeteNB-ToSourceeNB-TransparentContainer.h | 2 +- .../s1ap}/S1AP_Threshold-RSRP.c | 2 +- .../s1ap}/S1AP_Threshold-RSRP.h | 2 +- .../s1ap}/S1AP_Threshold-RSRQ.c | 2 +- .../s1ap}/S1AP_Threshold-RSRQ.h | 2 +- ...Time-UE-StayedInCell-EnhancedGranularity.c | 2 +- ...Time-UE-StayedInCell-EnhancedGranularity.h | 2 +- .../s1ap}/S1AP_Time-UE-StayedInCell.c | 2 +- .../s1ap}/S1AP_Time-UE-StayedInCell.h | 2 +- .../s1ap}/S1AP_TimeSynchronisationInfo.c | 2 +- .../s1ap}/S1AP_TimeSynchronisationInfo.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TimeToWait.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TimeToWait.h | 2 +- .../s1ap}/S1AP_TraceActivation.c | 2 +- .../s1ap}/S1AP_TraceActivation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TraceDepth.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TraceDepth.h | 2 +- .../s1ap}/S1AP_TraceFailureIndication.c | 2 +- .../s1ap}/S1AP_TraceFailureIndication.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TraceStart.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TraceStart.h | 2 +- .../S1AP_TrafficLoadReductionIndication.c | 2 +- .../S1AP_TrafficLoadReductionIndication.h | 2 +- .../s1ap}/S1AP_TransportInformation.c | 2 +- .../s1ap}/S1AP_TransportInformation.h | 2 +- .../s1ap}/S1AP_TransportLayerAddress.c | 2 +- .../s1ap}/S1AP_TransportLayerAddress.h | 2 +- .../s1ap}/S1AP_TriggeringMessage.c | 2 +- .../s1ap}/S1AP_TriggeringMessage.h | 2 +- .../s1ap}/S1AP_TunnelInformation.c | 2 +- .../s1ap}/S1AP_TunnelInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TypeOfError.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_TypeOfError.h | 2 +- .../s1ap}/S1AP_UE-HistoryInformation.c | 2 +- .../s1ap}/S1AP_UE-HistoryInformation.h | 2 +- .../S1AP_UE-HistoryInformationFromTheUE.c | 2 +- .../S1AP_UE-HistoryInformationFromTheUE.h | 2 +- ...-RLF-Report-Container-for-extended-bands.c | 2 +- ...-RLF-Report-Container-for-extended-bands.h | 2 +- .../s1ap}/S1AP_UE-RLF-Report-Container.c | 2 +- .../s1ap}/S1AP_UE-RLF-Report-Container.h | 2 +- .../s1ap}/S1AP_UE-RetentionInformation.c | 2 +- .../s1ap}/S1AP_UE-RetentionInformation.h | 2 +- .../s1ap}/S1AP_UE-S1AP-ID-pair.c | 2 +- .../s1ap}/S1AP_UE-S1AP-ID-pair.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UE-S1AP-IDs.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UE-S1AP-IDs.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UE-Usage-Type.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UE-Usage-Type.h | 2 +- ...AP_UE-associatedLogicalS1-ConnectionItem.c | 2 +- ...AP_UE-associatedLogicalS1-ConnectionItem.h | 2 +- ...UE-associatedLogicalS1-ConnectionListRes.c | 2 +- ...UE-associatedLogicalS1-ConnectionListRes.h | 2 +- ...associatedLogicalS1-ConnectionListResAck.c | 2 +- ...associatedLogicalS1-ConnectionListResAck.h | 2 +- .../s1ap}/S1AP_UEAggregateMaximumBitrate.c | 2 +- .../s1ap}/S1AP_UEAggregateMaximumBitrate.h | 2 +- .../s1ap}/S1AP_UECapabilityInfoIndication.c | 2 +- .../s1ap}/S1AP_UECapabilityInfoIndication.h | 2 +- .../s1ap}/S1AP_UEContextModificationConfirm.c | 2 +- .../s1ap}/S1AP_UEContextModificationConfirm.h | 2 +- .../s1ap}/S1AP_UEContextModificationFailure.c | 2 +- .../s1ap}/S1AP_UEContextModificationFailure.h | 2 +- .../S1AP_UEContextModificationIndication.c | 2 +- .../S1AP_UEContextModificationIndication.h | 2 +- .../s1ap}/S1AP_UEContextModificationRequest.c | 2 +- .../s1ap}/S1AP_UEContextModificationRequest.h | 2 +- .../S1AP_UEContextModificationResponse.c | 2 +- .../S1AP_UEContextModificationResponse.h | 2 +- .../s1ap}/S1AP_UEContextReleaseCommand.c | 2 +- .../s1ap}/S1AP_UEContextReleaseCommand.h | 2 +- .../s1ap}/S1AP_UEContextReleaseComplete.c | 2 +- .../s1ap}/S1AP_UEContextReleaseComplete.h | 2 +- .../s1ap}/S1AP_UEContextReleaseRequest.c | 2 +- .../s1ap}/S1AP_UEContextReleaseRequest.h | 2 +- .../s1ap}/S1AP_UEContextResumeFailure.c | 2 +- .../s1ap}/S1AP_UEContextResumeFailure.h | 2 +- .../s1ap}/S1AP_UEContextResumeRequest.c | 2 +- .../s1ap}/S1AP_UEContextResumeRequest.h | 2 +- .../s1ap}/S1AP_UEContextResumeResponse.c | 2 +- .../s1ap}/S1AP_UEContextResumeResponse.h | 2 +- .../s1ap}/S1AP_UEContextSuspendRequest.c | 2 +- .../s1ap}/S1AP_UEContextSuspendRequest.h | 2 +- .../s1ap}/S1AP_UEContextSuspendResponse.c | 2 +- .../s1ap}/S1AP_UEContextSuspendResponse.h | 2 +- .../s1ap}/S1AP_UEIdentityIndexValue.c | 2 +- .../s1ap}/S1AP_UEIdentityIndexValue.h | 2 +- .../s1ap}/S1AP_UEInformationTransfer.c | 2 +- .../s1ap}/S1AP_UEInformationTransfer.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UEPagingID.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UEPagingID.h | 2 +- .../s1ap}/S1AP_UERadioCapability.c | 2 +- .../s1ap}/S1AP_UERadioCapability.h | 2 +- .../s1ap}/S1AP_UERadioCapabilityForPaging.c | 2 +- .../s1ap}/S1AP_UERadioCapabilityForPaging.h | 2 +- .../S1AP_UERadioCapabilityMatchRequest.c | 2 +- .../S1AP_UERadioCapabilityMatchRequest.h | 2 +- .../S1AP_UERadioCapabilityMatchResponse.c | 2 +- .../S1AP_UERadioCapabilityMatchResponse.h | 2 +- .../s1ap}/S1AP_UESecurityCapabilities.c | 2 +- .../s1ap}/S1AP_UESecurityCapabilities.h | 2 +- .../S1AP_UESidelinkAggregateMaximumBitrate.c | 2 +- .../S1AP_UESidelinkAggregateMaximumBitrate.h | 2 +- .../S1AP_UEUserPlaneCIoTSupportIndicator.c | 2 +- .../S1AP_UEUserPlaneCIoTSupportIndicator.h | 2 +- .../s1ap}/S1AP_UL-CP-SecurityInformation.c | 2 +- .../s1ap}/S1AP_UL-CP-SecurityInformation.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UL-NAS-Count.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UL-NAS-Count.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UL-NAS-MAC.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_UL-NAS-MAC.h | 2 +- .../s1ap}/S1AP_UnsuccessfulOutcome.c | 2 +- .../s1ap}/S1AP_UnsuccessfulOutcome.h | 2 +- .../s1ap}/S1AP_UplinkNASTransport.c | 2 +- .../s1ap}/S1AP_UplinkNASTransport.h | 2 +- .../S1AP_UplinkNonUEAssociatedLPPaTransport.c | 2 +- .../S1AP_UplinkNonUEAssociatedLPPaTransport.h | 2 +- .../s1ap}/S1AP_UplinkS1cdma2000tunnelling.c | 2 +- .../s1ap}/S1AP_UplinkS1cdma2000tunnelling.h | 2 +- .../S1AP_UplinkUEAssociatedLPPaTransport.c | 2 +- .../S1AP_UplinkUEAssociatedLPPaTransport.h | 2 +- .../s1ap}/S1AP_UserLocationInformation.c | 2 +- .../s1ap}/S1AP_UserLocationInformation.h | 2 +- .../s1ap}/S1AP_V2XServicesAuthorized.c | 2 +- .../s1ap}/S1AP_V2XServicesAuthorized.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_VehicleUE.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_VehicleUE.h | 2 +- .../s1ap}/S1AP_VoiceSupportMatchIndicator.c | 2 +- .../s1ap}/S1AP_VoiceSupportMatchIndicator.h | 2 +- .../s1ap}/S1AP_WarningAreaList.c | 2 +- .../s1ap}/S1AP_WarningAreaList.h | 2 +- .../s1ap}/S1AP_WarningMessageContents.c | 2 +- .../s1ap}/S1AP_WarningMessageContents.h | 2 +- .../s1ap}/S1AP_WarningSecurityInfo.c | 2 +- .../s1ap}/S1AP_WarningSecurityInfo.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_WarningType.c | 2 +- .../asn1c => asn1c/s1ap}/S1AP_WarningType.h | 2 +- .../s1ap}/S1AP_WriteReplaceWarningRequest.c | 2 +- .../s1ap}/S1AP_WriteReplaceWarningRequest.h | 2 +- .../s1ap}/S1AP_WriteReplaceWarningResponse.c | 2 +- .../s1ap}/S1AP_WriteReplaceWarningResponse.h | 2 +- .../s1ap}/S1AP_X2TNLConfigurationInfo.c | 2 +- .../s1ap}/S1AP_X2TNLConfigurationInfo.h | 2 +- .../asn1c => asn1c/s1ap}/S1AP_asn_constant.h | 0 lib/{s1ap => asn1c}/s1ap_asn1c.h | 4 +- lib/asn1c/s1ap_decoder.c | 48 + lib/asn1c/s1ap_encoder.c | 49 + lib/asn1c/s1ap_free.c | 32 + lib/asn1c/s1ap_message.h | 65 + lib/{s1ap => asn1c}/support/README.md | 18 +- .../support/s1ap-r14.4.0}/36413-e40.asn | 0 .../support/s1ap-r14.4.0}/36413-e40.txt | 0 lib/base/Makefile.am | 25 + lib/base/base.h | 41 + lib/base/context.c | 47 + lib/base/context.h | 53 + lib/{core/src/3gpp_types.c => base/types.c} | 90 +- .../include/3gpp_types.h => base/types.h} | 162 +- lib/core/Makefile.am | 6 - lib/core/include/arch/core_private_common.h | 4 - lib/core/include/arch/unix/core_arch_file.h | 27 - lib/core/include/arch/unix/core_arch_mutex.h | 12 - .../include/arch/unix/core_arch_network.h | 55 - lib/core/include/arch/unix/core_arch_proc.h | 19 - .../include/arch/unix/core_arch_semaphore.h | 12 - lib/core/include/arch/unix/core_arch_thread.h | 21 - lib/core/include/core.h.in | 397 --- lib/core/include/core_aes.h | 46 - lib/core/include/core_aes_cmac.h | 46 - lib/core/include/core_atomic.h | 115 - lib/core/include/core_cond.h | 118 - lib/core/include/core_debug.h | 215 -- lib/core/include/core_errno.h | 1309 ---------- lib/core/include/core_event.h | 124 - lib/core/include/core_file.h | 653 ----- lib/core/include/core_fsm.h | 56 - lib/core/include/core_general.h | 122 - lib/core/include/core_hash.h | 224 -- lib/core/include/core_index.h | 86 - lib/core/include/core_lib.h | 143 -- lib/core/include/core_list.h | 112 - lib/core/include/core_msgq.h | 86 - lib/core/include/core_mutex.h | 89 - lib/core/include/core_network.h | 250 -- lib/core/include/core_param.h | 24 - lib/core/include/core_pkbuf.h | 203 -- lib/core/include/core_pool.h | 65 - lib/core/include/core_portable.h | 60 - lib/core/include/core_queue.h | 40 - lib/core/include/core_ringbuf.h | 57 - lib/core/include/core_rwlock.h | 110 - lib/core/include/core_semaphore.h | 81 - lib/core/include/core_sha1.h | 61 - lib/core/include/core_sha1_hmac.h | 71 - lib/core/include/core_sha2.h | 102 - lib/core/include/core_sha2_hmac.h | 140 - lib/core/include/core_signal.h | 97 - lib/core/include/core_tcp.h | 20 - lib/core/include/core_thread.h | 99 - lib/core/include/core_time.h | 196 -- lib/core/include/core_timer.h | 67 - lib/core/include/core_tlv.h | 88 - lib/core/include/core_udp.h | 20 - lib/core/include/core_version.h | 141 - lib/core/src/Makefile.am | 56 - lib/core/src/aes.c | 1451 ----------- lib/core/src/aes_cmac.c | 272 -- lib/core/src/debug.c | 655 ----- lib/core/src/event.c | 120 - lib/core/src/fsm.c | 112 - lib/core/src/hash.c | 404 --- lib/core/src/misc.c | 198 -- lib/core/src/msgq.c | 250 -- lib/core/src/ringbuf.c | 170 -- lib/core/src/sha1.c | 404 --- lib/core/src/sha1_hmac.c | 120 - lib/core/src/sha2.c | 822 ------ lib/core/src/sha2_hmac.c | 380 --- lib/core/src/timer.c | 283 -- lib/core/src/tlv.c | 494 ---- lib/core/src/tlv_msg.c | 594 ----- lib/core/src/unix/atomic.c | 238 -- lib/core/src/unix/cond.c | 103 - lib/core/src/unix/errorcodes.c | 421 --- lib/core/src/unix/file.c | 1101 -------- lib/core/src/unix/mutex.c | 117 - lib/core/src/unix/pkbuf.c | 658 ----- lib/core/src/unix/rand.c | 41 - lib/core/src/unix/rwlock.c | 102 - lib/core/src/unix/sctp.c | 430 ---- lib/core/src/unix/semaphore.c | 96 - lib/core/src/unix/signal.c | 296 --- lib/core/src/unix/sockaddr.c | 545 ---- lib/core/src/unix/socket.c | 814 ------ lib/core/src/unix/start.c | 86 - lib/core/src/unix/tcp.c | 93 - lib/core/src/unix/thread.c | 226 -- lib/core/src/unix/time.c | 254 -- lib/core/src/unix/udp.c | 134 - lib/core/src/version.c | 19 - lib/core/test/Makefile.am | 35 - lib/core/test/abts.c | 479 ---- lib/core/test/abts.h | 112 - lib/core/test/abts_tests.h | 51 - lib/core/test/test3gpp.c | 36 - lib/core/test/testaes.c | 392 --- lib/core/test/testatomic.c | 491 ---- lib/core/test/testdir.c | 124 - lib/core/test/testds.c | 813 ------ lib/core/test/testfile.c | 685 ----- lib/core/test/testfilecopy.c | 163 -- lib/core/test/testfsm.c | 294 --- lib/core/test/testhash.c | 393 --- lib/core/test/testlock.c | 393 --- lib/core/test/testmisc.c | 202 -- lib/core/test/testmsgq.c | 312 --- lib/core/test/testnetlib.c | 556 ---- lib/core/test/testpkbuf.c | 66 - lib/core/test/testsctp.c | 335 --- lib/core/test/testsha.c | 164 -- lib/core/test/testsleep.c | 47 - lib/core/test/testsock.c | 458 ---- lib/core/test/testthread.c | 90 - lib/core/test/testtime.c | 289 --- lib/core/test/testtimer.c | 397 --- lib/core/test/testtlv.c | 875 ------- lib/core/test/testutil.c | 41 - lib/core/test/testutil.h | 82 - lib/fd/Makefile.am | 33 +- lib/fd/fd_config.c | 66 +- lib/fd/fd_init.c | 81 +- lib/fd/fd_lib.h | 36 +- lib/fd/fd_logger.c | 54 +- lib/fd/fd_logger.h | 33 +- lib/fd/fd_message.c | 25 +- lib/fd/fd_message.h | 33 +- lib/fd/gx/dict_init.c | 20 +- lib/fd/gx/gx_dict.h | 19 + lib/fd/gx/gx_message.c | 24 +- lib/fd/gx/gx_message.h | 29 +- lib/fd/rx/dict_init.c | 19 +- lib/fd/rx/rx_dict.h | 19 + lib/fd/rx/rx_message.c | 28 +- lib/fd/rx/rx_message.h | 47 +- lib/fd/s6a/dict_init.c | 19 + lib/fd/s6a/s6a_dict.h | 19 + lib/fd/s6a/s6a_message.h | 49 +- lib/freeDiameter-1.2.1/Makefile.am | 17 +- lib/freeDiameter-1.2.1/configure.ac | 3 - .../OpenWRT/packages/freeDiameter/Makefile | 241 -- .../contrib/OpenWRT/test_required/Makefile | 15 - .../contrib/PKI/ca_script/Makefile | 149 -- .../contrib/PKI/ca_script2/Makefile | 178 -- .../contrib/app_acct_tools/app_acct.conf | 68 - .../contrib/nightly_tests/alldefault.conf | 2 - .../contrib/nightly_tests/allext.conf | 9 - .../contrib/nightly_tests/allextdbg.conf | 11 - .../contrib/nightly_tests/allextdeb.conf | 10 - .../contrib/nightly_tests/allextmax.conf | 10 - .../contrib/nightly_tests/allextprof.conf | 11 - .../contrib/nightly_tests/allextrel.conf | 10 - .../contrib/nightly_tests/allextval.conf | 11 - .../contrib/nightly_tests/idnaignore.conf | 4 - .../contrib/nightly_tests/idnareject.conf | 4 - .../contrib/nightly_tests/nosctp.conf | 5 - .../doc/single_host/freeDiameter-1.conf | 16 - .../doc/single_host/freeDiameter-2.conf | 15 - .../doc/single_host/test_app1.conf | 0 .../doc/single_host/test_app2.conf | 0 lib/freeDiameter-1.2.1/extensions/Makefile.am | 6 +- .../extensions/dbg_msg_dumps/Makefile.am | 21 +- .../extensions/dict_dcca/Makefile.am | 21 +- .../extensions/dict_dcca_3gpp/Makefile.am | 18 +- .../extensions/dict_mip6i/Makefile.am | 21 +- .../extensions/dict_nas_mipv6/Makefile.am | 21 +- .../extensions/dict_nasreq/Makefile.am | 21 +- .../extensions/dict_rfc5777/Makefile.am | 18 +- .../extensions/dict_s6a/Makefile.am | 18 +- lib/freeDiameter-1.2.1/libfdcore/Makefile.am | 22 +- lib/freeDiameter-1.2.1/libfdproto/Makefile.am | 14 +- lib/gtp/Makefile.am | 39 +- lib/gtp/gtp_conv.c | 82 +- lib/gtp/gtp_conv.h | 40 +- lib/gtp/gtp_message.c | 198 +- lib/gtp/gtp_message.h | 72 +- lib/gtp/gtp_node.c | 162 +- lib/gtp/gtp_node.h | 59 +- lib/gtp/gtp_path.c | 324 +-- lib/gtp/gtp_path.h | 44 +- lib/gtp/gtp_tlv.c | 560 ++++ .../include/core_tlv_msg.h => gtp/gtp_tlv.h} | 76 +- lib/gtp/gtp_types.c | 225 +- lib/gtp/gtp_types.h | 227 +- lib/gtp/gtp_xact.c | 720 +++--- lib/gtp/gtp_xact.h | 85 +- lib/gtp/support/gtp_tlv.py | 157 +- lib/ipfw/Makefile.am | 35 +- lib/nas/Makefile.am | 33 +- lib/nas/nas_decoder.c | 1530 ++++++----- lib/nas/nas_encoder.c | 1483 ++++++----- lib/nas/nas_ies.c | 2275 ++++++++--------- lib/nas/nas_ies.h | 401 ++- lib/nas/nas_message.h | 144 +- lib/nas/nas_types.c | 103 +- lib/nas/nas_types.h | 986 +++---- lib/nas/support/nas_message.py | 448 ++-- lib/nas/support/type_list.py | 26 +- lib/s1ap/Makefile.am | 34 - lib/s1ap/asn1c/Makefile.am | 1159 --------- lib/s1ap/s1ap_decoder.c | 27 - lib/s1ap/s1ap_encoder.c | 31 - lib/s1ap/s1ap_free.c | 12 - lib/s1ap/s1ap_message.h | 44 - m4/ax_check_compile_flag.m4 | 53 + m4/ax_recursive_eval.m4 | 56 + main.c | 166 +- src/Makefile.am | 55 +- src/{common => app}/Makefile.am | 24 +- src/app/application.c | 164 ++ src/app/application.h | 36 + src/app/context.c | 352 +++ src/app/context.h | 78 + src/{common/yaml_helper.c => app/ogs-yaml.c} | 123 +- src/app/ogs-yaml.h | 50 + src/app_init.h | 31 +- src/common/application.c | 255 -- src/common/application.h | 27 - src/common/context.c | 438 ---- src/common/context.h | 82 - src/common/yaml_helper.h | 32 - src/epc.c | 271 +- src/hss.c | 50 +- src/hss/Makefile.am | 9 +- src/hss/hss_auc.c | 31 +- src/hss/hss_auc.h | 14 +- src/hss/hss_context.c | 342 ++- src/hss/hss_context.h | 47 +- src/hss/hss_fd_path.c | 390 ++- src/hss/hss_fd_path.h | 6 +- src/hss/hss_init.c | 20 +- src/hss/milenage.c | 110 +- src/hss/milenage.h | 40 +- src/mme.c | 50 +- src/mme/Makefile.am | 20 +- src/mme/emm_build.c | 184 +- src/mme/emm_build.h | 32 +- src/mme/emm_handler.c | 223 +- src/mme/emm_handler.h | 12 +- src/mme/emm_sm.c | 477 ++-- src/mme/esm_build.c | 168 +- src/mme/esm_build.h | 20 +- src/mme/esm_handler.c | 67 +- src/mme/esm_handler.h | 4 +- src/mme/esm_sm.c | 240 +- src/mme/kasumi.h | 18 +- src/mme/mme_context.c | 1866 ++++++-------- src/mme/mme_context.h | 467 ++-- src/mme/mme_event.c | 95 +- src/mme/mme_event.h | 62 +- src/mme/mme_fd_path.c | 516 ++-- src/mme/mme_fd_path.h | 10 +- src/mme/mme_gtp_path.c | 299 ++- src/mme/mme_gtp_path.h | 26 +- src/mme/mme_init.c | 136 +- src/mme/mme_kdf.c | 26 +- src/mme/mme_kdf.h | 12 +- src/mme/mme_path.c | 35 +- src/mme/mme_path.h | 8 +- src/mme/mme_s11_build.c | 223 +- src/mme/mme_s11_build.h | 37 +- src/mme/mme_s11_handler.c | 334 ++- src/mme/mme_s11_handler.h | 20 +- src/mme/mme_s6a_handler.c | 22 +- src/mme/mme_s6a_handler.h | 6 +- src/mme/mme_sm.c | 422 ++- src/mme/mme_sm.h | 59 +- src/mme/nas_conv.c | 14 +- src/mme/nas_conv.h | 10 +- src/mme/nas_path.c | 353 ++- src/mme/nas_path.h | 41 +- src/mme/nas_security.c | 175 +- src/mme/nas_security.h | 36 +- src/mme/ogs-sctp.c | 407 +++ src/mme/ogs-sctp.h | 57 + src/mme/s1ap_build.c | 877 ++++--- src/mme/s1ap_build.h | 88 +- src/mme/s1ap_conv.c | 113 +- src/mme/s1ap_conv.h | 30 +- src/mme/s1ap_handler.c | 1068 ++++---- src/mme/s1ap_handler.h | 47 +- src/mme/s1ap_lksctp.c | 289 +++ src/mme/s1ap_path.c | 370 ++- src/mme/s1ap_path.h | 64 +- src/mme/s1ap_sctp.c | 310 --- src/mme/s1ap_sm.c | 83 +- src/mme/s1ap_usrsctp.c | 409 ++- src/mme/sbc_handler.c | 32 +- src/mme/sbc_handler.h | 4 +- src/mme/sbc_message.h | 18 +- src/mme/snow_3g.c | 5 +- src/mme/snow_3g.h | 16 +- src/mme/zuc.c | 9 +- src/mme/zuc.h | 14 +- src/pcrf.c | 50 +- src/pcrf/Makefile.am | 9 +- src/pcrf/pcrf_context.c | 352 ++- src/pcrf/pcrf_context.h | 40 +- src/pcrf/pcrf_fd_path.c | 16 +- src/pcrf/pcrf_fd_path.h | 22 +- src/pcrf/pcrf_gx_path.c | 752 +++--- src/pcrf/pcrf_init.c | 21 +- src/pcrf/pcrf_rx_path.c | 349 ++- src/pgw.c | 50 +- src/pgw/Makefile.am | 10 +- lib/core/src/unix/tun.c => src/pgw/ogs-tun.c | 206 +- src/pgw/ogs-tun.h | 36 + src/pgw/pgw_context.c | 1030 ++++---- src/pgw/pgw_context.h | 269 +- src/pgw/pgw_event.c | 94 +- src/pgw/pgw_event.h | 30 +- src/pgw/pgw_fd_path.c | 596 +++-- src/pgw/pgw_fd_path.h | 10 +- src/pgw/pgw_gtp_path.c | 435 ++-- src/pgw/pgw_gtp_path.h | 5 +- src/pgw/pgw_gx_handler.c | 119 +- src/pgw/pgw_gx_handler.h | 6 +- src/pgw/pgw_init.c | 112 +- src/pgw/pgw_ipfw.c | 121 +- src/pgw/pgw_ipfw.h | 8 +- src/pgw/pgw_s5c_build.c | 190 +- src/pgw/pgw_s5c_build.h | 20 +- src/pgw/pgw_s5c_handler.c | 151 +- src/pgw/pgw_s5c_handler.h | 10 +- src/pgw/pgw_sm.c | 138 +- src/pgw/pgw_sm.h | 19 +- src/sgw.c | 50 +- src/sgw/Makefile.am | 11 +- src/sgw/sgw_context.c | 690 +++-- src/sgw/sgw_context.h | 205 +- src/sgw/sgw_event.c | 73 +- src/sgw/sgw_event.h | 28 +- src/sgw/sgw_gtp_path.c | 330 +-- src/sgw/sgw_gtp_path.h | 6 +- src/sgw/sgw_init.c | 108 +- src/sgw/sgw_s11_handler.c | 473 ++-- src/sgw/sgw_s11_handler.h | 22 +- src/sgw/sgw_s5c_handler.c | 227 +- src/sgw/sgw_s5c_handler.h | 14 +- src/sgw/sgw_sm.c | 101 +- src/sgw/sgw_sm.h | 19 +- support/Makefile.am | 3 - support/config/Makefile.am | 3 - support/config/hss.conf.in | 3 - support/config/mme.conf.in | 6 - support/config/nextepc.conf.in | 25 +- support/config/pcrf.conf.in | 3 - support/config/pgw.conf.in | 5 - support/config/sgw.conf.in | 4 - support/freeDiameter/Makefile.am | 15 +- support/logrotate/Makefile.am | 3 - support/newsyslog/Makefile.am | 3 - support/systemd/Makefile.am | 3 - test/Makefile.am | 60 +- test/basic/s1setup_test.c | 112 - test/basic/testutil.c | 102 - test/common/abts.c | 501 ---- test/common/abts.h | 116 - test/common/testpacket.c | 1310 +++++----- test/common/testpacket.h | 177 +- test/common/testutil.h | 60 - test/complex/abts-main.c | 160 ++ test/{basic => complex}/attach_test.c | 1226 +++++---- test/{basic => complex}/handover_test.c | 732 +++--- test/complex/s1setup_test.c | 110 + test/{basic => complex}/volte_test.c | 389 ++- test/sample-simple.conf.in | 127 + test/sample-volte.conf.in | 10 +- test/sample.conf.in | 13 +- test/simple/abts-main.c | 154 ++ test/simple/mnc3-test.c | 284 ++ test/testsuite.at | 31 +- test/unit/abts-main.c | 151 ++ test/{basic => unit}/gtp_message_test.c | 52 +- test/{basic => unit}/nas_message_test.c | 126 +- test/{basic => unit}/s1ap_message_test.c | 103 +- test/unit/sctp-test.c | 324 +++ test/{basic => unit}/security_test.c | 284 +- test/volte/abts-main.c | 164 ++ test/volte/pcscf_fd_path.c | 471 ++-- test/volte/pcscf_fd_path.h | 10 +- test/volte/testapp.c | 314 ++- test/volte/testapp.h | 8 +- test/volte/testutil.c | 112 - test/volte/volte_test.c | 490 ++-- 1552 files changed, 24483 insertions(+), 51485 deletions(-) create mode 100644 .gitmodules delete mode 100644 acinclude.m4 create mode 100755 build/git-version-gen create mode 100755 build/osc-upload.sh rename {support/docker => docker}/README.md (71%) rename {support/docker => docker}/build/Dockerfile (100%) rename {support/docker => docker}/build/setup.sh (100%) rename {support/docker => docker}/centos/7/base/Dockerfile (100%) rename {support/docker => docker}/centos/7/dev/Dockerfile (100%) rename {support/docker => docker}/centos/7/dev/setup.sh (100%) rename {support/docker => docker}/centos/latest (100%) rename {support/docker => docker}/check.sh (100%) rename {support/docker => docker}/debian/jessie/base/Dockerfile (100%) rename {support/docker => docker}/debian/jessie/dev (100%) rename {support/docker => docker}/debian/latest (100%) rename {support/docker => docker}/debian/stable (100%) rename {support/docker => docker}/debian/stretch/base/Dockerfile (100%) rename {support/docker => docker}/debian/stretch/dev (100%) rename {support/docker => docker}/docker-compose.run.yml (100%) rename {support/docker => docker}/docker-compose.test.yml (100%) rename {support/docker => docker}/docker-compose.yml (100%) rename {support/docker => docker}/fedora/27/base/Dockerfile (100%) rename {support/docker => docker}/fedora/27/dev/Dockerfile (100%) rename {support/docker => docker}/fedora/27/dev/setup.sh (100%) rename {support/docker => docker}/fedora/latest (100%) rename {support/docker => docker}/package/Dockerfile (100%) rename {support/docker => docker}/ubuntu/artful (100%) rename {support/docker => docker}/ubuntu/bionic/base/Dockerfile (100%) rename {support/docker => docker}/ubuntu/bionic/dev/Dockerfile (95%) rename {support/docker => docker}/ubuntu/bionic/dev/setup.sh (100%) rename {support/docker => docker}/ubuntu/latest (100%) rename {support/docker => docker}/ubuntu/trusty/base/Dockerfile (100%) rename {support/docker => docker}/ubuntu/trusty/dev (100%) rename {support/docker => docker}/ubuntu/xenial (100%) rename {support/docker => docker}/webui/Dockerfile (100%) create mode 100644 lib/asn1c/Makefile.am rename lib/{s1ap/asn1c => asn1c/common}/ANY.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/ANY.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/BIT_STRING.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/BIT_STRING.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/BIT_STRING_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/BOOLEAN.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/BOOLEAN.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/INTEGER.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/INTEGER.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/INTEGER_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/NULL.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/NULL.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/NativeEnumerated.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/NativeEnumerated.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/NativeEnumerated_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/NativeInteger.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/NativeInteger.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/NativeInteger_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/OBJECT_IDENTIFIER.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/OBJECT_IDENTIFIER.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/OCTET_STRING.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/OCTET_STRING.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/OCTET_STRING_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/OPEN_TYPE.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/OPEN_TYPE.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/OPEN_TYPE_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/PrintableString.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/PrintableString.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_SEQUENCE_OF.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_SEQUENCE_OF.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_SET_OF.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_SET_OF.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_application.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_application.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_bit_data.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_bit_data.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_codecs.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_codecs_prim.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_codecs_prim.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_internal.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_internal.h (93%) rename lib/{s1ap/asn1c => asn1c/common}/asn_ioc.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_random_fill.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_random_fill.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/asn_system.h (98%) rename lib/{s1ap/asn1c => asn1c/common}/ber_decoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/ber_decoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/ber_tlv_length.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/ber_tlv_length.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/ber_tlv_tag.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/ber_tlv_tag.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_CHOICE.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_CHOICE.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_CHOICE_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SEQUENCE.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SEQUENCE.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SEQUENCE_OF.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SEQUENCE_OF.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SEQUENCE_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SET_OF.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SET_OF.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_SET_OF_oer.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_TYPE.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constr_TYPE.h (99%) rename lib/{s1ap/asn1c => asn1c/common}/constraints.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/constraints.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/der_encoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/der_encoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/oer_decoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/oer_decoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/oer_encoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/oer_encoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/oer_support.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/oer_support.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_decoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_decoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_encoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_encoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_opentype.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_opentype.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_support.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/per_support.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/xer_decoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/xer_decoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/xer_encoder.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/xer_encoder.h (100%) rename lib/{s1ap/asn1c => asn1c/common}/xer_support.c (100%) rename lib/{s1ap/asn1c => asn1c/common}/xer_support.h (100%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Additional-GUTI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Additional-GUTI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AdditionalCSFallbackIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AdditionalCSFallbackIndicator.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AllocationAndRetentionPriority.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AllocationAndRetentionPriority.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AreaScopeOfMDT.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AreaScopeOfMDT.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AssistanceDataForCECapableUEs.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AssistanceDataForCECapableUEs.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AssistanceDataForPaging.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AssistanceDataForPaging.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AssistanceDataForRecommendedCells.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_AssistanceDataForRecommendedCells.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BPLMNs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BPLMNs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BearerType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BearerType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Bearers-SubjectToStatusTransfer-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Bearers-SubjectToStatusTransfer-Item.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Bearers-SubjectToStatusTransferList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Bearers-SubjectToStatusTransferList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BitRate.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BitRate.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BroadcastCancelledAreaList.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BroadcastCancelledAreaList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BroadcastCompletedAreaList.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_BroadcastCompletedAreaList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CE-mode-B-SupportIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CE-mode-B-SupportIndicator.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CELevel.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CELevel.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CGI.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CGI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CNDomain.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CNDomain.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_COUNTValueExtended.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_COUNTValueExtended.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_COUNTvalue.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_COUNTvalue.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_COUNTvaluePDCP-SNlength18.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_COUNTvaluePDCP-SNlength18.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSFallbackIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSFallbackIndicator.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-Id.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-Id.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-IdList-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-IdList-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-IdList.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSG-IdList.h (93%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSGMembershipInfo.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSGMembershipInfo.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSGMembershipStatus.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CSGMembershipStatus.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinEAI-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinEAI-Item.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinEAI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinEAI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinTAI-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinTAI-Item.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinTAI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CancelledCellinTAI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cause.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cause.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseMisc.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseMisc.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseNas.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseNas.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseProtocol.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseProtocol.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseRadioNetwork.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseRadioNetwork.h (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CauseTransport.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000HORequiredIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000HORequiredIndication.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000HOStatus.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000HOStatus.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXMEID.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXMEID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXMSI.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXMSI.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXPilot.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXPilot.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXRAND.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXRAND.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXSRVCCInfo.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000OneXSRVCCInfo.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000PDU.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000PDU.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000RATType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000RATType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000SectorID.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cdma2000SectorID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cell-Size.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Cell-Size.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellAccessMode.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellAccessMode.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellBasedMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellBasedMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Broadcast-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Broadcast-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Broadcast.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Broadcast.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Cancelled-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Cancelled-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Cancelled.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellID-Cancelled.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellIdListforMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellIdListforMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellIdentifierAndCELevelForCECapableUEs.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellIdentifierAndCELevelForCECapableUEs.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellIdentity.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellIdentity.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellTrafficTrace.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellTrafficTrace.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CellType.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinEAI-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinEAI-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinEAI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinEAI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinTAI-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinTAI-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinTAI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CompletedCellinTAI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ConcurrentWarningMessageIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ConcurrentWarningMessageIndicator.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ConnectionEstablishmentIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ConnectionEstablishmentIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Correlation-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Correlation-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Coverage-Level.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Coverage-Level.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Criticality.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Criticality.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CriticalityDiagnostics-IE-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CriticalityDiagnostics-IE-Item.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CriticalityDiagnostics-IE-List.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CriticalityDiagnostics-IE-List.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CriticalityDiagnostics.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_CriticalityDiagnostics.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DCN-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DCN-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DL-CP-SecurityInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DL-CP-SecurityInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DL-Forwarding.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DL-Forwarding.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DL-NAS-MAC.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DL-NAS-MAC.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DLNASPDUDeliveryAckRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DLNASPDUDeliveryAckRequest.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Data-Forwarding-Not-Possible.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Data-Forwarding-Not-Possible.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DataCodingScheme.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DataCodingScheme.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DeactivateTrace.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DeactivateTrace.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Direct-Forwarding-Path-Availability.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Direct-Forwarding-Path-Availability.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkNASTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkNASTransport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkNonUEAssociatedLPPaTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkNonUEAssociatedLPPaTransport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkS1cdma2000tunnelling.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkS1cdma2000tunnelling.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkUEAssociatedLPPaTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_DownlinkUEAssociatedLPPaTransport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RAB-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RAB-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RAB-IE-ContainerList.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RAB-IE-ContainerList.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RAB-IE-ContainerPairList.h (89%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABAdmittedItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABAdmittedItem.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABAdmittedList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABAdmittedList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABDataForwardingItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABDataForwardingItem.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeItemResumeReq.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeItemResumeReq.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeItemResumeRes.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeItemResumeRes.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeListResumeReq.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeListResumeReq.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeListResumeRes.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToResumeListResumeRes.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToSetupItemHOReqAck.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedToSetupItemHOReqAck.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedtoSetupListHOReqAck.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABFailedtoSetupListHOReqAck.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABInformationList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABInformationList.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABInformationListItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABInformationListItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABItem.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABItem.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABLevelQoSParameters.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABLevelQoSParameters.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABList.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABList.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModificationConfirm.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModificationConfirm.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModificationIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModificationIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyItemBearerModConf.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyItemBearerModConf.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyItemBearerModRes.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyItemBearerModRes.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyListBearerModConf.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyListBearerModConf.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyListBearerModRes.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyListBearerModRes.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABModifyResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABNotToBeModifiedItemBearerModInd.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABNotToBeModifiedItemBearerModInd.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABNotToBeModifiedListBearerModInd.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABNotToBeModifiedListBearerModInd.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseCommand.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseCommand.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseItemBearerRelComp.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseItemBearerRelComp.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseListBearerRelComp.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseListBearerRelComp.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABReleaseResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupItemBearerSURes.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupItemBearerSURes.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupItemCtxtSURes.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupItemCtxtSURes.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupListBearerSURes.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupListBearerSURes.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupListCtxtSURes.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupListCtxtSURes.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSetupResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSubjecttoDataForwardingList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABSubjecttoDataForwardingList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedItemBearerModInd.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedItemBearerModInd.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedItemBearerModReq.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedItemBearerModReq.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedListBearerModInd.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedListBearerModInd.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedListBearerModReq.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeModifiedListBearerModReq.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupItemBearerSUReq.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupItemBearerSUReq.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupItemCtxtSUReq.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupItemCtxtSUReq.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupItemHOReq.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupItemHOReq.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupListBearerSUReq.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupListBearerSUReq.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupListCtxtSUReq.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupListCtxtSUReq.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupListHOReq.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSetupListHOReq.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedDLItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedDLItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedDLList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedDLList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedULItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedULItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedULList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-RABToBeSwitchedULList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-UTRAN-Trace-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_E-UTRAN-Trace-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EARFCN.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EARFCN.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ECGI-List.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ECGI-List.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ECGIList.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ECGIList.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ECGIListForRestart.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ECGIListForRestart.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-ID.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-StatusTransfer-TransparentContainer.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-StatusTransfer-TransparentContainer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-UE-S1AP-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENB-UE-S1AP-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBCPRelocationIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBCPRelocationIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationUpdate.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationUpdate.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationUpdateAcknowledge.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationUpdateAcknowledge.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationUpdateFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBConfigurationUpdateFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBDirectInformationTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBDirectInformationTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBIndirectX2TransportLayerAddresses.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBIndirectX2TransportLayerAddresses.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBStatusTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBStatusTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLA.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLA.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLAs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2ExtTLAs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2GTPTLAs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2GTPTLAs.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2TLAs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBX2TLAs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBname.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ENBname.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EPLMNs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EPLMNs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EUTRAN-CGI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EUTRAN-CGI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EUTRANRoundTripDelayEstimationInfo.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EUTRANRoundTripDelayEstimationInfo.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Broadcast-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Broadcast-Item.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Broadcast.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Broadcast.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Cancelled-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Cancelled-Item.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Cancelled.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID-Cancelled.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaIDList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaIDList.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaIDListForRestart.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EmergencyAreaIDListForRestart.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EncryptionAlgorithms.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EncryptionAlgorithms.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EnhancedCoverageRestricted.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EnhancedCoverageRestricted.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ErrorIndication.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ErrorIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EventType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_EventType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedActivityPeriod.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedActivityPeriod.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedHOInterval.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedHOInterval.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedIdlePeriod.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedIdlePeriod.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedUEActivityBehaviour.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedUEActivityBehaviour.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedUEBehaviour.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExpectedUEBehaviour.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Extended-UEIdentityIndexValue.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Extended-UEIdentityIndexValue.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExtendedRNC-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExtendedRNC-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExtendedRepetitionPeriod.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ExtendedRepetitionPeriod.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenInterRATs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenInterRATs.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenLACs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenLACs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenLAs-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenLAs-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenLAs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenLAs.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenTACs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenTACs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenTAs-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenTAs-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenTAs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ForbiddenTAs.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GBR-QosInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GBR-QosInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GERAN-Cell-ID.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GERAN-Cell-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GTP-TEID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GTP-TEID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEIList.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEIList.h (93%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEIType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GUMMEIType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GWContextReleaseIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_GWContextReleaseIndication.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Global-ENB-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Global-ENB-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFN.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFN.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFNModified.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFNModified.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFNforPDCP-SNlength18.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HFNforPDCP-SNlength18.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverCancel.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverCancel.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverCancelAcknowledge.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverCancelAcknowledge.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverCommand.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverCommand.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverFailure.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverNotify.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverNotify.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverPreparationFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverPreparationFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRequest.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRequestAcknowledge.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRequestAcknowledge.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRequired.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRequired.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRestrictionList.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverRestrictionList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_HandoverType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IMSI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IMSI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ImmediateMDT.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ImmediateMDT.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialContextSetupFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialContextSetupFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialContextSetupRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialContextSetupRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialContextSetupResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialContextSetupResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialUEMessage.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitialUEMessage.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitiatingMessage.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InitiatingMessage.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IntegrityProtectionAlgorithms.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IntegrityProtectionAlgorithms.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IntendedNumberOfPagingAttempts.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_IntendedNumberOfPagingAttempts.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Inter-SystemInformationTransferType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Inter-SystemInformationTransferType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InterfacesToTrace.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_InterfacesToTrace.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_KillAllWarningMessages.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_KillAllWarningMessages.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_KillRequest.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_KillRequest.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_KillResponse.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_KillResponse.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_L3-Information.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_L3-Information.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAC.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAC.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LAI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LHN-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LHN-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LPPa-PDU.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LPPa-PDU.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedCell-Item.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedCell-Item.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedEUTRANCellInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedEUTRANCellInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedGERANCellInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedGERANCellInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedUTRANCellInformation.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LastVisitedUTRANCellInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Links-to-log.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Links-to-log.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ListeningSubframePattern.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ListeningSubframePattern.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LocationReport.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LocationReport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LocationReportingControl.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LocationReportingControl.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LocationReportingFailureIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LocationReportingFailureIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggedMBSFNMDT.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggedMBSFNMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggedMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggedMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggingDuration.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggingDuration.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggingInterval.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_LoggingInterval.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M-TMSI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M-TMSI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M1PeriodicReporting.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M1PeriodicReporting.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M1ReportingTrigger.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M1ReportingTrigger.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M1ThresholdEventA2.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M1ThresholdEventA2.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M3Configuration.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M3Configuration.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M3period.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M3period.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M4Configuration.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M4Configuration.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M4period.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M4period.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M5Configuration.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M5Configuration.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M5period.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M5period.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M6Configuration.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M6Configuration.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M6delay-threshold.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M6delay-threshold.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M6report-Interval.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M6report-Interval.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M7Configuration.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M7Configuration.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M7period.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_M7period.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MBSFN-ResultToLog.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MBSFN-ResultToLog.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MBSFN-ResultToLogInfo.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MBSFN-ResultToLogInfo.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDT-Activation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDT-Activation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDT-Configuration.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDT-Configuration.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDT-Location-Info.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDT-Location-Info.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTMode-Extension.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTMode-Extension.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTMode.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTMode.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTPLMNList.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MDTPLMNList.h (93%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MME-Code.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MME-Code.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MME-Group-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MME-Group-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MME-UE-S1AP-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MME-UE-S1AP-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMECPRelocationIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMECPRelocationIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationUpdate.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationUpdate.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationUpdateAcknowledge.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationUpdateAcknowledge.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationUpdateFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEConfigurationUpdateFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEDirectInformationTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEDirectInformationTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEPagingTarget.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEPagingTarget.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMERelaySupportIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMERelaySupportIndicator.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEStatusTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEStatusTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEname.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MMEname.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MSClassmark2.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MSClassmark2.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MSClassmark3.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MSClassmark3.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ManagementBasedMDTAllowed.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ManagementBasedMDTAllowed.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Masked-IMEISV.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Masked-IMEISV.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MeasurementThresholdA2.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MeasurementThresholdA2.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MeasurementsToActivate.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MeasurementsToActivate.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MessageIdentifier.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MessageIdentifier.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MobilityInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MobilityInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MutingAvailabilityIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MutingAvailabilityIndication.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MutingPatternInformation.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_MutingPatternInformation.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NAS-PDU.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NAS-PDU.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASDeliveryIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASDeliveryIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASNonDeliveryIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASNonDeliveryIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASSecurityParametersfromE-UTRAN.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASSecurityParametersfromE-UTRAN.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASSecurityParameterstoE-UTRAN.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NASSecurityParameterstoE-UTRAN.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-DefaultPagingDRX.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-DefaultPagingDRX.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-Paging-eDRX-Cycle.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-Paging-eDRX-Cycle.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-Paging-eDRXInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-Paging-eDRXInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-PagingTimeWindow.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-PagingTimeWindow.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-UEIdentityIndexValue.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NB-IoT-UEIdentityIndexValue.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NextPagingAreaScope.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NextPagingAreaScope.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NumberOfBroadcasts.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NumberOfBroadcasts.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NumberofBroadcastRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_NumberofBroadcastRequest.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OldBSS-ToNewBSS-Information.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OldBSS-ToNewBSS-Information.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadAction.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadAction.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadStart.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadStart.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadStop.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_OverloadStop.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SN.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SN.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SNExtended.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SNExtended.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SNlength18.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PDCP-SNlength18.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PLMNidentity.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PLMNidentity.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PS-ServiceNotAvailable.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PS-ServiceNotAvailable.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PWSFailureIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PWSFailureIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PWSRestartIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PWSRestartIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PWSfailedECGIList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PWSfailedECGIList.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging-eDRX-Cycle.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging-eDRX-Cycle.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging-eDRXInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging-eDRXInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Paging.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingAttemptCount.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingAttemptCount.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingAttemptInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingAttemptInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingDRX.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingDRX.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingPriority.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingPriority.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingTimeWindow.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PagingTimeWindow.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PathSwitchRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PathSwitchRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PathSwitchRequestAcknowledge.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PathSwitchRequestAcknowledge.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PathSwitchRequestFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PathSwitchRequestFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PedestrianUE.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PedestrianUE.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Port-Number.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Port-Number.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Pre-emptionCapability.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Pre-emptionCapability.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Pre-emptionVulnerability.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Pre-emptionVulnerability.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Presence.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Presence.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PriorityLevel.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PriorityLevel.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivacyIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivacyIndicator.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateIE-Container.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateIE-Container.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateIE-Field.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateIE-Field.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateIE-ID.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateIE-ID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateMessage.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_PrivateMessage.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeAuthorized.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeAuthorized.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeDirectCommunication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeDirectCommunication.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeDirectDiscovery.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeDirectDiscovery.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeUEtoNetworkRelaying.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProSeUEtoNetworkRelaying.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProcedureCode.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProcedureCode.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolError-IE-ContainerList.h (89%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolExtensionContainer.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolExtensionContainer.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolExtensionField.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolExtensionField.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolExtensionID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolExtensionID.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-Container.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-Container.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ContainerList.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ContainerList.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ContainerPair.h (89%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ContainerPairList.h (89%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-Field.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-Field.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-FieldPair.h (88%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-ID.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-SingleContainer.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ProtocolIE-SingleContainer.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_QCI.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_QCI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RAC.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RAC.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RAT-Type.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RAT-Type.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RIMInformation.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RIMInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RIMRoutingAddress.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RIMRoutingAddress.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RIMTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RIMTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RLFReportInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RLFReportInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RNC-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RNC-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RRC-Container.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RRC-Container.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RRC-Establishment-Cause.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RRC-Establishment-Cause.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReceiveStatusofULPDCPSDUs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReceiveStatusofULPDCPSDUs.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedCellItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedCellItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedCellList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedCellList.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedCellsForPaging.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedCellsForPaging.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedENBItem.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedENBItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedENBList.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedENBList.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedENBsForPaging.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RecommendedENBsForPaging.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RelativeMMECapacity.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RelativeMMECapacity.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RelayNode-Indicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RelayNode-Indicator.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RepetitionPeriod.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RepetitionPeriod.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReportAmountMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReportAmountMDT.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReportArea.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReportArea.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReportIntervalMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ReportIntervalMDT.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RequestType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RequestType.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RerouteNASRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RerouteNASRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Reset.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Reset.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ResetAcknowledge.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ResetAcknowledge.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ResetAll.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ResetAll.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ResetType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ResetType.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RetrieveUEInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_RetrieveUEInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Routing-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Routing-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S-TMSI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S-TMSI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1AP-PDU.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1AP-PDU.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1SetupFailure.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1SetupFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1SetupRequest.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1SetupRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1SetupResponse.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_S1SetupResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONConfigurationTransfer.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONConfigurationTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformation-Extension.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformation-Extension.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformationReply.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformationReply.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformationReport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformationReport.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformationRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SONInformationRequest.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SRVCCHOIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SRVCCHOIndication.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SRVCCOperationNotPossible.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SRVCCOperationNotPossible.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SRVCCOperationPossible.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SRVCCOperationPossible.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SecurityContext.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SecurityContext.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SecurityKey.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SecurityKey.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SerialNumber.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SerialNumber.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedDCNs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedDCNs.h (93%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedDCNsItem.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedDCNsItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedGUMMEIs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedGUMMEIs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedGUMMEIsItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedGUMMEIsItem.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedGroupIDs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedGroupIDs.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedMMECs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedMMECs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedPLMNs.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_ServedPLMNs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Source-ToTarget-TransparentContainer.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Source-ToTarget-TransparentContainer.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceOfUEActivityBehaviourInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceOfUEActivityBehaviourInformation.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceeNB-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceeNB-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_StratumLevel.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_StratumLevel.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SubscriberProfileIDforRFP.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SubscriberProfileIDforRFP.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SuccessfulOutcome.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SuccessfulOutcome.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SupportedTAs-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SupportedTAs-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SupportedTAs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SupportedTAs.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SynchronisationInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SynchronisationInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SynchronisationStatus.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_SynchronisationStatus.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TABasedMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TABasedMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAC.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAC.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Broadcast-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Broadcast-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Broadcast.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Broadcast.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Cancelled-Item.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Cancelled-Item.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Cancelled.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI-Cancelled.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAI.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIBasedMDT.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIBasedMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIItem.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIItem.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIList.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIList.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIListForRestart.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIListForRestart.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIListforMDT.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIListforMDT.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIListforWarning.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAIListforWarning.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAListforMDT.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TAListforMDT.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TBCD-STRING.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TBCD-STRING.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Target-ToSource-TransparentContainer.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Target-ToSource-TransparentContainer.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetRNC-ID.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetRNC-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargeteNB-ID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargeteNB-ID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Threshold-RSRP.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Threshold-RSRP.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Threshold-RSRQ.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Threshold-RSRQ.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Time-UE-StayedInCell.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_Time-UE-StayedInCell.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TimeSynchronisationInfo.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TimeSynchronisationInfo.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TimeToWait.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TimeToWait.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceActivation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceActivation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceDepth.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceDepth.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceFailureIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceFailureIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceStart.c (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TraceStart.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TrafficLoadReductionIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TrafficLoadReductionIndication.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TransportInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TransportInformation.h (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TransportLayerAddress.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TransportLayerAddress.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TriggeringMessage.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TriggeringMessage.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TunnelInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TunnelInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TypeOfError.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_TypeOfError.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-HistoryInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-HistoryInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-HistoryInformationFromTheUE.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-HistoryInformationFromTheUE.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-RLF-Report-Container-for-extended-bands.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-RLF-Report-Container-for-extended-bands.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-RLF-Report-Container.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-RLF-Report-Container.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-RetentionInformation.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-RetentionInformation.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-S1AP-ID-pair.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-S1AP-ID-pair.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-S1AP-IDs.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-S1AP-IDs.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-Usage-Type.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-Usage-Type.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-associatedLogicalS1-ConnectionItem.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-associatedLogicalS1-ConnectionItem.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-associatedLogicalS1-ConnectionListRes.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-associatedLogicalS1-ConnectionListRes.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEAggregateMaximumBitrate.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEAggregateMaximumBitrate.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UECapabilityInfoIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UECapabilityInfoIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationConfirm.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationConfirm.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationIndication.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationIndication.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextModificationResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextReleaseCommand.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextReleaseCommand.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextReleaseComplete.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextReleaseComplete.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextReleaseRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextReleaseRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextResumeFailure.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextResumeFailure.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextResumeRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextResumeRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextResumeResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextResumeResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextSuspendRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextSuspendRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextSuspendResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEContextSuspendResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEIdentityIndexValue.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEIdentityIndexValue.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEInformationTransfer.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEInformationTransfer.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEPagingID.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEPagingID.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapability.c (94%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapability.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapabilityForPaging.c (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapabilityForPaging.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapabilityMatchRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapabilityMatchRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapabilityMatchResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UERadioCapabilityMatchResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UESecurityCapabilities.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UESecurityCapabilities.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UESidelinkAggregateMaximumBitrate.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UESidelinkAggregateMaximumBitrate.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEUserPlaneCIoTSupportIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UEUserPlaneCIoTSupportIndicator.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UL-CP-SecurityInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UL-CP-SecurityInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UL-NAS-Count.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UL-NAS-Count.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UL-NAS-MAC.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UL-NAS-MAC.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UnsuccessfulOutcome.c (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UnsuccessfulOutcome.h (99%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkNASTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkNASTransport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkNonUEAssociatedLPPaTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkNonUEAssociatedLPPaTransport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkS1cdma2000tunnelling.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkS1cdma2000tunnelling.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkUEAssociatedLPPaTransport.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UplinkUEAssociatedLPPaTransport.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UserLocationInformation.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_UserLocationInformation.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_V2XServicesAuthorized.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_V2XServicesAuthorized.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_VehicleUE.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_VehicleUE.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_VoiceSupportMatchIndicator.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_VoiceSupportMatchIndicator.h (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningAreaList.c (98%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningAreaList.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningMessageContents.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningMessageContents.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningSecurityInfo.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningSecurityInfo.h (96%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningType.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WarningType.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WriteReplaceWarningRequest.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WriteReplaceWarningRequest.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WriteReplaceWarningResponse.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_WriteReplaceWarningResponse.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_X2TNLConfigurationInfo.c (97%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_X2TNLConfigurationInfo.h (95%) rename lib/{s1ap/asn1c => asn1c/s1ap}/S1AP_asn_constant.h (100%) rename lib/{s1ap => asn1c}/s1ap_asn1c.h (99%) create mode 100644 lib/asn1c/s1ap_decoder.c create mode 100644 lib/asn1c/s1ap_encoder.c create mode 100644 lib/asn1c/s1ap_free.c create mode 100644 lib/asn1c/s1ap_message.h rename lib/{s1ap => asn1c}/support/README.md (70%) rename lib/{s1ap/support/r14.4.0 => asn1c/support/s1ap-r14.4.0}/36413-e40.asn (100%) rename lib/{s1ap/support/r14.4.0 => asn1c/support/s1ap-r14.4.0}/36413-e40.txt (100%) create mode 100644 lib/base/Makefile.am create mode 100644 lib/base/base.h create mode 100644 lib/base/context.c create mode 100644 lib/base/context.h rename lib/{core/src/3gpp_types.c => base/types.c} (57%) rename lib/{core/include/3gpp_types.h => base/types.h} (73%) delete mode 100644 lib/core/Makefile.am delete mode 100644 lib/core/include/arch/core_private_common.h delete mode 100644 lib/core/include/arch/unix/core_arch_file.h delete mode 100644 lib/core/include/arch/unix/core_arch_mutex.h delete mode 100644 lib/core/include/arch/unix/core_arch_network.h delete mode 100644 lib/core/include/arch/unix/core_arch_proc.h delete mode 100644 lib/core/include/arch/unix/core_arch_semaphore.h delete mode 100644 lib/core/include/arch/unix/core_arch_thread.h delete mode 100644 lib/core/include/core.h.in delete mode 100644 lib/core/include/core_aes.h delete mode 100644 lib/core/include/core_aes_cmac.h delete mode 100644 lib/core/include/core_atomic.h delete mode 100644 lib/core/include/core_cond.h delete mode 100644 lib/core/include/core_debug.h delete mode 100644 lib/core/include/core_errno.h delete mode 100644 lib/core/include/core_event.h delete mode 100644 lib/core/include/core_file.h delete mode 100644 lib/core/include/core_fsm.h delete mode 100644 lib/core/include/core_general.h delete mode 100644 lib/core/include/core_hash.h delete mode 100644 lib/core/include/core_index.h delete mode 100644 lib/core/include/core_lib.h delete mode 100644 lib/core/include/core_list.h delete mode 100644 lib/core/include/core_msgq.h delete mode 100644 lib/core/include/core_mutex.h delete mode 100644 lib/core/include/core_network.h delete mode 100644 lib/core/include/core_param.h delete mode 100644 lib/core/include/core_pkbuf.h delete mode 100644 lib/core/include/core_pool.h delete mode 100644 lib/core/include/core_portable.h delete mode 100644 lib/core/include/core_queue.h delete mode 100644 lib/core/include/core_ringbuf.h delete mode 100644 lib/core/include/core_rwlock.h delete mode 100644 lib/core/include/core_semaphore.h delete mode 100644 lib/core/include/core_sha1.h delete mode 100644 lib/core/include/core_sha1_hmac.h delete mode 100644 lib/core/include/core_sha2.h delete mode 100644 lib/core/include/core_sha2_hmac.h delete mode 100644 lib/core/include/core_signal.h delete mode 100644 lib/core/include/core_tcp.h delete mode 100644 lib/core/include/core_thread.h delete mode 100644 lib/core/include/core_time.h delete mode 100644 lib/core/include/core_timer.h delete mode 100644 lib/core/include/core_tlv.h delete mode 100644 lib/core/include/core_udp.h delete mode 100644 lib/core/include/core_version.h delete mode 100644 lib/core/src/Makefile.am delete mode 100644 lib/core/src/aes.c delete mode 100644 lib/core/src/aes_cmac.c delete mode 100644 lib/core/src/debug.c delete mode 100644 lib/core/src/event.c delete mode 100644 lib/core/src/fsm.c delete mode 100644 lib/core/src/hash.c delete mode 100644 lib/core/src/misc.c delete mode 100644 lib/core/src/msgq.c delete mode 100644 lib/core/src/ringbuf.c delete mode 100644 lib/core/src/sha1.c delete mode 100644 lib/core/src/sha1_hmac.c delete mode 100644 lib/core/src/sha2.c delete mode 100644 lib/core/src/sha2_hmac.c delete mode 100644 lib/core/src/timer.c delete mode 100644 lib/core/src/tlv.c delete mode 100644 lib/core/src/tlv_msg.c delete mode 100644 lib/core/src/unix/atomic.c delete mode 100644 lib/core/src/unix/cond.c delete mode 100644 lib/core/src/unix/errorcodes.c delete mode 100644 lib/core/src/unix/file.c delete mode 100644 lib/core/src/unix/mutex.c delete mode 100644 lib/core/src/unix/pkbuf.c delete mode 100644 lib/core/src/unix/rand.c delete mode 100644 lib/core/src/unix/rwlock.c delete mode 100644 lib/core/src/unix/sctp.c delete mode 100644 lib/core/src/unix/semaphore.c delete mode 100644 lib/core/src/unix/signal.c delete mode 100644 lib/core/src/unix/sockaddr.c delete mode 100644 lib/core/src/unix/socket.c delete mode 100644 lib/core/src/unix/start.c delete mode 100644 lib/core/src/unix/tcp.c delete mode 100644 lib/core/src/unix/thread.c delete mode 100644 lib/core/src/unix/time.c delete mode 100644 lib/core/src/unix/udp.c delete mode 100644 lib/core/src/version.c delete mode 100644 lib/core/test/Makefile.am delete mode 100644 lib/core/test/abts.c delete mode 100644 lib/core/test/abts.h delete mode 100644 lib/core/test/abts_tests.h delete mode 100644 lib/core/test/test3gpp.c delete mode 100644 lib/core/test/testaes.c delete mode 100644 lib/core/test/testatomic.c delete mode 100644 lib/core/test/testdir.c delete mode 100644 lib/core/test/testds.c delete mode 100644 lib/core/test/testfile.c delete mode 100644 lib/core/test/testfilecopy.c delete mode 100644 lib/core/test/testfsm.c delete mode 100644 lib/core/test/testhash.c delete mode 100644 lib/core/test/testlock.c delete mode 100644 lib/core/test/testmisc.c delete mode 100644 lib/core/test/testmsgq.c delete mode 100644 lib/core/test/testnetlib.c delete mode 100644 lib/core/test/testpkbuf.c delete mode 100644 lib/core/test/testsctp.c delete mode 100644 lib/core/test/testsha.c delete mode 100644 lib/core/test/testsleep.c delete mode 100644 lib/core/test/testsock.c delete mode 100644 lib/core/test/testthread.c delete mode 100644 lib/core/test/testtime.c delete mode 100644 lib/core/test/testtimer.c delete mode 100644 lib/core/test/testtlv.c delete mode 100644 lib/core/test/testutil.c delete mode 100644 lib/core/test/testutil.h delete mode 100644 lib/freeDiameter-1.2.1/contrib/OpenWRT/packages/freeDiameter/Makefile delete mode 100644 lib/freeDiameter-1.2.1/contrib/OpenWRT/test_required/Makefile delete mode 100644 lib/freeDiameter-1.2.1/contrib/PKI/ca_script/Makefile delete mode 100644 lib/freeDiameter-1.2.1/contrib/PKI/ca_script2/Makefile delete mode 100644 lib/freeDiameter-1.2.1/contrib/app_acct_tools/app_acct.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/alldefault.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allext.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdbg.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdeb.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allextmax.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allextprof.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allextrel.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/allextval.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/idnaignore.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/idnareject.conf delete mode 100644 lib/freeDiameter-1.2.1/contrib/nightly_tests/nosctp.conf delete mode 100644 lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-1.conf delete mode 100644 lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-2.conf delete mode 100644 lib/freeDiameter-1.2.1/doc/single_host/test_app1.conf delete mode 100644 lib/freeDiameter-1.2.1/doc/single_host/test_app2.conf create mode 100644 lib/gtp/gtp_tlv.c rename lib/{core/include/core_tlv_msg.h => gtp/gtp_tlv.h} (60%) delete mode 100644 lib/s1ap/Makefile.am delete mode 100644 lib/s1ap/asn1c/Makefile.am delete mode 100644 lib/s1ap/s1ap_decoder.c delete mode 100644 lib/s1ap/s1ap_encoder.c delete mode 100644 lib/s1ap/s1ap_free.c delete mode 100644 lib/s1ap/s1ap_message.h create mode 100644 m4/ax_check_compile_flag.m4 create mode 100644 m4/ax_recursive_eval.m4 rename src/{common => app}/Makefile.am (55%) create mode 100644 src/app/application.c create mode 100644 src/app/application.h create mode 100644 src/app/context.c create mode 100644 src/app/context.h rename src/{common/yaml_helper.c => app/ogs-yaml.c} (52%) create mode 100644 src/app/ogs-yaml.h delete mode 100644 src/common/application.c delete mode 100644 src/common/application.h delete mode 100644 src/common/context.c delete mode 100644 src/common/context.h delete mode 100644 src/common/yaml_helper.h create mode 100644 src/mme/ogs-sctp.c create mode 100644 src/mme/ogs-sctp.h create mode 100644 src/mme/s1ap_lksctp.c delete mode 100644 src/mme/s1ap_sctp.c rename lib/core/src/unix/tun.c => src/pgw/ogs-tun.c (60%) create mode 100644 src/pgw/ogs-tun.h delete mode 100644 test/basic/s1setup_test.c delete mode 100644 test/basic/testutil.c delete mode 100644 test/common/abts.c delete mode 100644 test/common/abts.h delete mode 100644 test/common/testutil.h create mode 100644 test/complex/abts-main.c rename test/{basic => complex}/attach_test.c (59%) rename test/{basic => complex}/handover_test.c (51%) create mode 100644 test/complex/s1setup_test.c rename test/{basic => complex}/volte_test.c (63%) create mode 100644 test/sample-simple.conf.in create mode 100644 test/simple/abts-main.c create mode 100644 test/simple/mnc3-test.c create mode 100644 test/unit/abts-main.c rename test/{basic => unit}/gtp_message_test.c (89%) rename test/{basic => unit}/nas_message_test.c (79%) rename test/{basic => unit}/s1ap_message_test.c (70%) create mode 100644 test/unit/sctp-test.c rename test/{basic => unit}/security_test.c (55%) create mode 100644 test/volte/abts-main.c delete mode 100644 test/volte/testutil.c diff --git a/.gitignore b/.gitignore index 45da84674..6ae700ee2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,30 +9,40 @@ .libs # generated files +lib/freeDiameter-*/build-aux/* +lib/freeDiameter-*/config.status +lib/freeDiameter-*/m4/*.m4 +lib/freeDiameter-*/!m4/ax_*.m4 lib/freeDiameter-*/libfdcore/fdd.tab.[chy] lib/freeDiameter-*/libfdcore/lex.fdd.[cl] lib/freeDiameter-*/include/freeDiameter/version.h -lib/freeDiameter-*/include/freeDiameter/config.h.in +lib/freeDiameter-*/include/freeDiameter/config.h.in* +lib/freeDiameter-*/include/freeDiameter/config.h lib/freeDiameter-*/include/freeDiameter/freeDiameter-host.h -lib/core/include/core.h support/systemd/nextepc-*.service support/logrotate/nextepc # autotools stamp-h1 config.h -config.in -config.nice +lib/base/nextepc-config.h +lib/base/nextepc-config.h.in* config.log +config.status configure aclocal.m4 -config.status libtool autom4te.cache -build-aux +build/* +!build/git-version-gen +!build/osc-upload.sh Makefile Makefile.in -m4 +m4/*.m4 +!m4/ax_*.m4 + +.tarball-version +.version # autotest test/package.m4 @@ -42,9 +52,10 @@ test/testsuite.dir/ test/testsuite.log # executables -lib/core/test/testcore -test/testvolte +test/testunit test/testepc +test/testvolte +test/testadvanced nextepc-mmed nextepc-pcrfd nextepc-pgwd @@ -52,21 +63,6 @@ nextepc-sgwd nextepc-epcd nextepc-hssd -# debian -debian/*.debhelper.log -debian/*.debhelper -debian/*.substvars -debian/tmp -debian/files -debian/autoreconf.before -debian/autoreconf.after -debian/nextepc-core -debian/nextepc-mme -debian/nextepc-sgw -debian/nextepc-pgw -debian/nextepc-pcrf -debian/nextepc-hss - # webui webui/.next/ webui/node_modules/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..b8c29f21b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/ogslib"] + path = lib/ogslib + url = https://github.com/open5gs/ogslib diff --git a/Makefile.am b/Makefile.am index 0bcac5c9f..87f7b9d7c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,22 @@ -## Process this file with automake to produce Makefile.in +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = build/git-version-gen .version README.md LICENSE SUBDIRS = lib src support test @@ -25,7 +41,8 @@ dist_nextepc_epcd_SOURCES = main.c nextepc_epcd_LDADD = $(top_srcdir)/src/libepc.la AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ $(NULL) @@ -38,14 +55,8 @@ install-data-hook: $(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-hssd $(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-epcd -CLEANFILES = -R data debian/test -DISTCLEANFILES = $(DIST_ARCHIVES) -MAINTAINERCLEANFILES = \ - configure config.in \ - aclocal.m4 m4/ltsugar.m4 m4/libtool.m4 m4/ltversion.m4 \ - m4/lt~obsolete.m4 m4/ltoptions.m4 \ - build-aux/ar-lib build-aux/config.guess build-aux/depcomp \ - build-aux/ltmain.sh build-aux/test-driver build-aux/compile \ - build-aux/config.sub build-aux/missing build-aux/install-sh \ - Makefile.in -MOSTLYCLEANFILES = core *.stackdump +BUILT_SOURCES = $(top_srcdir)/.version +$(top_srcdir)/.version: + echo $(VERSION) > $@-t && mv $@-t $@ +dist-hook: + echo $(VERSION) > $(distdir)/.tarball-version diff --git a/README.md b/README.md index 56ac0a97f..f96267f10 100644 --- a/README.md +++ b/README.md @@ -1,97 +1,26 @@ -What's NextEPC -================ - -NextEPC is a C-language Open Source implementation of the 3GPP Evolved Packet Core, i.e. the core network of an LTE network. - -NextEPC provides the MME (Mobility Management Engine), which terminates the S1 interfaces from the eNodeBs cells in the cellular network, and interfaces via S11 to the SGW as well as via S6a to the HSS. - -NextEPC provides the SGW (Serving Gateway) which is situated between the MME and PGW. It implements the S11 interface to the MME, and the S5 interface to the PGW. - -NextEPC provides the PGW or PDN-GW (Packet Data Network Gateway) element of the EPC, i.e. the gateway between the EPC and the external packet data network, such as the public Internet. It implements the S5 interface towards the S-GW, the SGi interface towards the Internet, and the S7 interface towards the PCRF. - -NextEPC provides the HSS (Home Subscriber Server) element of the EPC, i.e. the central database of mobile network subscribers, with their IMSI, MSISDN, cryptographic key materials, service subscription information, etc. It implements the S6a interface towards the MME using the DIAMETER protocol. - -NextEPC contains the PCRF (Policy and Charging Rules Function), which controls the service quality (QoS) of individual connections and how to account/charge related traffic. It implements the Gx interface towards the PGW using the DIAMETER protocol. - -Installation -============ - -* ### MME, SGW, PGW, HSS, and PCRF - -The NextEPC package is available on the recent versions of Ubuntu. - -```bash -sudo add-apt-repository ppa:acetcom/nextepc -sudo apt-get update -sudo apt-get -y install nextepc -``` -This will create a virtual network interface named as *pgwtun*. It is automatically removed by uninstalling NextEPC. - -```markdown -ifconfig pgwtun -pgwtun Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:45.45.0.1 P-t-P:45.45.0.1 Mask:255.255.0.0 - inet6 addr: fe80::50f6:182c:5aa3:16bb/64 Scope:Link - inet6 addr: cafe::1/64 Scope:Global - ... -``` - -The NextEPC service is registered in `systemd` environment, and is started automatically during the installation phase. The service names are *nextepc-mmed*, *nextepc-sgwd*, *nextepc-pgwd*, *nextepc-hssd*, and *nextepc-pcrfd*. You can use the `systemctl` command to control specific services. - -```bash -sudo systemctl status nextepc-mmed (Check the service status) -sudo systemctl stop nextepc-mmed (Stop the service) -sudo systemctl disable nextepc-mmed (Will not be started after rebooting) -sudo systemctl enable nextepc-mmed (Will be started after rebooting) -sudo systemctl start nextepc-mmed (Start the service) -sudo systemctl restart nextepc-mmed (Stop and start) -``` - - -* ### Web User Interface - -```bash -sudo apt-get -y install curl -curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - -curl -sL http://nextepc.org/static/webui/install | sudo -E bash - -``` - -The service name is *nextepc-webui*, and it will be running on _http://localhost:3000_. - -```bash -sudo systemctl start nextepc-webui -``` - - -* ### Uninstall NextEPC - -```bash -curl -sL http://nextepc.org/static/webui/uninstall | sudo -E bash - -sudo apt-get purge nextepc* -``` - -You may need to remove manually /var/log/nextepc unless it is empty. -```bash -sudo rm -Rf /var/log/nextepc -``` - - ## Documentation -If you don't understand something about NextEPC, the [http://nextepc.org](http://nextepc.org/) is a great place to look for answers. - +If you don't understand something about NextEPC, the [https://open5gs.org/nextepc/docs/](https://open5gs.org/nextepc/docs/) is a great place to look for answers. ## Support -Problem with NextEPC can be filed as [issues](https://github.com/acetcom/nextepc/issues) in this repository. And also, we've created *Discord* workspace for _nextepc_. Use [this link](https://discord.gg/GreNkuc) to get started. +Problem with NextEPC can be filed as [issues](https://github.com/open5gs/nextepc/issues) in this repository. +Discussions related to this project are happening on the [nextepc@lists.osmocom.org](mailto:nextepc@lists.osmocom.org) mailing list, please see for subscription options and the list archive. -## Mailing List +Voice and text chat available in NextEPC's [Discord](https://discordapp.com/) workspace. Use [this link](https://discord.gg/GreNkuc) to get started. -Discussions related to this project are happening on the nextepc@lists.osmocom.org mailing list, please see for subscription options and the list archive. +## Contributing +NextEPC is a pure/classic FOSS project, open to contributions from anyone. + +[Pull requests](https://github.com/open5gs/nextepc/pulls) are always welcome, and I appreciates any help the community can give to help make NextEPC better. + +Do you want to be a committer? Please [send me an email](mailto:acetcom@gmail.com). You will be added as a committer to this project. However, if someone consistently causes difficulties with these source repositories due to poor behavior or other serious problems then commit access may be revoked. ## License -NextEPC source files are made available under the terms of the GNU Affero General Public License (GNU AGPLv3). See [this link](http://nextepc.org/docs/nextepc/4-license/) for details. +NextEPC source files are made available under the terms of the GNU Affero General Public License (GNU AGPLv3). + +When you contribute code for NextEPC, the same license applies. diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 5cbf496f9..000000000 --- a/acinclude.m4 +++ /dev/null @@ -1,108 +0,0 @@ -dnl -dnl CORE_SUBST(varname) -dnl -dnl Adds variable with it's value into Makefile, e.g.: -dnl CC = gcc -dnl -AC_DEFUN([CORE_SUBST],[ - CORE_VAR_SUBST="$CORE_VAR_SUBST $1" -]) - -dnl -dnl CORE_SUBST_OLD(varname) -dnl -dnl Same as CORE_SUBST() but also substitutes all @VARNAME@ -dnl instances in every file passed to AC_OUTPUT() -dnl -AC_DEFUN([CORE_SUBST_OLD],[ - CORE_SUBST($1) - AC_SUBST($1) -]) - -dnl -dnl CORE_CONFIG_NICE(filename) -dnl -dnl Generates the config.nice file -dnl -AC_DEFUN([CORE_CONFIG_NICE],[ - AC_REQUIRE([AC_PROG_EGREP]) - AC_REQUIRE([LT_AC_PROG_SED]) - CORE_SUBST_OLD(EGREP) - CORE_SUBST_OLD(SED) - test -f $1 && mv $1 $1.old - rm -f $1.old - cat >$1<> $1 - fi - done - - echo "'[$]0' \\" >> $1 - if test `expr -- [$]0 : "'.*"` = 0; then - CONFIGURE_COMMAND="$CONFIGURE_COMMAND '[$]0'" - else - CONFIGURE_COMMAND="$CONFIGURE_COMMAND [$]0" - fi - for arg in $ac_configure_args; do - if test `expr -- $arg : "'.*"` = 0; then - if test `expr -- $arg : "--.*"` = 0; then - break; - fi - echo "'[$]arg' \\" >> $1 - CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS '[$]arg'" - else - if test `expr -- $arg : "'--.*"` = 0; then - break; - fi - echo "[$]arg \\" >> $1 - CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS [$]arg" - fi - done - echo '"[$]@"' >> $1 - chmod +x $1 - CONFIGURE_COMMAND="$CONFIGURE_COMMAND $CONFIGURE_OPTIONS" - CORE_SUBST_OLD(CONFIGURE_COMMAND) - CORE_SUBST_OLD(CONFIGURE_OPTIONS) -]) - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS - -# adl_RECURSIVE_EVAL(VALUE, RESULT) -# ================================= -# Interpolate the VALUE in loop until it doesn't change, -# and set the result to $RESULT. -# WARNING: It's easy to get an infinite loop with some unsane input. -# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and -# finally ${prefix} is replaced by the prefix. -AC_DEFUN([adl_RECURSIVE_EVAL], -[_lcl_receval="$1" -$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" - _lcl_receval_old='' - while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do - _lcl_receval_old="[$]_lcl_receval" - eval _lcl_receval="\"[$]_lcl_receval\"" - done - echo "[$]_lcl_receval")`]) diff --git a/build/git-version-gen b/build/git-version-gen new file mode 100755 index 000000000..0e254f4be --- /dev/null +++ b/build/git-version-gen @@ -0,0 +1,227 @@ +#!/bin/sh +# Print a version string. +scriptversion=2017-09-13.06; # UTC + +# Copyright (C) 2007-2017 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# As with any generated file in a VC'd directory, you should add +# /.version to .gitignore, so that you don't accidentally commit it. +# .tarball-version is never generated in a VC'd directory, so needn't +# be listed there. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project@example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .version and +# .tarball-version will exist in distribution tarballs. +# +# EXTRA_DIST = $(top_srcdir)/.version +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + + +me=$0 + +version="git-version-gen $scriptversion + +Copyright 2011 Free Software Foundation, Inc. +There is NO warranty. You may redistribute this software +under the terms of the GNU General Public License. +For more information about these matters, see the files named COPYING." + +usage="\ +Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] +Print a version string. + +Options: + + --prefix PREFIX prefix of git tags (default 'v') + --fallback VERSION + fallback version to use if \"git --version\" fails + + --help display this help and exit + --version output version information and exit + +Running without arguments will suffice in most cases." + +prefix=v +fallback= + +while test $# -gt 0; do + case $1 in + --help) echo "$usage"; exit 0;; + --version) echo "$version"; exit 0;; + --prefix) shift; prefix=${1?};; + --fallback) shift; fallback=${1?};; + -*) + echo "$0: Unknown option '$1'." >&2 + echo "$0: Try '--help' for more information." >&2 + exit 1;; + *) + if test "x$tarball_version_file" = x; then + tarball_version_file="$1" + elif test "x$tag_sed_script" = x; then + tag_sed_script="$1" + else + echo "$0: extra non-option argument '$1'." >&2 + exit 1 + fi;; + esac + shift +done + +if test "x$tarball_version_file" = x; then + echo "$usage" + exit 1 +fi + +tag_sed_script="${tag_sed_script:-s/x/x/}" + +nl=' +' + +# Avoid meddling by environment variable of the same name. +v= +v_from_git= + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || v= + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test "x$v" = x \ + && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2 +fi + +if test "x$v" != x +then + : # use $v +# Otherwise, if there is at least one git commit involving the working +# directory, and "git describe" output looks sensible, use that to +# derive a version string. +elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ + && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ + || git describe --abbrev=4 HEAD 2>/dev/null` \ + && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ + && case $v in + $prefix[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v + case $vprefix in + *-*) : git describe is probably okay three part flavor ;; + *) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \ + || { commit_list=failed; + echo "$0: WARNING: git rev-list failed" 1>&2; } + numcommits=`echo "$commit_list" | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + test "$commit_list" = failed && v=UNKNOWN + ;; + esac + + # Change the penultimate "-" to ".", for version-comparing tools. + # Remove the "g" to save a byte. + v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`; + v_from_git=1 +elif test "x$fallback" = x || git --version >/dev/null 2>&1; then + v=UNKNOWN +else + v=$fallback +fi + +v=`echo "$v" |sed "s/^$prefix//"` + +# Test whether to append the "-dirty" suffix only if the version +# string we're using came from git. I.e., skip the test if it's "UNKNOWN" +# or if it came from .tarball-version. +if test "x$v_from_git" != x; then + # Don't declare a version "dirty" merely because a timestamp has changed. + git update-index --refresh > /dev/null 2>&1 + + dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= + case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; + esac +fi + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +printf %s "$v" + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/build/osc-upload.sh b/build/osc-upload.sh new file mode 100755 index 000000000..222fde8f2 --- /dev/null +++ b/build/osc-upload.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +for arg in "$@"; do + if [ "$arg" = "-h" ]; then + echo "Usage: ./build/osc-upload.sh [PROJECT]" + echo "" + echo " PROJECT: snapshot(=Default), release" + echo "" + echo " This script is used to upload a source package to OBS(OpenSUSE Build Service)." + echo "" + echo " This script must be called from the base directory of the repository, and" + echo " requires utilites from these packages: git-buildpackage osc git" + echo "" + exit + fi +done + +if [ ! -x /usr/bin/dpkg-parsechangelog ]; then + echo "Missing the dpkg-parsechangelog utility from the dpkg-dev package" + exit 1 +fi + +if [ ! -f debian/changelog ]; then + echo "This script must be called from the base directory of the package" + exit 1 +fi + +if [ ! -d .git ]; then + echo "This script only works from within a repository" + exit 1 +fi + +if [ ! -x /usr/bin/gbp ]; then + echo "Missing git-buildpackage" + exit 1 +fi + +PACKAGE=$(dpkg-parsechangelog | sed -n 's/^Source: //p') +DT="$(date +%Y%m%d)+git$(git rev-parse --short HEAD)" +TOP=$(pwd) + +OGS_REPO=$TOP/build/obs-repo +PROJECT=home:acetcom:open5gs:${1-snapshot} +OBS_DIR=$OGS_REPO/$PROJECT/$PACKAGE + +prepare() { + if [ -d $OBS_DIR ]; then + (cd $OBS_DIR && osc up) + else + mkdir -p $OGS_REPO + (cd $OGS_REPO && osc co $PROJECT $PACKAGE) + fi +} + +DEB_SRC=$TOP/build/deb-src +DEB_DIR=$DEB_SRC/$PACKAGE + +build_package() { + if [ ! -d $DEB_DIR ]; then + mkdir -p $DEB_DIR + fi + + ./build/git-version-gen . > .tarball-version 2>/dev/null + gbp buildpackage -S --no-sign -d \ + --git-ignore-branch --git-ignore-new "--git-export-dir=$DEB_DIR" \ + --git-postexport='cp $GBP_GIT_DIR/../.tarball-version $GBP_TMP_DIR/' + rm -f .tarball-version + + cd $OBS_DIR + + file=$(cd "$DEB_DIR/" ; ls ./*.dsc) + echo $file + if [ -e "$file" ] ; then + osc rm ./* || true + fi + + mv "$DEB_DIR/"*.dsc . + mv "$DEB_DIR/"*.tar* . + osc add ./* + + rm "$DEB_DIR/"* + rmdir "$DEB_DIR/" + rmdir "$DEB_SRC/" + + cd $TOP +} + +prepare +build_package + +(cd $OBS_DIR && osc ci -m "Snapshot versions of $DT") diff --git a/configure.ac b/configure.ac index 70022a77f..9ba5e84bd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,48 +1,51 @@ -dnl Process this file with autoconf to produce a configure script. -dnl -dnl This file is free software; as a special exception the author gives -dnl unlimited permission to copy and/or distribute it, with or without -dnl modifications, as long as this notice is preserved. -dnl -dnl This program is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. -AC_INIT([NextEPC], [0.3.10], [acetcom@gmail.com]) +# Copyright (C) 2019 by Sukchan Lee -AC_SUBST(LIBVERSION) -LIBVERSION=1:0:0 +# This file is part of Open5GS. -CORE_CONFIG_NICE(config.nice) +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -dnl Must come before AM_INIT_AUTOMAKE. -AC_CONFIG_AUX_DIR([build-aux]) +AC_INIT([NextEPC], + m4_esyscmd([build/git-version-gen .tarball-version]), + [acetcom@gmail.com]) + +AC_CONFIG_AUX_DIR([build]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_TESTDIR(test) -AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects]) - -# Where to generate output; srcdir location. -AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS. -AC_CONFIG_SRCDIR([main.c]) AC_CANONICAL_HOST +AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_CONFIG_HEADERS([lib/base/nextepc-config.h]) +AC_CONFIG_SRCDIR([main.c]) + LO_DEV="lo0" case $host in *linux*) - OSDIR="unix" OSCPPFLAGS="-DLINUX=1" IPFW_CPPFLAGS="-DNEED_SYSCTLBYNAME -DNEED_SIN_LEN" LO_DEV="lo" ;; *-apple-darwin*) - OSDIR="unix" OSCPPFLAGS="-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK" ;; *) - OSDIR="unix" ;; esac AC_SUBST(OSCPPFLAGS) -AC_SUBST(OSDIR) AC_SUBST(IPFW_CPPFLAGS) AC_SUBST(LO_DEV) @@ -67,9 +70,6 @@ AH_VERBATIM([_REENTRANT], #endif ]) -dnl kernel style compile messages -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - dnl Checks CC and freinds AC_PROG_MAKE_SET AC_PROG_MKDIR_P @@ -77,7 +77,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_INSTALL AM_PROG_AR -LT_INIT([pic-only disable-static]) +LT_INIT AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test "x$PKG_CONFIG" = "xno"; then @@ -88,172 +88,56 @@ PKG_PROG_PKG_CONFIG([0.20]) dnl Checks for compile flag AX_CHECK_COMPILE_FLAG([-Wno-unused-result], [CFLAGS="$CFLAGS -Wno-unused-result"]) -dnl Checks for pointer size -AC_CHECK_SIZEOF(void*, 4) - -dnl Checks for integer size -AC_CHECK_SIZEOF(char, 1) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(long long, 8) - -if test "$ac_cv_sizeof_short" = "2"; then - short_value=short -fi -if test "$ac_cv_sizeof_int" = "4"; then - int_value=int -fi -# Now we need to find what c_int64_t (sizeof == 8) will be. -# The first match is our preference. -if test "$ac_cv_sizeof_int" = "8"; then - int64_literal='#define C_INT64_C(val) (val)' - uint64_literal='#define C_UINT64_C(val) (val##U)' - int64_t_fmt='#define C_INT64_T_FMT "d"' - uint64_t_fmt='#define C_UINT64_T_FMT "u"' - uint64_t_hex_fmt='#define C_UINT64_T_HEX_FMT "x"' - int64_value="int" - long_value=int - int64_strfn="strtoi" -elif test "$ac_cv_sizeof_long" = "8"; then - int64_literal='#define C_INT64_C(val) (val##L)' - uint64_literal='#define C_UINT64_C(val) (val##UL)' - int64_t_fmt='#define C_INT64_T_FMT "ld"' - uint64_t_fmt='#define C_UINT64_T_FMT "lu"' - uint64_t_hex_fmt='#define C_UINT64_T_HEX_FMT "lx"' - int64_value="long" - long_value=long - int64_strfn="strtol" -elif test "$ac_cv_sizeof_long_long" = "8"; then - int64_literal='#define C_INT64_C(val) (val##LL)' - uint64_literal='#define C_UINT64_C(val) (val##ULL)' - # Linux, Solaris, FreeBSD all support ll with printf. - # BSD 4.4 originated 'q'. Solaris is more popular and - # doesn't support 'q'. Solaris wins. Exceptions can - # go to the OS-dependent section. - int64_t_fmt='#define C_INT64_T_FMT "lld"' - uint64_t_fmt='#define C_UINT64_T_FMT "llu"' - uint64_t_hex_fmt='#define C_UINT64_T_HEX_FMT "llx"' - int64_value="long long" - long_value="long long" - int64_strfn="strtoll" -elif test "$ac_cv_sizeof_longlong" = "8"; then - int64_literal='#define C_INT64_C(val) (val##LL)' - uint64_literal='#define C_UINT64_C(val) (val##ULL)' - int64_t_fmt='#define C_INT64_T_FMT "qd"' - uint64_t_fmt='#define C_UINT64_T_FMT "qu"' - uint64_t_hex_fmt='#define C_UINT64_T_HEX_FMT "qx"' - int64_value="__int64" - long_value="__int64" - int64_strfn="strtoll" -else - # int64_literal may be overriden if your compiler thinks you have - # a 64-bit value but CORE does not agree. - AC_ERROR([could not detect a 64-bit integer type]) -fi - -AC_SUBST(short_value) -AC_SUBST(int_value) -AC_SUBST(long_value) -AC_SUBST(int64_value) -AC_SUBST(int64_t_fmt) -AC_SUBST(uint64_t_fmt) -AC_SUBST(uint64_t_hex_fmt) -AC_SUBST(int64_literal) -AC_SUBST(uint64_literal) - -AC_CHECK_SIZEOF(pid_t, 8) - -if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then - pid_t_fmt='#define C_PID_T_FMT "hd"' -elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then - pid_t_fmt='#define C_PID_T_FMT "d"' -elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then - pid_t_fmt='#define C_PID_T_FMT "ld"' -elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then - pid_t_fmt='#define C_PID_T_FMT APR_INT64_T_FMT' -else - pid_t_fmt='#error Can not determine the proper size for pid_t' -fi - -case $host in - *-solaris*) - if test "$ac_cv_sizeof_long" = "8"; then - pid_t_fmt='#define C_PID_T_FMT "d"' - else - pid_t_fmt='#define C_PID_T_FMT "ld"' - fi - ;; -esac - -AC_SUBST(pid_t_fmt) - -AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], - [`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\1/'`], - [Major version of this package]) -AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], - [`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\2/'`], - [Minor version of this package]) -AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], - [`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\3/'`], - [Patch version of this package]) - ################################## #### Checks for Directories. ##### ################################## -adl_RECURSIVE_EVAL(["${bindir}"], [BIN_DIR]) -adl_RECURSIVE_EVAL(["${libdir}"], [LIB_DIR]) -adl_RECURSIVE_EVAL(["${sysconfdir}"], [SYSCONF_DIR]) -adl_RECURSIVE_EVAL(["${localstatedir}"], [LOCALSTATE_DIR]) +AX_RECURSIVE_EVAL(["${bindir}"], [BIN_DIR]) +AX_RECURSIVE_EVAL(["${libdir}"], [LIB_DIR]) +AX_RECURSIVE_EVAL(["${sysconfdir}"], [SYSCONF_DIR]) +AX_RECURSIVE_EVAL(["${localstatedir}"], [LOCALSTATE_DIR]) AC_SUBST(BIN_DIR) AC_SUBST(LIB_DIR) AC_SUBST(SYSCONF_DIR) AC_SUBST(LOCALSTATE_DIR) -################################## -#### Checks for header files. #### -################################## +####################################### +#### Checks for library functions. #### +####################################### + +AC_SEARCH_LIBS(gethostbyname, nsl) +AC_SEARCH_LIBS(gethostname, nsl) +AC_SEARCH_LIBS(socket, socket) +AC_SEARCH_LIBS(pthread_barrier_wait, pthread) +AC_SEARCH_LIBS(gnutls_global_set_log_level, gnutls) + +AC_CHECK_FILE([lib/ogslib/configure.ac], [have_srclib=yes], [have_srclib=no]) +if test x$have_srclib == xyes; then + AC_CONFIG_SUBDIRS([lib/ogslib]) + AC_SUBST(OGSCORE_CFLAGS, '-I$(top_srcdir)/lib/ogslib/src') + AC_SUBST(OGSCORE_LIBS, '$(top_srcdir)/lib/ogslib/src/core/libogscore-1.0.la') + AC_SUBST(OGSCRYPT_CFLAGS, '-I$(top_srcdir)/lib/ogslib/src') + AC_SUBST(OGSCRYPT_LIBS, '$(top_srcdir)/lib/ogslib/src/crypt/libogscrypt-1.0.la') +else + PKG_CHECK_MODULES(OGSCORE, ogscore-1.0 >= 1.0.0) + PKG_CHECK_MODULES(OGSCRYPT, ogscrypt-1.0 >= 1.0.0) +fi +AM_CONDITIONAL([WITH_SRCLIB], [test x$have_srclib = xyes]) + +AC_SEARCH_LIBS([sctp_sendmsg], [sctp], [have_sctp=yes], [have_sctp=no]) +if test x$have_sctp == xno; then + AC_SEARCH_LIBS([usrsctp_init], [usrsctp], [have_usrsctp=yes], [have_usrsctp=no]) + if test x$have_usrsctp == xno; then + AC_MSG_ERROR([You must install the SCTP libraries and development headers to enable SCTP support.]) + else + AC_DEFINE(HAVE_USRSCTP, 1, + [Define if your system supports the usrsctp system calls]) + fi +fi +AM_CONDITIONAL([WITH_USRSCTP], [test x$have_usrsctp = xyes]) -AC_HEADER_STDC AC_CHECK_HEADERS( \ - arpa/inet.h \ - ctype.h \ - errno.h \ - fcntl.h \ - ifaddrs.h \ - limits.h \ - netdb.h \ - pthread.h \ - regex.h \ - semaphore.h \ - signal.h \ - stdarg.h \ - stdio.h \ - stdint.h \ - stdlib.h \ - string.h \ - strings.h \ - time.h \ - unistd.h \ - net/if_dl.h \ - net/if.h \ - netinet/ether.h \ - netinet/in.h \ - netinet/in_systm.h \ - netinet/udp.h \ - netinet/tcp.h \ netinet/sctp.h \ - usrsctp.h \ - sys/ioctl.h \ - sys/param.h \ - sys/socket.h \ - sys/stat.h \ - sys/syslimits.h \ - sys/types.h \ - sys/time.h \ - sys/wait.h \ - sys/uio.h \ ) AC_CHECK_HEADERS(netinet/ip.h netinet/ip6.h net/route.h,,,[[ @@ -279,134 +163,6 @@ AC_CHECK_HEADERS(netinet/ip_icmp.h netinet/icmp6.h,,,[[ #include ]]) -########################################## -#### Checks for typedefs, structures, #### -#### and compiler characteristics. #### -########################################## - -AC_C_BIGENDIAN - -AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[ -#include -#include ]) - -AC_CHECK_MEMBER(struct sockaddr.sa_len, - AC_DEFINE(HAVE_SA_LEN, 1, [Define this if your stack has sa_len in sockaddr struct.]),, - [#ifdef HAVE_SYS_TYPES_H - #include - #endif - #include ]) - -AC_CHECK_MEMBER(struct sockaddr_in.sin_len, - AC_DEFINE(HAVE_SIN_LEN, 1, [Define this if your IPv4 has sin_len in sockaddr_in struct.]),, - [#ifdef HAVE_SYS_TYPES_H - #include - #endif - #include ]) - -AC_CHECK_MEMBER(struct sockaddr_in6.sin6_len, - AC_DEFINE(HAVE_SIN6_LEN, 1, [Define this if your IPv6 has sin6_len in sockaddr_in6 struct.]),, - [#ifdef HAVE_SYS_TYPES_H - #include - #endif - #include ]) - -AC_CHECK_MEMBER(struct sockaddr_conn.sconn_len, - AC_DEFINE(HAVE_SCONN_LEN, 1, [Define this if your userland stack has sconn_len in sockaddr_conn struct.]),, - [#include "usrsctplib/usrsctp.h"]) - -AC_MSG_CHECKING(for socklen_t) -AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H - #include - #endif - #include ], - [socklen_t x; x = 1; return ((int)x);], - [AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(int) - AC_DEFINE(socklen_t, int, [Define a type for socklen_t.])]) - -AC_CHECK_FILE(/dev/random, - AC_DEFINE([HAVE_DEV_RANDOM], [1], - [Define to 1 if you have the /dev/random file.])) - -AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins], -[AC_TRY_RUN([ -int main() -{ - unsigned long val = 1010, tmp, *mem = &val; - - if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) - return 1; - - tmp = val; - - if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) - return 1; - - if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) - return 1; - - tmp = 3030; - - if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) - return 1; - - if (__sync_lock_test_and_set(&val, 4040) != 3030) - return 1; - - mem = &tmp; - - if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) - return 1; - - __sync_synchronize(); - - if (mem != &val) - return 1; - - return 0; -}], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])]) - -if test "$ap_cv_atomic_builtins" = "yes"; then - AC_DEFINE(HAVE_ATOMIC_BUILTINS, 1, [Define if compiler provides atomic builtins]) -fi - -####################################### -#### Checks for library functions. #### -####################################### - -AC_FUNC_VPRINTF -AC_CHECK_FUNCS(\ - atexit \ - gettimeofday \ - memmove \ - strerror \ - inet_ntop inet_pton inet_aton \ - sigaction sigwait sigsuspend \ - stpcpy strcasecmp strtoul stricmp \ - writev \ - utime utimes sem_timedwait \ - pthread_yield sched_yield \ - getenv putenv setenv unsetenv \ -) - -AC_SEARCH_LIBS(gethostbyname, nsl) -AC_SEARCH_LIBS(gethostname, nsl) -AC_SEARCH_LIBS(socket, socket) -AC_SEARCH_LIBS(pthread_barrier_wait, pthread) -AC_SEARCH_LIBS(gnutls_global_set_log_level, gnutls) - -AC_SEARCH_LIBS([sctp_sendmsg], [sctp], [have_sctp_lib=yes], [have_sctp_lib=no]) -if test x$have_sctp_lib == xno; then - AC_SEARCH_LIBS([usrsctp_init], [usrsctp], [have_usrsctp_lib=yes], [have_usrsctp_lib=no]) - if test x$have_usrsctp_lib == xno; then - AC_MSG_ERROR([You must install the SCTP libraries and development headers to enable SCTP support.]) - else - AC_DEFINE([USE_USRSCTP], [1], [Define to 1 if you have the usrsctp library.]) - fi -fi -AM_CONDITIONAL([USRSCTP], [test x$have_usrsctp_lib = xyes]) - PKG_CHECK_MODULES([YAML], yaml-0.1 >= 0.1.4) PKG_CHECK_MODULES([MONGOC], libmongoc-1.0 >= 1.3.1) FREEDIAMETER_DIR=freeDiameter-1.2.1 @@ -418,18 +174,14 @@ AC_SUBST(FREEDIAMETER_DIR) AC_CONFIG_SUBDIRS([lib/freeDiameter-1.2.1]) -AC_CONFIG_FILES([lib/core/include/core.h]) -AC_CONFIG_FILES([lib/core/src/Makefile]) -AC_CONFIG_FILES([lib/core/test/Makefile]) -AC_CONFIG_FILES([lib/core/Makefile]) -AC_CONFIG_FILES([lib/s1ap/asn1c/Makefile]) -AC_CONFIG_FILES([lib/s1ap/Makefile]) +AC_CONFIG_FILES([lib/base/Makefile]) +AC_CONFIG_FILES([lib/asn1c/Makefile]) AC_CONFIG_FILES([lib/nas/Makefile]) AC_CONFIG_FILES([lib/fd/Makefile]) AC_CONFIG_FILES([lib/gtp/Makefile]) AC_CONFIG_FILES([lib/ipfw/Makefile]) AC_CONFIG_FILES([lib/Makefile]) -AC_CONFIG_FILES([src/common/Makefile]) +AC_CONFIG_FILES([src/app/Makefile]) AC_CONFIG_FILES([src/mme/Makefile]) AC_CONFIG_FILES([src/hss/Makefile]) AC_CONFIG_FILES([src/sgw/Makefile]) @@ -460,22 +212,23 @@ AC_CONFIG_FILES([support/newsyslog/nextepc.conf]) AC_CONFIG_FILES([support/newsyslog/Makefile]) AC_CONFIG_FILES([support/Makefile]) AC_CONFIG_FILES([test/sample.conf]) +AC_CONFIG_FILES([test/sample-simple.conf]) AC_CONFIG_FILES([test/sample-volte.conf]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT -echo " -NextEPC configuration --------------------- -version : ${PACKAGE_VERSION} -host : ${host} -source code location : ${srcdir} -compiler : ${CC} -compiler flags : ${CFLAGS} ${YAML_CFLAGS} ${MONGOC_CFLAGS} -linker flags : ${LDFLAGS} ${LIBS} ${YAML_LIBS} ${MONGOC_LIBS} -bin directory : ${BIN_DIR} -lib directory : ${LIB_DIR}/nextepc -config directory : ${SYSCONF_DIR}/nextepc -log directory : ${LOCALSTATE_DIR}/log/nextepc -" +AC_MSG_NOTICE([NextEPC configuration: + + version: ${PACKAGE_VERSION} + compiler: ${CC} + compiler flags: ${CFLAGS} ${OGSLIB_CFLAGS} ${MONGOC_CFLAGS} + linker flags: ${LDFLAGS} ${LIBS} ${OGSCORE_LIBS} ${OGSCRYPT_LIBS} ${MONGOC_LIBS} + path prefix: ${prefix} + binary file: ${BIN_DIR}/nextepc-epcd + library directory: ${LIB_DIR}/nextepc + configuration prefix: ${SYSCONF_DIR}/nextepc + configuration file: ${SYSCONF_DIR}/nextepc/nextepc.conf + pid file: ${LOCALSTATE_DIR}/run/nextepc.pid + logging file: ${LOCALSTATE_DIR}/log/nextepc.log +]) diff --git a/debian/changelog b/debian/changelog index f7fdcfb16..e20805134 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nextepc (0.4.0) unstable; urgency=medium + + * Integration with OGSLIB + + -- Sukchan Lee Sat, 27 Apr 2019 14:34:15 +0000 + nextepc (0.3.11~bionic) bionic; urgency=medium * Bug Fixed diff --git a/debian/control b/debian/control index 16115e4df..46e21b938 100644 --- a/debian/control +++ b/debian/control @@ -4,24 +4,27 @@ Section: net Priority: optional Build-Depends: debhelper (>= 9), autotools-dev, - pkg-config, - git, dh-autoreconf, dh-systemd, + pkg-config, + autoconf, + automake, + libtool, flex, bison, - libsctp-dev, + ogslib-dev (>= 1.0.0), libgnutls28-dev, libgcrypt-dev, libssl-dev, libidn11-dev, libmongoc-dev, libbson-dev, - libyaml-dev -Standards-Version: 3.9.6 -Vcs-Browser: https://github.com/acetcom/nextepc -Vcs-Git: git://github.com/acetcom/nextepc -Homepage: http://nextepc.org/ + libsctp-dev, + libyaml-dev, +Standards-Version: 3.9.8 +Vcs-Browser: https://github.com/open5gs/nextepc +Vcs-Git: git://github.com/open5gs/nextepc +Homepage: https://open5gs.org/nextepc Package: nextepc-core Architecture: any @@ -117,8 +120,7 @@ Description: Open Source based 3GPP EPC HSS (Home Subscriber Server) Package: nextepc Architecture: any Multi-Arch: same -Depends: ${shlibs:Depends}, - ${misc:Depends}, +Depends: ${misc:Depends}, mongodb, nextepc-core (= ${binary:Version}), nextepc-mme (= ${binary:Version}), @@ -132,3 +134,14 @@ Description: Open Source based 3GPP EPC (metapackage) . This is a metapackage that depends on all the nextepc parts. (MME, SGW, PGW, HSS, PCRF) + +Package: nextepc-dbg +Architecture: any +Multi-Arch: same +Depends: ${misc:Depends}, + nextepc (= ${binary:Version}) +Description: Debug symbols for NextEPC + NextEPC is a C-language Open Source implementation of the 3GPP Evolved + Packet Core, i.e. the core network of an LTE network. + . + This package contains debug symbols for NextEPC. diff --git a/debian/rules b/debian/rules index 4af1a4a98..bff3bae29 100755 --- a/debian/rules +++ b/debian/rules @@ -14,9 +14,15 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf --with systemd +override_dh_strip: + dh_strip --dbg-package=nextepc-dbg + override_dh_auto_test: sctp_exclude_list=; \ if ! cat /proc/net/protocols | grep SCTP > /dev/null; then \ - sctp_exclude_list="-x testsctp"; \ + sctp_exclude_list="-x sctp-test"; \ fi; \ - lib/core/test/testcore $$sctp_exclude_list || exit; \ + test/testunit -f test/sample.conf $$sctp_exclude_list || exit; \ + +#override_dh_makeshlibs: +# dh_makeshlibs -V diff --git a/support/docker/README.md b/docker/README.md similarity index 71% rename from support/docker/README.md rename to docker/README.md index f335d9ead..6e5f31995 100644 --- a/support/docker/README.md +++ b/docker/README.md @@ -34,7 +34,23 @@ Docker running example * Run WebUI $ docker-compose up -d -For Debian Package Release +For OpenSUSE Build Service Release +=========================================== + +* Build Package + $ ./build-aux/git-version-gen . > .tarball-version + $ dpkg-source -b . + $ rm -f .tarball-version + +* Get Release Key + $ wget http://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_18.04/Release.key + $ sudo apt-key add Release.key + +* Setup Repository + $ sudo sh -c "echo 'deb https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_18.04/ ./' > /etc/apt/sources.list.d/open5gs-latest.list" + $ sudo apt-get update + +For Launchpad Release =========================================== * Run Docker @@ -58,7 +74,3 @@ export DEBEMAIL='acetcom@gmail.com' * Build pckage $ dpkg-buildpackage -For Mac OS X (SCTP-patch) -=========================================== -* /Applications/Docker.app/Contents/Resources/moby -Update linuxkit-kernel, vmlinuz64 diff --git a/support/docker/build/Dockerfile b/docker/build/Dockerfile similarity index 100% rename from support/docker/build/Dockerfile rename to docker/build/Dockerfile diff --git a/support/docker/build/setup.sh b/docker/build/setup.sh similarity index 100% rename from support/docker/build/setup.sh rename to docker/build/setup.sh diff --git a/support/docker/centos/7/base/Dockerfile b/docker/centos/7/base/Dockerfile similarity index 100% rename from support/docker/centos/7/base/Dockerfile rename to docker/centos/7/base/Dockerfile diff --git a/support/docker/centos/7/dev/Dockerfile b/docker/centos/7/dev/Dockerfile similarity index 100% rename from support/docker/centos/7/dev/Dockerfile rename to docker/centos/7/dev/Dockerfile diff --git a/support/docker/centos/7/dev/setup.sh b/docker/centos/7/dev/setup.sh similarity index 100% rename from support/docker/centos/7/dev/setup.sh rename to docker/centos/7/dev/setup.sh diff --git a/support/docker/centos/latest b/docker/centos/latest similarity index 100% rename from support/docker/centos/latest rename to docker/centos/latest diff --git a/support/docker/check.sh b/docker/check.sh similarity index 100% rename from support/docker/check.sh rename to docker/check.sh diff --git a/support/docker/debian/jessie/base/Dockerfile b/docker/debian/jessie/base/Dockerfile similarity index 100% rename from support/docker/debian/jessie/base/Dockerfile rename to docker/debian/jessie/base/Dockerfile diff --git a/support/docker/debian/jessie/dev b/docker/debian/jessie/dev similarity index 100% rename from support/docker/debian/jessie/dev rename to docker/debian/jessie/dev diff --git a/support/docker/debian/latest b/docker/debian/latest similarity index 100% rename from support/docker/debian/latest rename to docker/debian/latest diff --git a/support/docker/debian/stable b/docker/debian/stable similarity index 100% rename from support/docker/debian/stable rename to docker/debian/stable diff --git a/support/docker/debian/stretch/base/Dockerfile b/docker/debian/stretch/base/Dockerfile similarity index 100% rename from support/docker/debian/stretch/base/Dockerfile rename to docker/debian/stretch/base/Dockerfile diff --git a/support/docker/debian/stretch/dev b/docker/debian/stretch/dev similarity index 100% rename from support/docker/debian/stretch/dev rename to docker/debian/stretch/dev diff --git a/support/docker/docker-compose.run.yml b/docker/docker-compose.run.yml similarity index 100% rename from support/docker/docker-compose.run.yml rename to docker/docker-compose.run.yml diff --git a/support/docker/docker-compose.test.yml b/docker/docker-compose.test.yml similarity index 100% rename from support/docker/docker-compose.test.yml rename to docker/docker-compose.test.yml diff --git a/support/docker/docker-compose.yml b/docker/docker-compose.yml similarity index 100% rename from support/docker/docker-compose.yml rename to docker/docker-compose.yml diff --git a/support/docker/fedora/27/base/Dockerfile b/docker/fedora/27/base/Dockerfile similarity index 100% rename from support/docker/fedora/27/base/Dockerfile rename to docker/fedora/27/base/Dockerfile diff --git a/support/docker/fedora/27/dev/Dockerfile b/docker/fedora/27/dev/Dockerfile similarity index 100% rename from support/docker/fedora/27/dev/Dockerfile rename to docker/fedora/27/dev/Dockerfile diff --git a/support/docker/fedora/27/dev/setup.sh b/docker/fedora/27/dev/setup.sh similarity index 100% rename from support/docker/fedora/27/dev/setup.sh rename to docker/fedora/27/dev/setup.sh diff --git a/support/docker/fedora/latest b/docker/fedora/latest similarity index 100% rename from support/docker/fedora/latest rename to docker/fedora/latest diff --git a/support/docker/package/Dockerfile b/docker/package/Dockerfile similarity index 100% rename from support/docker/package/Dockerfile rename to docker/package/Dockerfile diff --git a/support/docker/ubuntu/artful b/docker/ubuntu/artful similarity index 100% rename from support/docker/ubuntu/artful rename to docker/ubuntu/artful diff --git a/support/docker/ubuntu/bionic/base/Dockerfile b/docker/ubuntu/bionic/base/Dockerfile similarity index 100% rename from support/docker/ubuntu/bionic/base/Dockerfile rename to docker/ubuntu/bionic/base/Dockerfile diff --git a/support/docker/ubuntu/bionic/dev/Dockerfile b/docker/ubuntu/bionic/dev/Dockerfile similarity index 95% rename from support/docker/ubuntu/bionic/dev/Dockerfile rename to docker/ubuntu/bionic/dev/Dockerfile index 2c9fc37c0..7fdc11a27 100644 --- a/support/docker/ubuntu/bionic/dev/Dockerfile +++ b/docker/ubuntu/bionic/dev/Dockerfile @@ -9,8 +9,10 @@ RUN apt-get update && \ apt-get upgrade -y && \ DEBIAN_FRONTEND=noninteractive \ apt-get install -y --no-install-recommends \ + git-buildpackage \ debhelper \ devscripts \ + osc \ dput \ dh-autoreconf \ dh-systemd \ diff --git a/support/docker/ubuntu/bionic/dev/setup.sh b/docker/ubuntu/bionic/dev/setup.sh similarity index 100% rename from support/docker/ubuntu/bionic/dev/setup.sh rename to docker/ubuntu/bionic/dev/setup.sh diff --git a/support/docker/ubuntu/latest b/docker/ubuntu/latest similarity index 100% rename from support/docker/ubuntu/latest rename to docker/ubuntu/latest diff --git a/support/docker/ubuntu/trusty/base/Dockerfile b/docker/ubuntu/trusty/base/Dockerfile similarity index 100% rename from support/docker/ubuntu/trusty/base/Dockerfile rename to docker/ubuntu/trusty/base/Dockerfile diff --git a/support/docker/ubuntu/trusty/dev b/docker/ubuntu/trusty/dev similarity index 100% rename from support/docker/ubuntu/trusty/dev rename to docker/ubuntu/trusty/dev diff --git a/support/docker/ubuntu/xenial b/docker/ubuntu/xenial similarity index 100% rename from support/docker/ubuntu/xenial rename to docker/ubuntu/xenial diff --git a/support/docker/webui/Dockerfile b/docker/webui/Dockerfile similarity index 100% rename from support/docker/webui/Dockerfile rename to docker/webui/Dockerfile diff --git a/lib/Makefile.am b/lib/Makefile.am index 20e7f2312..5ed9866f6 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,6 +1,15 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = @FREEDIAMETER_DIR@ ipfw core s1ap nas fd gtp +SUBDIRS = @FREEDIAMETER_DIR@ ipfw +DIST_SUBDIRS = @FREEDIAMETER_DIR@ ipfw + +if WITH_SRCLIB +SUBDIRS += ogslib +DIST_SUBDIRS += ogslib +endif + +SUBDIRS += base asn1c nas fd gtp +DIST_SUBDIRS += base asn1c nas fd gtp MAINTAINERCLEANFILES = Makefile.in MOSTLYCLEANFILES = *.stackdump diff --git a/lib/asn1c/Makefile.am b/lib/asn1c/Makefile.am new file mode 100644 index 000000000..85bdebaa1 --- /dev/null +++ b/lib/asn1c/Makefile.am @@ -0,0 +1,1163 @@ +ASN_MODULE_SRCS= \ + s1ap/S1AP_S1AP-PDU.c \ + s1ap/S1AP_InitiatingMessage.c \ + s1ap/S1AP_SuccessfulOutcome.c \ + s1ap/S1AP_UnsuccessfulOutcome.c \ + s1ap/S1AP_E-RAB-IE-ContainerList.c \ + s1ap/S1AP_HandoverRequired.c \ + s1ap/S1AP_HandoverCommand.c \ + s1ap/S1AP_E-RABSubjecttoDataForwardingList.c \ + s1ap/S1AP_E-RABDataForwardingItem.c \ + s1ap/S1AP_HandoverPreparationFailure.c \ + s1ap/S1AP_HandoverRequest.c \ + s1ap/S1AP_E-RABToBeSetupListHOReq.c \ + s1ap/S1AP_E-RABToBeSetupItemHOReq.c \ + s1ap/S1AP_HandoverRequestAcknowledge.c \ + s1ap/S1AP_E-RABAdmittedList.c \ + s1ap/S1AP_E-RABAdmittedItem.c \ + s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c \ + s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.c \ + s1ap/S1AP_HandoverFailure.c \ + s1ap/S1AP_HandoverNotify.c \ + s1ap/S1AP_PathSwitchRequest.c \ + s1ap/S1AP_E-RABToBeSwitchedDLList.c \ + s1ap/S1AP_E-RABToBeSwitchedDLItem.c \ + s1ap/S1AP_PathSwitchRequestAcknowledge.c \ + s1ap/S1AP_E-RABToBeSwitchedULList.c \ + s1ap/S1AP_E-RABToBeSwitchedULItem.c \ + s1ap/S1AP_PathSwitchRequestFailure.c \ + s1ap/S1AP_HandoverCancel.c \ + s1ap/S1AP_HandoverCancelAcknowledge.c \ + s1ap/S1AP_E-RABSetupRequest.c \ + s1ap/S1AP_E-RABToBeSetupListBearerSUReq.c \ + s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.c \ + s1ap/S1AP_E-RABSetupResponse.c \ + s1ap/S1AP_E-RABSetupListBearerSURes.c \ + s1ap/S1AP_E-RABSetupItemBearerSURes.c \ + s1ap/S1AP_E-RABModifyRequest.c \ + s1ap/S1AP_E-RABToBeModifiedListBearerModReq.c \ + s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.c \ + s1ap/S1AP_E-RABModifyResponse.c \ + s1ap/S1AP_E-RABModifyListBearerModRes.c \ + s1ap/S1AP_E-RABModifyItemBearerModRes.c \ + s1ap/S1AP_E-RABReleaseCommand.c \ + s1ap/S1AP_E-RABReleaseResponse.c \ + s1ap/S1AP_E-RABReleaseListBearerRelComp.c \ + s1ap/S1AP_E-RABReleaseItemBearerRelComp.c \ + s1ap/S1AP_E-RABReleaseIndication.c \ + s1ap/S1AP_InitialContextSetupRequest.c \ + s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.c \ + s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.c \ + s1ap/S1AP_InitialContextSetupResponse.c \ + s1ap/S1AP_E-RABSetupListCtxtSURes.c \ + s1ap/S1AP_E-RABSetupItemCtxtSURes.c \ + s1ap/S1AP_InitialContextSetupFailure.c \ + s1ap/S1AP_Paging.c \ + s1ap/S1AP_TAIList.c \ + s1ap/S1AP_TAIItem.c \ + s1ap/S1AP_UEContextReleaseRequest.c \ + s1ap/S1AP_UEContextReleaseCommand.c \ + s1ap/S1AP_UEContextReleaseComplete.c \ + s1ap/S1AP_UEContextModificationRequest.c \ + s1ap/S1AP_UEContextModificationResponse.c \ + s1ap/S1AP_UEContextModificationFailure.c \ + s1ap/S1AP_UERadioCapabilityMatchRequest.c \ + s1ap/S1AP_UERadioCapabilityMatchResponse.c \ + s1ap/S1AP_DownlinkNASTransport.c \ + s1ap/S1AP_InitialUEMessage.c \ + s1ap/S1AP_UplinkNASTransport.c \ + s1ap/S1AP_NASNonDeliveryIndication.c \ + s1ap/S1AP_RerouteNASRequest.c \ + s1ap/S1AP_NASDeliveryIndication.c \ + s1ap/S1AP_Reset.c \ + s1ap/S1AP_ResetType.c \ + s1ap/S1AP_ResetAll.c \ + s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.c \ + s1ap/S1AP_ResetAcknowledge.c \ + s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c \ + s1ap/S1AP_ErrorIndication.c \ + s1ap/S1AP_S1SetupRequest.c \ + s1ap/S1AP_S1SetupResponse.c \ + s1ap/S1AP_S1SetupFailure.c \ + s1ap/S1AP_ENBConfigurationUpdate.c \ + s1ap/S1AP_ENBConfigurationUpdateAcknowledge.c \ + s1ap/S1AP_ENBConfigurationUpdateFailure.c \ + s1ap/S1AP_MMEConfigurationUpdate.c \ + s1ap/S1AP_MMEConfigurationUpdateAcknowledge.c \ + s1ap/S1AP_MMEConfigurationUpdateFailure.c \ + s1ap/S1AP_DownlinkS1cdma2000tunnelling.c \ + s1ap/S1AP_UplinkS1cdma2000tunnelling.c \ + s1ap/S1AP_UECapabilityInfoIndication.c \ + s1ap/S1AP_ENBStatusTransfer.c \ + s1ap/S1AP_MMEStatusTransfer.c \ + s1ap/S1AP_TraceStart.c \ + s1ap/S1AP_TraceFailureIndication.c \ + s1ap/S1AP_DeactivateTrace.c \ + s1ap/S1AP_CellTrafficTrace.c \ + s1ap/S1AP_LocationReportingControl.c \ + s1ap/S1AP_LocationReportingFailureIndication.c \ + s1ap/S1AP_LocationReport.c \ + s1ap/S1AP_OverloadStart.c \ + s1ap/S1AP_OverloadStop.c \ + s1ap/S1AP_WriteReplaceWarningRequest.c \ + s1ap/S1AP_WriteReplaceWarningResponse.c \ + s1ap/S1AP_ENBDirectInformationTransfer.c \ + s1ap/S1AP_Inter-SystemInformationTransferType.c \ + s1ap/S1AP_MMEDirectInformationTransfer.c \ + s1ap/S1AP_ENBConfigurationTransfer.c \ + s1ap/S1AP_MMEConfigurationTransfer.c \ + s1ap/S1AP_PrivateMessage.c \ + s1ap/S1AP_KillRequest.c \ + s1ap/S1AP_KillResponse.c \ + s1ap/S1AP_PWSRestartIndication.c \ + s1ap/S1AP_PWSFailureIndication.c \ + s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.c \ + s1ap/S1AP_UplinkUEAssociatedLPPaTransport.c \ + s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.c \ + s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.c \ + s1ap/S1AP_E-RABModificationIndication.c \ + s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c \ + s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.c \ + s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c \ + s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.c \ + s1ap/S1AP_CSGMembershipInfo.c \ + s1ap/S1AP_E-RABModificationConfirm.c \ + s1ap/S1AP_E-RABModifyListBearerModConf.c \ + s1ap/S1AP_E-RABModifyItemBearerModConf.c \ + s1ap/S1AP_UEContextModificationIndication.c \ + s1ap/S1AP_UEContextModificationConfirm.c \ + s1ap/S1AP_UEContextSuspendRequest.c \ + s1ap/S1AP_UEContextSuspendResponse.c \ + s1ap/S1AP_UEContextResumeRequest.c \ + s1ap/S1AP_E-RABFailedToResumeListResumeReq.c \ + s1ap/S1AP_E-RABFailedToResumeItemResumeReq.c \ + s1ap/S1AP_UEContextResumeResponse.c \ + s1ap/S1AP_E-RABFailedToResumeListResumeRes.c \ + s1ap/S1AP_E-RABFailedToResumeItemResumeRes.c \ + s1ap/S1AP_UEContextResumeFailure.c \ + s1ap/S1AP_ConnectionEstablishmentIndication.c \ + s1ap/S1AP_RetrieveUEInformation.c \ + s1ap/S1AP_UEInformationTransfer.c \ + s1ap/S1AP_ENBCPRelocationIndication.c \ + s1ap/S1AP_MMECPRelocationIndication.c \ + s1ap/S1AP_Additional-GUTI.c \ + s1ap/S1AP_AreaScopeOfMDT.c \ + s1ap/S1AP_AllocationAndRetentionPriority.c \ + s1ap/S1AP_AssistanceDataForCECapableUEs.c \ + s1ap/S1AP_AssistanceDataForPaging.c \ + s1ap/S1AP_AssistanceDataForRecommendedCells.c \ + s1ap/S1AP_Bearers-SubjectToStatusTransferList.c \ + s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.c \ + s1ap/S1AP_BearerType.c \ + s1ap/S1AP_BitRate.c \ + s1ap/S1AP_BPLMNs.c \ + s1ap/S1AP_BroadcastCancelledAreaList.c \ + s1ap/S1AP_BroadcastCompletedAreaList.c \ + s1ap/S1AP_CancelledCellinEAI.c \ + s1ap/S1AP_CancelledCellinEAI-Item.c \ + s1ap/S1AP_CancelledCellinTAI.c \ + s1ap/S1AP_CancelledCellinTAI-Item.c \ + s1ap/S1AP_Cause.c \ + s1ap/S1AP_CauseMisc.c \ + s1ap/S1AP_CauseProtocol.c \ + s1ap/S1AP_CauseRadioNetwork.c \ + s1ap/S1AP_CauseTransport.c \ + s1ap/S1AP_CauseNas.c \ + s1ap/S1AP_CellAccessMode.c \ + s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.c \ + s1ap/S1AP_CELevel.c \ + s1ap/S1AP_CE-mode-B-SupportIndicator.c \ + s1ap/S1AP_CellIdentity.c \ + s1ap/S1AP_CellID-Broadcast.c \ + s1ap/S1AP_CellID-Broadcast-Item.c \ + s1ap/S1AP_CellID-Cancelled.c \ + s1ap/S1AP_CellID-Cancelled-Item.c \ + s1ap/S1AP_CellBasedMDT.c \ + s1ap/S1AP_CellIdListforMDT.c \ + s1ap/S1AP_Cdma2000PDU.c \ + s1ap/S1AP_Cdma2000RATType.c \ + s1ap/S1AP_Cdma2000SectorID.c \ + s1ap/S1AP_Cdma2000HOStatus.c \ + s1ap/S1AP_Cdma2000HORequiredIndication.c \ + s1ap/S1AP_Cdma2000OneXSRVCCInfo.c \ + s1ap/S1AP_Cdma2000OneXMEID.c \ + s1ap/S1AP_Cdma2000OneXMSI.c \ + s1ap/S1AP_Cdma2000OneXPilot.c \ + s1ap/S1AP_Cdma2000OneXRAND.c \ + s1ap/S1AP_Cell-Size.c \ + s1ap/S1AP_CellType.c \ + s1ap/S1AP_CGI.c \ + s1ap/S1AP_CI.c \ + s1ap/S1AP_CNDomain.c \ + s1ap/S1AP_ConcurrentWarningMessageIndicator.c \ + s1ap/S1AP_Correlation-ID.c \ + s1ap/S1AP_CSFallbackIndicator.c \ + s1ap/S1AP_AdditionalCSFallbackIndicator.c \ + s1ap/S1AP_CSG-Id.c \ + s1ap/S1AP_CSG-IdList.c \ + s1ap/S1AP_CSG-IdList-Item.c \ + s1ap/S1AP_CSGMembershipStatus.c \ + s1ap/S1AP_COUNTvalue.c \ + s1ap/S1AP_COUNTValueExtended.c \ + s1ap/S1AP_COUNTvaluePDCP-SNlength18.c \ + s1ap/S1AP_Coverage-Level.c \ + s1ap/S1AP_CriticalityDiagnostics.c \ + s1ap/S1AP_CriticalityDiagnostics-IE-List.c \ + s1ap/S1AP_CriticalityDiagnostics-IE-Item.c \ + s1ap/S1AP_DataCodingScheme.c \ + s1ap/S1AP_DCN-ID.c \ + s1ap/S1AP_ServedDCNs.c \ + s1ap/S1AP_ServedDCNsItem.c \ + s1ap/S1AP_DL-CP-SecurityInformation.c \ + s1ap/S1AP_DL-Forwarding.c \ + s1ap/S1AP_DL-NAS-MAC.c \ + s1ap/S1AP_Direct-Forwarding-Path-Availability.c \ + s1ap/S1AP_Data-Forwarding-Not-Possible.c \ + s1ap/S1AP_DLNASPDUDeliveryAckRequest.c \ + s1ap/S1AP_EARFCN.c \ + s1ap/S1AP_ECGIList.c \ + s1ap/S1AP_PWSfailedECGIList.c \ + s1ap/S1AP_EmergencyAreaIDList.c \ + s1ap/S1AP_EmergencyAreaID.c \ + s1ap/S1AP_EmergencyAreaID-Broadcast.c \ + s1ap/S1AP_EmergencyAreaID-Broadcast-Item.c \ + s1ap/S1AP_EmergencyAreaID-Cancelled.c \ + s1ap/S1AP_EmergencyAreaID-Cancelled-Item.c \ + s1ap/S1AP_CompletedCellinEAI.c \ + s1ap/S1AP_CompletedCellinEAI-Item.c \ + s1ap/S1AP_ECGI-List.c \ + s1ap/S1AP_EmergencyAreaIDListForRestart.c \ + s1ap/S1AP_ENB-ID.c \ + s1ap/S1AP_GERAN-Cell-ID.c \ + s1ap/S1AP_Global-ENB-ID.c \ + s1ap/S1AP_GUMMEIList.c \ + s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.c \ + s1ap/S1AP_ENB-UE-S1AP-ID.c \ + s1ap/S1AP_ENBname.c \ + s1ap/S1AP_ENBX2TLAs.c \ + s1ap/S1AP_EncryptionAlgorithms.c \ + s1ap/S1AP_EnhancedCoverageRestricted.c \ + s1ap/S1AP_EPLMNs.c \ + s1ap/S1AP_EventType.c \ + s1ap/S1AP_E-RAB-ID.c \ + s1ap/S1AP_E-RABInformationList.c \ + s1ap/S1AP_E-RABInformationListItem.c \ + s1ap/S1AP_E-RABList.c \ + s1ap/S1AP_E-RABItem.c \ + s1ap/S1AP_E-RABLevelQoSParameters.c \ + s1ap/S1AP_EUTRAN-CGI.c \ + s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.c \ + s1ap/S1AP_ExpectedUEBehaviour.c \ + s1ap/S1AP_ExpectedUEActivityBehaviour.c \ + s1ap/S1AP_ExpectedActivityPeriod.c \ + s1ap/S1AP_ExpectedIdlePeriod.c \ + s1ap/S1AP_SourceOfUEActivityBehaviourInformation.c \ + s1ap/S1AP_ExpectedHOInterval.c \ + s1ap/S1AP_ExtendedRNC-ID.c \ + s1ap/S1AP_ExtendedRepetitionPeriod.c \ + s1ap/S1AP_Extended-UEIdentityIndexValue.c \ + s1ap/S1AP_ForbiddenInterRATs.c \ + s1ap/S1AP_ForbiddenTAs.c \ + s1ap/S1AP_ForbiddenTAs-Item.c \ + s1ap/S1AP_ForbiddenTACs.c \ + s1ap/S1AP_ForbiddenLAs.c \ + s1ap/S1AP_ForbiddenLAs-Item.c \ + s1ap/S1AP_ForbiddenLACs.c \ + s1ap/S1AP_GBR-QosInformation.c \ + s1ap/S1AP_GTP-TEID.c \ + s1ap/S1AP_GUMMEI.c \ + s1ap/S1AP_GUMMEIType.c \ + s1ap/S1AP_GWContextReleaseIndication.c \ + s1ap/S1AP_HandoverRestrictionList.c \ + s1ap/S1AP_HandoverType.c \ + s1ap/S1AP_HFN.c \ + s1ap/S1AP_HFNModified.c \ + s1ap/S1AP_HFNforPDCP-SNlength18.c \ + s1ap/S1AP_Masked-IMEISV.c \ + s1ap/S1AP_ImmediateMDT.c \ + s1ap/S1AP_IMSI.c \ + s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c \ + s1ap/S1AP_IntegrityProtectionAlgorithms.c \ + s1ap/S1AP_IntendedNumberOfPagingAttempts.c \ + s1ap/S1AP_InterfacesToTrace.c \ + s1ap/S1AP_KillAllWarningMessages.c \ + s1ap/S1AP_LAC.c \ + s1ap/S1AP_LAI.c \ + s1ap/S1AP_LastVisitedCell-Item.c \ + s1ap/S1AP_LastVisitedEUTRANCellInformation.c \ + s1ap/S1AP_LastVisitedUTRANCellInformation.c \ + s1ap/S1AP_LastVisitedGERANCellInformation.c \ + s1ap/S1AP_L3-Information.c \ + s1ap/S1AP_LPPa-PDU.c \ + s1ap/S1AP_LHN-ID.c \ + s1ap/S1AP_Links-to-log.c \ + s1ap/S1AP_ListeningSubframePattern.c \ + s1ap/S1AP_LoggedMDT.c \ + s1ap/S1AP_LoggingInterval.c \ + s1ap/S1AP_LoggingDuration.c \ + s1ap/S1AP_LoggedMBSFNMDT.c \ + s1ap/S1AP_M3Configuration.c \ + s1ap/S1AP_M3period.c \ + s1ap/S1AP_M4Configuration.c \ + s1ap/S1AP_M4period.c \ + s1ap/S1AP_M5Configuration.c \ + s1ap/S1AP_M5period.c \ + s1ap/S1AP_M6Configuration.c \ + s1ap/S1AP_M6report-Interval.c \ + s1ap/S1AP_M6delay-threshold.c \ + s1ap/S1AP_M7Configuration.c \ + s1ap/S1AP_M7period.c \ + s1ap/S1AP_MDT-Activation.c \ + s1ap/S1AP_MDT-Location-Info.c \ + s1ap/S1AP_MDT-Configuration.c \ + s1ap/S1AP_ManagementBasedMDTAllowed.c \ + s1ap/S1AP_MBSFN-ResultToLog.c \ + s1ap/S1AP_MBSFN-ResultToLogInfo.c \ + s1ap/S1AP_MDTPLMNList.c \ + s1ap/S1AP_PrivacyIndicator.c \ + s1ap/S1AP_MDTMode.c \ + s1ap/S1AP_MDTMode-Extension.c \ + s1ap/S1AP_MeasurementsToActivate.c \ + s1ap/S1AP_MeasurementThresholdA2.c \ + s1ap/S1AP_MessageIdentifier.c \ + s1ap/S1AP_MobilityInformation.c \ + s1ap/S1AP_MMEname.c \ + s1ap/S1AP_MMEPagingTarget.c \ + s1ap/S1AP_MMERelaySupportIndicator.c \ + s1ap/S1AP_MME-Group-ID.c \ + s1ap/S1AP_MME-Code.c \ + s1ap/S1AP_MME-UE-S1AP-ID.c \ + s1ap/S1AP_M-TMSI.c \ + s1ap/S1AP_MSClassmark2.c \ + s1ap/S1AP_MSClassmark3.c \ + s1ap/S1AP_MutingAvailabilityIndication.c \ + s1ap/S1AP_MutingPatternInformation.c \ + s1ap/S1AP_NAS-PDU.c \ + s1ap/S1AP_NASSecurityParametersfromE-UTRAN.c \ + s1ap/S1AP_NASSecurityParameterstoE-UTRAN.c \ + s1ap/S1AP_NB-IoT-DefaultPagingDRX.c \ + s1ap/S1AP_NB-IoT-Paging-eDRXInformation.c \ + s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.c \ + s1ap/S1AP_NB-IoT-PagingTimeWindow.c \ + s1ap/S1AP_NB-IoT-UEIdentityIndexValue.c \ + s1ap/S1AP_NextPagingAreaScope.c \ + s1ap/S1AP_NumberofBroadcastRequest.c \ + s1ap/S1AP_NumberOfBroadcasts.c \ + s1ap/S1AP_OldBSS-ToNewBSS-Information.c \ + s1ap/S1AP_OverloadAction.c \ + s1ap/S1AP_OverloadResponse.c \ + s1ap/S1AP_PagingAttemptInformation.c \ + s1ap/S1AP_PagingAttemptCount.c \ + s1ap/S1AP_Paging-eDRXInformation.c \ + s1ap/S1AP_Paging-eDRX-Cycle.c \ + s1ap/S1AP_PagingTimeWindow.c \ + s1ap/S1AP_PagingDRX.c \ + s1ap/S1AP_PagingPriority.c \ + s1ap/S1AP_PDCP-SN.c \ + s1ap/S1AP_PDCP-SNExtended.c \ + s1ap/S1AP_PDCP-SNlength18.c \ + s1ap/S1AP_M1PeriodicReporting.c \ + s1ap/S1AP_PLMNidentity.c \ + s1ap/S1AP_Port-Number.c \ + s1ap/S1AP_Pre-emptionCapability.c \ + s1ap/S1AP_Pre-emptionVulnerability.c \ + s1ap/S1AP_PriorityLevel.c \ + s1ap/S1AP_ProSeAuthorized.c \ + s1ap/S1AP_ProSeDirectDiscovery.c \ + s1ap/S1AP_ProSeUEtoNetworkRelaying.c \ + s1ap/S1AP_ProSeDirectCommunication.c \ + s1ap/S1AP_PS-ServiceNotAvailable.c \ + s1ap/S1AP_QCI.c \ + s1ap/S1AP_ReceiveStatusofULPDCPSDUs.c \ + s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c \ + s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c \ + s1ap/S1AP_RecommendedCellsForPaging.c \ + s1ap/S1AP_RecommendedCellList.c \ + s1ap/S1AP_RecommendedCellItem.c \ + s1ap/S1AP_RecommendedENBsForPaging.c \ + s1ap/S1AP_RecommendedENBList.c \ + s1ap/S1AP_RecommendedENBItem.c \ + s1ap/S1AP_RelativeMMECapacity.c \ + s1ap/S1AP_RelayNode-Indicator.c \ + s1ap/S1AP_RAC.c \ + s1ap/S1AP_RAT-Type.c \ + s1ap/S1AP_ReportAmountMDT.c \ + s1ap/S1AP_ReportIntervalMDT.c \ + s1ap/S1AP_M1ReportingTrigger.c \ + s1ap/S1AP_RequestType.c \ + s1ap/S1AP_RIMTransfer.c \ + s1ap/S1AP_RIMInformation.c \ + s1ap/S1AP_RIMRoutingAddress.c \ + s1ap/S1AP_ReportArea.c \ + s1ap/S1AP_RepetitionPeriod.c \ + s1ap/S1AP_RLFReportInformation.c \ + s1ap/S1AP_RNC-ID.c \ + s1ap/S1AP_RRC-Container.c \ + s1ap/S1AP_RRC-Establishment-Cause.c \ + s1ap/S1AP_ECGIListForRestart.c \ + s1ap/S1AP_Routing-ID.c \ + s1ap/S1AP_SecurityKey.c \ + s1ap/S1AP_SecurityContext.c \ + s1ap/S1AP_SerialNumber.c \ + s1ap/S1AP_SONInformation.c \ + s1ap/S1AP_SONInformation-Extension.c \ + s1ap/S1AP_SONInformationRequest.c \ + s1ap/S1AP_SONInformationReply.c \ + s1ap/S1AP_SONInformationReport.c \ + s1ap/S1AP_SONConfigurationTransfer.c \ + s1ap/S1AP_SynchronisationInformation.c \ + s1ap/S1AP_Source-ToTarget-TransparentContainer.c \ + s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c \ + s1ap/S1AP_SourceeNB-ID.c \ + s1ap/S1AP_SRVCCOperationNotPossible.c \ + s1ap/S1AP_SRVCCOperationPossible.c \ + s1ap/S1AP_SRVCCHOIndication.c \ + s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c \ + s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c \ + s1ap/S1AP_ServedGUMMEIs.c \ + s1ap/S1AP_ServedGUMMEIsItem.c \ + s1ap/S1AP_ServedGroupIDs.c \ + s1ap/S1AP_ServedMMECs.c \ + s1ap/S1AP_ServedPLMNs.c \ + s1ap/S1AP_SubscriberProfileIDforRFP.c \ + s1ap/S1AP_SupportedTAs.c \ + s1ap/S1AP_SupportedTAs-Item.c \ + s1ap/S1AP_StratumLevel.c \ + s1ap/S1AP_SynchronisationStatus.c \ + s1ap/S1AP_TimeSynchronisationInfo.c \ + s1ap/S1AP_S-TMSI.c \ + s1ap/S1AP_TAC.c \ + s1ap/S1AP_TAIBasedMDT.c \ + s1ap/S1AP_TAIListforMDT.c \ + s1ap/S1AP_TAIListforWarning.c \ + s1ap/S1AP_TAI.c \ + s1ap/S1AP_TAI-Broadcast.c \ + s1ap/S1AP_TAI-Broadcast-Item.c \ + s1ap/S1AP_TAI-Cancelled.c \ + s1ap/S1AP_TAI-Cancelled-Item.c \ + s1ap/S1AP_TABasedMDT.c \ + s1ap/S1AP_TAListforMDT.c \ + s1ap/S1AP_CompletedCellinTAI.c \ + s1ap/S1AP_CompletedCellinTAI-Item.c \ + s1ap/S1AP_TBCD-STRING.c \ + s1ap/S1AP_TargetID.c \ + s1ap/S1AP_TargeteNB-ID.c \ + s1ap/S1AP_TargetRNC-ID.c \ + s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c \ + s1ap/S1AP_Target-ToSource-TransparentContainer.c \ + s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c \ + s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c \ + s1ap/S1AP_M1ThresholdEventA2.c \ + s1ap/S1AP_Threshold-RSRP.c \ + s1ap/S1AP_Threshold-RSRQ.c \ + s1ap/S1AP_TimeToWait.c \ + s1ap/S1AP_Time-UE-StayedInCell.c \ + s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c \ + s1ap/S1AP_TransportInformation.c \ + s1ap/S1AP_TransportLayerAddress.c \ + s1ap/S1AP_TraceActivation.c \ + s1ap/S1AP_TraceDepth.c \ + s1ap/S1AP_E-UTRAN-Trace-ID.c \ + s1ap/S1AP_TrafficLoadReductionIndication.c \ + s1ap/S1AP_TunnelInformation.c \ + s1ap/S1AP_TypeOfError.c \ + s1ap/S1AP_TAIListForRestart.c \ + s1ap/S1AP_UEAggregateMaximumBitrate.c \ + s1ap/S1AP_UE-RetentionInformation.c \ + s1ap/S1AP_UE-S1AP-IDs.c \ + s1ap/S1AP_UE-S1AP-ID-pair.c \ + s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.c \ + s1ap/S1AP_UEIdentityIndexValue.c \ + s1ap/S1AP_UE-HistoryInformation.c \ + s1ap/S1AP_UE-HistoryInformationFromTheUE.c \ + s1ap/S1AP_UEPagingID.c \ + s1ap/S1AP_UERadioCapability.c \ + s1ap/S1AP_UERadioCapabilityForPaging.c \ + s1ap/S1AP_UE-RLF-Report-Container.c \ + s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.c \ + s1ap/S1AP_UESecurityCapabilities.c \ + s1ap/S1AP_UESidelinkAggregateMaximumBitrate.c \ + s1ap/S1AP_UE-Usage-Type.c \ + s1ap/S1AP_UL-CP-SecurityInformation.c \ + s1ap/S1AP_UL-NAS-MAC.c \ + s1ap/S1AP_UL-NAS-Count.c \ + s1ap/S1AP_UserLocationInformation.c \ + s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.c \ + s1ap/S1AP_VoiceSupportMatchIndicator.c \ + s1ap/S1AP_V2XServicesAuthorized.c \ + s1ap/S1AP_VehicleUE.c \ + s1ap/S1AP_PedestrianUE.c \ + s1ap/S1AP_WarningAreaList.c \ + s1ap/S1AP_WarningType.c \ + s1ap/S1AP_WarningSecurityInfo.c \ + s1ap/S1AP_WarningMessageContents.c \ + s1ap/S1AP_X2TNLConfigurationInfo.c \ + s1ap/S1AP_ENBX2ExtTLAs.c \ + s1ap/S1AP_ENBX2ExtTLA.c \ + s1ap/S1AP_ENBX2GTPTLAs.c \ + s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.c \ + s1ap/S1AP_Criticality.c \ + s1ap/S1AP_Presence.c \ + s1ap/S1AP_PrivateIE-ID.c \ + s1ap/S1AP_ProcedureCode.c \ + s1ap/S1AP_ProtocolExtensionID.c \ + s1ap/S1AP_ProtocolIE-ID.c \ + s1ap/S1AP_TriggeringMessage.c \ + s1ap/S1AP_ProtocolIE-Container.c \ + s1ap/S1AP_ProtocolIE-SingleContainer.c \ + s1ap/S1AP_ProtocolIE-Field.c \ + s1ap/S1AP_ProtocolIE-ContainerList.c \ + s1ap/S1AP_ProtocolExtensionContainer.c \ + s1ap/S1AP_ProtocolExtensionField.c \ + s1ap/S1AP_PrivateIE-Container.c \ + s1ap/S1AP_PrivateIE-Field.c + +ASN_MODULE_HDRS= \ + s1ap/S1AP_S1AP-PDU.h \ + s1ap/S1AP_InitiatingMessage.h \ + s1ap/S1AP_SuccessfulOutcome.h \ + s1ap/S1AP_UnsuccessfulOutcome.h \ + s1ap/S1AP_E-RAB-IE-ContainerList.h \ + s1ap/S1AP_E-RAB-IE-ContainerPairList.h \ + s1ap/S1AP_ProtocolError-IE-ContainerList.h \ + s1ap/S1AP_HandoverRequired.h \ + s1ap/S1AP_HandoverCommand.h \ + s1ap/S1AP_E-RABSubjecttoDataForwardingList.h \ + s1ap/S1AP_E-RABDataForwardingItem.h \ + s1ap/S1AP_HandoverPreparationFailure.h \ + s1ap/S1AP_HandoverRequest.h \ + s1ap/S1AP_E-RABToBeSetupListHOReq.h \ + s1ap/S1AP_E-RABToBeSetupItemHOReq.h \ + s1ap/S1AP_HandoverRequestAcknowledge.h \ + s1ap/S1AP_E-RABAdmittedList.h \ + s1ap/S1AP_E-RABAdmittedItem.h \ + s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.h \ + s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.h \ + s1ap/S1AP_HandoverFailure.h \ + s1ap/S1AP_HandoverNotify.h \ + s1ap/S1AP_PathSwitchRequest.h \ + s1ap/S1AP_E-RABToBeSwitchedDLList.h \ + s1ap/S1AP_E-RABToBeSwitchedDLItem.h \ + s1ap/S1AP_PathSwitchRequestAcknowledge.h \ + s1ap/S1AP_E-RABToBeSwitchedULList.h \ + s1ap/S1AP_E-RABToBeSwitchedULItem.h \ + s1ap/S1AP_PathSwitchRequestFailure.h \ + s1ap/S1AP_HandoverCancel.h \ + s1ap/S1AP_HandoverCancelAcknowledge.h \ + s1ap/S1AP_E-RABSetupRequest.h \ + s1ap/S1AP_E-RABToBeSetupListBearerSUReq.h \ + s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.h \ + s1ap/S1AP_E-RABSetupResponse.h \ + s1ap/S1AP_E-RABSetupListBearerSURes.h \ + s1ap/S1AP_E-RABSetupItemBearerSURes.h \ + s1ap/S1AP_E-RABModifyRequest.h \ + s1ap/S1AP_E-RABToBeModifiedListBearerModReq.h \ + s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.h \ + s1ap/S1AP_E-RABModifyResponse.h \ + s1ap/S1AP_E-RABModifyListBearerModRes.h \ + s1ap/S1AP_E-RABModifyItemBearerModRes.h \ + s1ap/S1AP_E-RABReleaseCommand.h \ + s1ap/S1AP_E-RABReleaseResponse.h \ + s1ap/S1AP_E-RABReleaseListBearerRelComp.h \ + s1ap/S1AP_E-RABReleaseItemBearerRelComp.h \ + s1ap/S1AP_E-RABReleaseIndication.h \ + s1ap/S1AP_InitialContextSetupRequest.h \ + s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.h \ + s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.h \ + s1ap/S1AP_InitialContextSetupResponse.h \ + s1ap/S1AP_E-RABSetupListCtxtSURes.h \ + s1ap/S1AP_E-RABSetupItemCtxtSURes.h \ + s1ap/S1AP_InitialContextSetupFailure.h \ + s1ap/S1AP_Paging.h \ + s1ap/S1AP_TAIList.h \ + s1ap/S1AP_TAIItem.h \ + s1ap/S1AP_UEContextReleaseRequest.h \ + s1ap/S1AP_UEContextReleaseCommand.h \ + s1ap/S1AP_UEContextReleaseComplete.h \ + s1ap/S1AP_UEContextModificationRequest.h \ + s1ap/S1AP_UEContextModificationResponse.h \ + s1ap/S1AP_UEContextModificationFailure.h \ + s1ap/S1AP_UERadioCapabilityMatchRequest.h \ + s1ap/S1AP_UERadioCapabilityMatchResponse.h \ + s1ap/S1AP_DownlinkNASTransport.h \ + s1ap/S1AP_InitialUEMessage.h \ + s1ap/S1AP_UplinkNASTransport.h \ + s1ap/S1AP_NASNonDeliveryIndication.h \ + s1ap/S1AP_RerouteNASRequest.h \ + s1ap/S1AP_NASDeliveryIndication.h \ + s1ap/S1AP_Reset.h \ + s1ap/S1AP_ResetType.h \ + s1ap/S1AP_ResetAll.h \ + s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.h \ + s1ap/S1AP_ResetAcknowledge.h \ + s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h \ + s1ap/S1AP_ErrorIndication.h \ + s1ap/S1AP_S1SetupRequest.h \ + s1ap/S1AP_S1SetupResponse.h \ + s1ap/S1AP_S1SetupFailure.h \ + s1ap/S1AP_ENBConfigurationUpdate.h \ + s1ap/S1AP_ENBConfigurationUpdateAcknowledge.h \ + s1ap/S1AP_ENBConfigurationUpdateFailure.h \ + s1ap/S1AP_MMEConfigurationUpdate.h \ + s1ap/S1AP_MMEConfigurationUpdateAcknowledge.h \ + s1ap/S1AP_MMEConfigurationUpdateFailure.h \ + s1ap/S1AP_DownlinkS1cdma2000tunnelling.h \ + s1ap/S1AP_UplinkS1cdma2000tunnelling.h \ + s1ap/S1AP_UECapabilityInfoIndication.h \ + s1ap/S1AP_ENBStatusTransfer.h \ + s1ap/S1AP_MMEStatusTransfer.h \ + s1ap/S1AP_TraceStart.h \ + s1ap/S1AP_TraceFailureIndication.h \ + s1ap/S1AP_DeactivateTrace.h \ + s1ap/S1AP_CellTrafficTrace.h \ + s1ap/S1AP_LocationReportingControl.h \ + s1ap/S1AP_LocationReportingFailureIndication.h \ + s1ap/S1AP_LocationReport.h \ + s1ap/S1AP_OverloadStart.h \ + s1ap/S1AP_OverloadStop.h \ + s1ap/S1AP_WriteReplaceWarningRequest.h \ + s1ap/S1AP_WriteReplaceWarningResponse.h \ + s1ap/S1AP_ENBDirectInformationTransfer.h \ + s1ap/S1AP_Inter-SystemInformationTransferType.h \ + s1ap/S1AP_MMEDirectInformationTransfer.h \ + s1ap/S1AP_ENBConfigurationTransfer.h \ + s1ap/S1AP_MMEConfigurationTransfer.h \ + s1ap/S1AP_PrivateMessage.h \ + s1ap/S1AP_KillRequest.h \ + s1ap/S1AP_KillResponse.h \ + s1ap/S1AP_PWSRestartIndication.h \ + s1ap/S1AP_PWSFailureIndication.h \ + s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.h \ + s1ap/S1AP_UplinkUEAssociatedLPPaTransport.h \ + s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.h \ + s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.h \ + s1ap/S1AP_E-RABModificationIndication.h \ + s1ap/S1AP_E-RABToBeModifiedListBearerModInd.h \ + s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.h \ + s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.h \ + s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.h \ + s1ap/S1AP_CSGMembershipInfo.h \ + s1ap/S1AP_E-RABModificationConfirm.h \ + s1ap/S1AP_E-RABModifyListBearerModConf.h \ + s1ap/S1AP_E-RABModifyItemBearerModConf.h \ + s1ap/S1AP_UEContextModificationIndication.h \ + s1ap/S1AP_UEContextModificationConfirm.h \ + s1ap/S1AP_UEContextSuspendRequest.h \ + s1ap/S1AP_UEContextSuspendResponse.h \ + s1ap/S1AP_UEContextResumeRequest.h \ + s1ap/S1AP_E-RABFailedToResumeListResumeReq.h \ + s1ap/S1AP_E-RABFailedToResumeItemResumeReq.h \ + s1ap/S1AP_UEContextResumeResponse.h \ + s1ap/S1AP_E-RABFailedToResumeListResumeRes.h \ + s1ap/S1AP_E-RABFailedToResumeItemResumeRes.h \ + s1ap/S1AP_UEContextResumeFailure.h \ + s1ap/S1AP_ConnectionEstablishmentIndication.h \ + s1ap/S1AP_RetrieveUEInformation.h \ + s1ap/S1AP_UEInformationTransfer.h \ + s1ap/S1AP_ENBCPRelocationIndication.h \ + s1ap/S1AP_MMECPRelocationIndication.h \ + s1ap/S1AP_Additional-GUTI.h \ + s1ap/S1AP_AreaScopeOfMDT.h \ + s1ap/S1AP_AllocationAndRetentionPriority.h \ + s1ap/S1AP_AssistanceDataForCECapableUEs.h \ + s1ap/S1AP_AssistanceDataForPaging.h \ + s1ap/S1AP_AssistanceDataForRecommendedCells.h \ + s1ap/S1AP_Bearers-SubjectToStatusTransferList.h \ + s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.h \ + s1ap/S1AP_BearerType.h \ + s1ap/S1AP_BitRate.h \ + s1ap/S1AP_BPLMNs.h \ + s1ap/S1AP_BroadcastCancelledAreaList.h \ + s1ap/S1AP_BroadcastCompletedAreaList.h \ + s1ap/S1AP_CancelledCellinEAI.h \ + s1ap/S1AP_CancelledCellinEAI-Item.h \ + s1ap/S1AP_CancelledCellinTAI.h \ + s1ap/S1AP_CancelledCellinTAI-Item.h \ + s1ap/S1AP_Cause.h \ + s1ap/S1AP_CauseMisc.h \ + s1ap/S1AP_CauseProtocol.h \ + s1ap/S1AP_CauseRadioNetwork.h \ + s1ap/S1AP_CauseTransport.h \ + s1ap/S1AP_CauseNas.h \ + s1ap/S1AP_CellAccessMode.h \ + s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.h \ + s1ap/S1AP_CELevel.h \ + s1ap/S1AP_CE-mode-B-SupportIndicator.h \ + s1ap/S1AP_CellIdentity.h \ + s1ap/S1AP_CellID-Broadcast.h \ + s1ap/S1AP_CellID-Broadcast-Item.h \ + s1ap/S1AP_CellID-Cancelled.h \ + s1ap/S1AP_CellID-Cancelled-Item.h \ + s1ap/S1AP_CellBasedMDT.h \ + s1ap/S1AP_CellIdListforMDT.h \ + s1ap/S1AP_Cdma2000PDU.h \ + s1ap/S1AP_Cdma2000RATType.h \ + s1ap/S1AP_Cdma2000SectorID.h \ + s1ap/S1AP_Cdma2000HOStatus.h \ + s1ap/S1AP_Cdma2000HORequiredIndication.h \ + s1ap/S1AP_Cdma2000OneXSRVCCInfo.h \ + s1ap/S1AP_Cdma2000OneXMEID.h \ + s1ap/S1AP_Cdma2000OneXMSI.h \ + s1ap/S1AP_Cdma2000OneXPilot.h \ + s1ap/S1AP_Cdma2000OneXRAND.h \ + s1ap/S1AP_Cell-Size.h \ + s1ap/S1AP_CellType.h \ + s1ap/S1AP_CGI.h \ + s1ap/S1AP_CI.h \ + s1ap/S1AP_CNDomain.h \ + s1ap/S1AP_ConcurrentWarningMessageIndicator.h \ + s1ap/S1AP_Correlation-ID.h \ + s1ap/S1AP_CSFallbackIndicator.h \ + s1ap/S1AP_AdditionalCSFallbackIndicator.h \ + s1ap/S1AP_CSG-Id.h \ + s1ap/S1AP_CSG-IdList.h \ + s1ap/S1AP_CSG-IdList-Item.h \ + s1ap/S1AP_CSGMembershipStatus.h \ + s1ap/S1AP_COUNTvalue.h \ + s1ap/S1AP_COUNTValueExtended.h \ + s1ap/S1AP_COUNTvaluePDCP-SNlength18.h \ + s1ap/S1AP_Coverage-Level.h \ + s1ap/S1AP_CriticalityDiagnostics.h \ + s1ap/S1AP_CriticalityDiagnostics-IE-List.h \ + s1ap/S1AP_CriticalityDiagnostics-IE-Item.h \ + s1ap/S1AP_DataCodingScheme.h \ + s1ap/S1AP_DCN-ID.h \ + s1ap/S1AP_ServedDCNs.h \ + s1ap/S1AP_ServedDCNsItem.h \ + s1ap/S1AP_DL-CP-SecurityInformation.h \ + s1ap/S1AP_DL-Forwarding.h \ + s1ap/S1AP_DL-NAS-MAC.h \ + s1ap/S1AP_Direct-Forwarding-Path-Availability.h \ + s1ap/S1AP_Data-Forwarding-Not-Possible.h \ + s1ap/S1AP_DLNASPDUDeliveryAckRequest.h \ + s1ap/S1AP_EARFCN.h \ + s1ap/S1AP_ECGIList.h \ + s1ap/S1AP_PWSfailedECGIList.h \ + s1ap/S1AP_EmergencyAreaIDList.h \ + s1ap/S1AP_EmergencyAreaID.h \ + s1ap/S1AP_EmergencyAreaID-Broadcast.h \ + s1ap/S1AP_EmergencyAreaID-Broadcast-Item.h \ + s1ap/S1AP_EmergencyAreaID-Cancelled.h \ + s1ap/S1AP_EmergencyAreaID-Cancelled-Item.h \ + s1ap/S1AP_CompletedCellinEAI.h \ + s1ap/S1AP_CompletedCellinEAI-Item.h \ + s1ap/S1AP_ECGI-List.h \ + s1ap/S1AP_EmergencyAreaIDListForRestart.h \ + s1ap/S1AP_ENB-ID.h \ + s1ap/S1AP_GERAN-Cell-ID.h \ + s1ap/S1AP_Global-ENB-ID.h \ + s1ap/S1AP_GUMMEIList.h \ + s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.h \ + s1ap/S1AP_ENB-UE-S1AP-ID.h \ + s1ap/S1AP_ENBname.h \ + s1ap/S1AP_ENBX2TLAs.h \ + s1ap/S1AP_EncryptionAlgorithms.h \ + s1ap/S1AP_EnhancedCoverageRestricted.h \ + s1ap/S1AP_EPLMNs.h \ + s1ap/S1AP_EventType.h \ + s1ap/S1AP_E-RAB-ID.h \ + s1ap/S1AP_E-RABInformationList.h \ + s1ap/S1AP_E-RABInformationListItem.h \ + s1ap/S1AP_E-RABList.h \ + s1ap/S1AP_E-RABItem.h \ + s1ap/S1AP_E-RABLevelQoSParameters.h \ + s1ap/S1AP_EUTRAN-CGI.h \ + s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.h \ + s1ap/S1AP_ExpectedUEBehaviour.h \ + s1ap/S1AP_ExpectedUEActivityBehaviour.h \ + s1ap/S1AP_ExpectedActivityPeriod.h \ + s1ap/S1AP_ExpectedIdlePeriod.h \ + s1ap/S1AP_SourceOfUEActivityBehaviourInformation.h \ + s1ap/S1AP_ExpectedHOInterval.h \ + s1ap/S1AP_ExtendedRNC-ID.h \ + s1ap/S1AP_ExtendedRepetitionPeriod.h \ + s1ap/S1AP_Extended-UEIdentityIndexValue.h \ + s1ap/S1AP_ForbiddenInterRATs.h \ + s1ap/S1AP_ForbiddenTAs.h \ + s1ap/S1AP_ForbiddenTAs-Item.h \ + s1ap/S1AP_ForbiddenTACs.h \ + s1ap/S1AP_ForbiddenLAs.h \ + s1ap/S1AP_ForbiddenLAs-Item.h \ + s1ap/S1AP_ForbiddenLACs.h \ + s1ap/S1AP_GBR-QosInformation.h \ + s1ap/S1AP_GTP-TEID.h \ + s1ap/S1AP_GUMMEI.h \ + s1ap/S1AP_GUMMEIType.h \ + s1ap/S1AP_GWContextReleaseIndication.h \ + s1ap/S1AP_HandoverRestrictionList.h \ + s1ap/S1AP_HandoverType.h \ + s1ap/S1AP_HFN.h \ + s1ap/S1AP_HFNModified.h \ + s1ap/S1AP_HFNforPDCP-SNlength18.h \ + s1ap/S1AP_Masked-IMEISV.h \ + s1ap/S1AP_ImmediateMDT.h \ + s1ap/S1AP_IMSI.h \ + s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h \ + s1ap/S1AP_IntegrityProtectionAlgorithms.h \ + s1ap/S1AP_IntendedNumberOfPagingAttempts.h \ + s1ap/S1AP_InterfacesToTrace.h \ + s1ap/S1AP_KillAllWarningMessages.h \ + s1ap/S1AP_LAC.h \ + s1ap/S1AP_LAI.h \ + s1ap/S1AP_LastVisitedCell-Item.h \ + s1ap/S1AP_LastVisitedEUTRANCellInformation.h \ + s1ap/S1AP_LastVisitedUTRANCellInformation.h \ + s1ap/S1AP_LastVisitedGERANCellInformation.h \ + s1ap/S1AP_L3-Information.h \ + s1ap/S1AP_LPPa-PDU.h \ + s1ap/S1AP_LHN-ID.h \ + s1ap/S1AP_Links-to-log.h \ + s1ap/S1AP_ListeningSubframePattern.h \ + s1ap/S1AP_LoggedMDT.h \ + s1ap/S1AP_LoggingInterval.h \ + s1ap/S1AP_LoggingDuration.h \ + s1ap/S1AP_LoggedMBSFNMDT.h \ + s1ap/S1AP_M3Configuration.h \ + s1ap/S1AP_M3period.h \ + s1ap/S1AP_M4Configuration.h \ + s1ap/S1AP_M4period.h \ + s1ap/S1AP_M5Configuration.h \ + s1ap/S1AP_M5period.h \ + s1ap/S1AP_M6Configuration.h \ + s1ap/S1AP_M6report-Interval.h \ + s1ap/S1AP_M6delay-threshold.h \ + s1ap/S1AP_M7Configuration.h \ + s1ap/S1AP_M7period.h \ + s1ap/S1AP_MDT-Activation.h \ + s1ap/S1AP_MDT-Location-Info.h \ + s1ap/S1AP_MDT-Configuration.h \ + s1ap/S1AP_ManagementBasedMDTAllowed.h \ + s1ap/S1AP_MBSFN-ResultToLog.h \ + s1ap/S1AP_MBSFN-ResultToLogInfo.h \ + s1ap/S1AP_MDTPLMNList.h \ + s1ap/S1AP_PrivacyIndicator.h \ + s1ap/S1AP_MDTMode.h \ + s1ap/S1AP_MDTMode-Extension.h \ + s1ap/S1AP_MeasurementsToActivate.h \ + s1ap/S1AP_MeasurementThresholdA2.h \ + s1ap/S1AP_MessageIdentifier.h \ + s1ap/S1AP_MobilityInformation.h \ + s1ap/S1AP_MMEname.h \ + s1ap/S1AP_MMEPagingTarget.h \ + s1ap/S1AP_MMERelaySupportIndicator.h \ + s1ap/S1AP_MME-Group-ID.h \ + s1ap/S1AP_MME-Code.h \ + s1ap/S1AP_MME-UE-S1AP-ID.h \ + s1ap/S1AP_M-TMSI.h \ + s1ap/S1AP_MSClassmark2.h \ + s1ap/S1AP_MSClassmark3.h \ + s1ap/S1AP_MutingAvailabilityIndication.h \ + s1ap/S1AP_MutingPatternInformation.h \ + s1ap/S1AP_NAS-PDU.h \ + s1ap/S1AP_NASSecurityParametersfromE-UTRAN.h \ + s1ap/S1AP_NASSecurityParameterstoE-UTRAN.h \ + s1ap/S1AP_NB-IoT-DefaultPagingDRX.h \ + s1ap/S1AP_NB-IoT-Paging-eDRXInformation.h \ + s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.h \ + s1ap/S1AP_NB-IoT-PagingTimeWindow.h \ + s1ap/S1AP_NB-IoT-UEIdentityIndexValue.h \ + s1ap/S1AP_NextPagingAreaScope.h \ + s1ap/S1AP_NumberofBroadcastRequest.h \ + s1ap/S1AP_NumberOfBroadcasts.h \ + s1ap/S1AP_OldBSS-ToNewBSS-Information.h \ + s1ap/S1AP_OverloadAction.h \ + s1ap/S1AP_OverloadResponse.h \ + s1ap/S1AP_PagingAttemptInformation.h \ + s1ap/S1AP_PagingAttemptCount.h \ + s1ap/S1AP_Paging-eDRXInformation.h \ + s1ap/S1AP_Paging-eDRX-Cycle.h \ + s1ap/S1AP_PagingTimeWindow.h \ + s1ap/S1AP_PagingDRX.h \ + s1ap/S1AP_PagingPriority.h \ + s1ap/S1AP_PDCP-SN.h \ + s1ap/S1AP_PDCP-SNExtended.h \ + s1ap/S1AP_PDCP-SNlength18.h \ + s1ap/S1AP_M1PeriodicReporting.h \ + s1ap/S1AP_PLMNidentity.h \ + s1ap/S1AP_Port-Number.h \ + s1ap/S1AP_Pre-emptionCapability.h \ + s1ap/S1AP_Pre-emptionVulnerability.h \ + s1ap/S1AP_PriorityLevel.h \ + s1ap/S1AP_ProSeAuthorized.h \ + s1ap/S1AP_ProSeDirectDiscovery.h \ + s1ap/S1AP_ProSeUEtoNetworkRelaying.h \ + s1ap/S1AP_ProSeDirectCommunication.h \ + s1ap/S1AP_PS-ServiceNotAvailable.h \ + s1ap/S1AP_QCI.h \ + s1ap/S1AP_ReceiveStatusofULPDCPSDUs.h \ + s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h \ + s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h \ + s1ap/S1AP_RecommendedCellsForPaging.h \ + s1ap/S1AP_RecommendedCellList.h \ + s1ap/S1AP_RecommendedCellItem.h \ + s1ap/S1AP_RecommendedENBsForPaging.h \ + s1ap/S1AP_RecommendedENBList.h \ + s1ap/S1AP_RecommendedENBItem.h \ + s1ap/S1AP_RelativeMMECapacity.h \ + s1ap/S1AP_RelayNode-Indicator.h \ + s1ap/S1AP_RAC.h \ + s1ap/S1AP_RAT-Type.h \ + s1ap/S1AP_ReportAmountMDT.h \ + s1ap/S1AP_ReportIntervalMDT.h \ + s1ap/S1AP_M1ReportingTrigger.h \ + s1ap/S1AP_RequestType.h \ + s1ap/S1AP_RIMTransfer.h \ + s1ap/S1AP_RIMInformation.h \ + s1ap/S1AP_RIMRoutingAddress.h \ + s1ap/S1AP_ReportArea.h \ + s1ap/S1AP_RepetitionPeriod.h \ + s1ap/S1AP_RLFReportInformation.h \ + s1ap/S1AP_RNC-ID.h \ + s1ap/S1AP_RRC-Container.h \ + s1ap/S1AP_RRC-Establishment-Cause.h \ + s1ap/S1AP_ECGIListForRestart.h \ + s1ap/S1AP_Routing-ID.h \ + s1ap/S1AP_SecurityKey.h \ + s1ap/S1AP_SecurityContext.h \ + s1ap/S1AP_SerialNumber.h \ + s1ap/S1AP_SONInformation.h \ + s1ap/S1AP_SONInformation-Extension.h \ + s1ap/S1AP_SONInformationRequest.h \ + s1ap/S1AP_SONInformationReply.h \ + s1ap/S1AP_SONInformationReport.h \ + s1ap/S1AP_SONConfigurationTransfer.h \ + s1ap/S1AP_SynchronisationInformation.h \ + s1ap/S1AP_Source-ToTarget-TransparentContainer.h \ + s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h \ + s1ap/S1AP_SourceeNB-ID.h \ + s1ap/S1AP_SRVCCOperationNotPossible.h \ + s1ap/S1AP_SRVCCOperationPossible.h \ + s1ap/S1AP_SRVCCHOIndication.h \ + s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h \ + s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h \ + s1ap/S1AP_ServedGUMMEIs.h \ + s1ap/S1AP_ServedGUMMEIsItem.h \ + s1ap/S1AP_ServedGroupIDs.h \ + s1ap/S1AP_ServedMMECs.h \ + s1ap/S1AP_ServedPLMNs.h \ + s1ap/S1AP_SubscriberProfileIDforRFP.h \ + s1ap/S1AP_SupportedTAs.h \ + s1ap/S1AP_SupportedTAs-Item.h \ + s1ap/S1AP_StratumLevel.h \ + s1ap/S1AP_SynchronisationStatus.h \ + s1ap/S1AP_TimeSynchronisationInfo.h \ + s1ap/S1AP_S-TMSI.h \ + s1ap/S1AP_TAC.h \ + s1ap/S1AP_TAIBasedMDT.h \ + s1ap/S1AP_TAIListforMDT.h \ + s1ap/S1AP_TAIListforWarning.h \ + s1ap/S1AP_TAI.h \ + s1ap/S1AP_TAI-Broadcast.h \ + s1ap/S1AP_TAI-Broadcast-Item.h \ + s1ap/S1AP_TAI-Cancelled.h \ + s1ap/S1AP_TAI-Cancelled-Item.h \ + s1ap/S1AP_TABasedMDT.h \ + s1ap/S1AP_TAListforMDT.h \ + s1ap/S1AP_CompletedCellinTAI.h \ + s1ap/S1AP_CompletedCellinTAI-Item.h \ + s1ap/S1AP_TBCD-STRING.h \ + s1ap/S1AP_TargetID.h \ + s1ap/S1AP_TargeteNB-ID.h \ + s1ap/S1AP_TargetRNC-ID.h \ + s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h \ + s1ap/S1AP_Target-ToSource-TransparentContainer.h \ + s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h \ + s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h \ + s1ap/S1AP_M1ThresholdEventA2.h \ + s1ap/S1AP_Threshold-RSRP.h \ + s1ap/S1AP_Threshold-RSRQ.h \ + s1ap/S1AP_TimeToWait.h \ + s1ap/S1AP_Time-UE-StayedInCell.h \ + s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h \ + s1ap/S1AP_TransportInformation.h \ + s1ap/S1AP_TransportLayerAddress.h \ + s1ap/S1AP_TraceActivation.h \ + s1ap/S1AP_TraceDepth.h \ + s1ap/S1AP_E-UTRAN-Trace-ID.h \ + s1ap/S1AP_TrafficLoadReductionIndication.h \ + s1ap/S1AP_TunnelInformation.h \ + s1ap/S1AP_TypeOfError.h \ + s1ap/S1AP_TAIListForRestart.h \ + s1ap/S1AP_UEAggregateMaximumBitrate.h \ + s1ap/S1AP_UE-RetentionInformation.h \ + s1ap/S1AP_UE-S1AP-IDs.h \ + s1ap/S1AP_UE-S1AP-ID-pair.h \ + s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.h \ + s1ap/S1AP_UEIdentityIndexValue.h \ + s1ap/S1AP_UE-HistoryInformation.h \ + s1ap/S1AP_UE-HistoryInformationFromTheUE.h \ + s1ap/S1AP_UEPagingID.h \ + s1ap/S1AP_UERadioCapability.h \ + s1ap/S1AP_UERadioCapabilityForPaging.h \ + s1ap/S1AP_UE-RLF-Report-Container.h \ + s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.h \ + s1ap/S1AP_UESecurityCapabilities.h \ + s1ap/S1AP_UESidelinkAggregateMaximumBitrate.h \ + s1ap/S1AP_UE-Usage-Type.h \ + s1ap/S1AP_UL-CP-SecurityInformation.h \ + s1ap/S1AP_UL-NAS-MAC.h \ + s1ap/S1AP_UL-NAS-Count.h \ + s1ap/S1AP_UserLocationInformation.h \ + s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.h \ + s1ap/S1AP_VoiceSupportMatchIndicator.h \ + s1ap/S1AP_V2XServicesAuthorized.h \ + s1ap/S1AP_VehicleUE.h \ + s1ap/S1AP_PedestrianUE.h \ + s1ap/S1AP_WarningAreaList.h \ + s1ap/S1AP_WarningType.h \ + s1ap/S1AP_WarningSecurityInfo.h \ + s1ap/S1AP_WarningMessageContents.h \ + s1ap/S1AP_X2TNLConfigurationInfo.h \ + s1ap/S1AP_ENBX2ExtTLAs.h \ + s1ap/S1AP_ENBX2ExtTLA.h \ + s1ap/S1AP_ENBX2GTPTLAs.h \ + s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.h \ + s1ap/S1AP_Criticality.h \ + s1ap/S1AP_Presence.h \ + s1ap/S1AP_PrivateIE-ID.h \ + s1ap/S1AP_ProcedureCode.h \ + s1ap/S1AP_ProtocolExtensionID.h \ + s1ap/S1AP_ProtocolIE-ID.h \ + s1ap/S1AP_TriggeringMessage.h \ + s1ap/S1AP_ProtocolIE-Container.h \ + s1ap/S1AP_ProtocolIE-SingleContainer.h \ + s1ap/S1AP_ProtocolIE-Field.h \ + s1ap/S1AP_ProtocolIE-ContainerPair.h \ + s1ap/S1AP_ProtocolIE-FieldPair.h \ + s1ap/S1AP_ProtocolIE-ContainerList.h \ + s1ap/S1AP_ProtocolIE-ContainerPairList.h \ + s1ap/S1AP_ProtocolExtensionContainer.h \ + s1ap/S1AP_ProtocolExtensionField.h \ + s1ap/S1AP_PrivateIE-Container.h \ + s1ap/S1AP_PrivateIE-Field.h + +ASN_MODULE_HDRS+=s1ap/S1AP_asn_constant.h + +ASN_MODULE_HDRS+=common/ANY.h +ASN_MODULE_SRCS+=common/ANY.c +ASN_MODULE_HDRS+=common/OCTET_STRING.h +ASN_MODULE_HDRS+=common/OPEN_TYPE.h +ASN_MODULE_SRCS+=common/OPEN_TYPE.c +ASN_MODULE_HDRS+=common/constr_CHOICE.h +ASN_MODULE_HDRS+=common/BOOLEAN.h +ASN_MODULE_SRCS+=common/BOOLEAN.c +ASN_MODULE_HDRS+=common/INTEGER.h +ASN_MODULE_SRCS+=common/INTEGER.c +ASN_MODULE_HDRS+=common/NULL.h +ASN_MODULE_SRCS+=common/NULL.c +ASN_MODULE_HDRS+=common/NativeEnumerated.h +ASN_MODULE_SRCS+=common/NativeEnumerated.c +ASN_MODULE_HDRS+=common/NativeInteger.h +ASN_MODULE_SRCS+=common/NativeInteger.c +ASN_MODULE_HDRS+=common/OBJECT_IDENTIFIER.h +ASN_MODULE_SRCS+=common/OBJECT_IDENTIFIER.c +ASN_MODULE_HDRS+=common/PrintableString.h +ASN_MODULE_SRCS+=common/PrintableString.c +ASN_MODULE_HDRS+=common/asn_SEQUENCE_OF.h +ASN_MODULE_SRCS+=common/asn_SEQUENCE_OF.c +ASN_MODULE_HDRS+=common/asn_SET_OF.h +ASN_MODULE_SRCS+=common/asn_SET_OF.c +ASN_MODULE_SRCS+=common/constr_CHOICE.c +ASN_MODULE_HDRS+=common/constr_SEQUENCE.h +ASN_MODULE_SRCS+=common/constr_SEQUENCE.c +ASN_MODULE_HDRS+=common/constr_SEQUENCE_OF.h +ASN_MODULE_SRCS+=common/constr_SEQUENCE_OF.c +ASN_MODULE_HDRS+=common/constr_SET_OF.h +ASN_MODULE_SRCS+=common/constr_SET_OF.c +ASN_MODULE_HDRS+=common/asn_application.h +ASN_MODULE_SRCS+=common/asn_application.c +ASN_MODULE_HDRS+=common/asn_ioc.h +ASN_MODULE_HDRS+=common/asn_system.h +ASN_MODULE_HDRS+=common/asn_codecs.h +ASN_MODULE_HDRS+=common/asn_internal.h +ASN_MODULE_SRCS+=common/asn_internal.c +ASN_MODULE_HDRS+=common/asn_random_fill.h +ASN_MODULE_SRCS+=common/asn_random_fill.c +ASN_MODULE_HDRS+=common/asn_bit_data.h +ASN_MODULE_SRCS+=common/asn_bit_data.c +ASN_MODULE_SRCS+=common/OCTET_STRING.c +ASN_MODULE_HDRS+=common/BIT_STRING.h +ASN_MODULE_SRCS+=common/BIT_STRING.c +ASN_MODULE_SRCS+=common/asn_codecs_prim.c +ASN_MODULE_HDRS+=common/asn_codecs_prim.h +ASN_MODULE_HDRS+=common/ber_tlv_length.h +ASN_MODULE_SRCS+=common/ber_tlv_length.c +ASN_MODULE_HDRS+=common/ber_tlv_tag.h +ASN_MODULE_SRCS+=common/ber_tlv_tag.c +ASN_MODULE_HDRS+=common/ber_decoder.h +ASN_MODULE_SRCS+=common/ber_decoder.c +ASN_MODULE_HDRS+=common/der_encoder.h +ASN_MODULE_SRCS+=common/der_encoder.c +ASN_MODULE_HDRS+=common/constr_TYPE.h +ASN_MODULE_SRCS+=common/constr_TYPE.c +ASN_MODULE_HDRS+=common/constraints.h +ASN_MODULE_SRCS+=common/constraints.c +ASN_MODULE_HDRS+=common/xer_support.h +ASN_MODULE_SRCS+=common/xer_support.c +ASN_MODULE_HDRS+=common/xer_decoder.h +ASN_MODULE_SRCS+=common/xer_decoder.c +ASN_MODULE_HDRS+=common/xer_encoder.h +ASN_MODULE_SRCS+=common/xer_encoder.c +ASN_MODULE_HDRS+=common/per_support.h +ASN_MODULE_SRCS+=common/per_support.c +ASN_MODULE_HDRS+=common/per_decoder.h +ASN_MODULE_SRCS+=common/per_decoder.c +ASN_MODULE_HDRS+=common/per_encoder.h +ASN_MODULE_SRCS+=common/per_encoder.c +ASN_MODULE_HDRS+=common/per_opentype.h +ASN_MODULE_SRCS+=common/per_opentype.c +ASN_MODULE_HDRS+=common/oer_decoder.h +ASN_MODULE_HDRS+=common/oer_encoder.h +ASN_MODULE_HDRS+=common/oer_support.h +ASN_MODULE_SRCS+=common/oer_decoder.c +ASN_MODULE_SRCS+=common/oer_encoder.c +ASN_MODULE_SRCS+=common/oer_support.c +ASN_MODULE_SRCS+=common/OPEN_TYPE_oer.c +ASN_MODULE_SRCS+=common/INTEGER_oer.c +ASN_MODULE_SRCS+=common/BIT_STRING_oer.c +ASN_MODULE_SRCS+=common/OCTET_STRING_oer.c +ASN_MODULE_SRCS+=common/NativeInteger_oer.c +ASN_MODULE_SRCS+=common/NativeEnumerated_oer.c +ASN_MODULE_SRCS+=common/constr_CHOICE_oer.c +ASN_MODULE_SRCS+=common/constr_SEQUENCE_oer.c +ASN_MODULE_SRCS+=common/constr_SET_OF_oer.c + +ASN_MODULE_CFLAGS= + +pkglib_LTLIBRARIES=libasn1c.la +libasn1c_la_SOURCES= \ + $(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS) \ + s1ap_asn1c.h s1ap_message.h \ + s1ap_decoder.c s1ap_encoder.c s1ap_free.c \ + $(NULL) + +libasn1c_la_DEPENDENCIES = \ + @OGSCORE_LIBS@ \ + $(top_srcdir)/lib/base/libbase.la \ + $(NULL) + +libasn1c_la_LIBADD = \ + @OGSCORE_LIBS@ \ + $(top_srcdir)/lib/base/libbase.la \ + $(NULL) + +AM_CPPFLAGS = \ + @OGSCORE_CFLAGS@ \ + -I$(top_srcdir)/lib/asn1c/common \ + -I$(top_srcdir)/lib/asn1c/s1ap \ + -I$(top_srcdir)/lib \ + $(NULL) + +AM_CFLAGS = \ + ${ASN_MODULE_CFLAGS} \ + -Wno-parentheses-equality -Wno-overflow -Wno-format \ + $(NULL) + +regen: regenerate-from-asn1-source + +regenerate-from-asn1-source: + ASN1C_PREFIX=S1AP_ ../../../../asn1c.velichkov/asn1c/asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps ../support/r14.4.0/36413-e40.asn + rm -f S1AP_E-RAB-IE-ContainerPairList.c S1AP_ProtocolError-IE-ContainerList.c S1AP_ProtocolIE-ContainerPair.c S1AP_ProtocolIE-FieldPair.c S1AP_ProtocolIE-ContainerPairList.c + rm -f converter-example.mk converter-example.c pdu_collection.c + rm -f Makefile.am.asn1convert Makefile.am.libasncodec + diff --git a/lib/s1ap/asn1c/ANY.c b/lib/asn1c/common/ANY.c similarity index 100% rename from lib/s1ap/asn1c/ANY.c rename to lib/asn1c/common/ANY.c diff --git a/lib/s1ap/asn1c/ANY.h b/lib/asn1c/common/ANY.h similarity index 100% rename from lib/s1ap/asn1c/ANY.h rename to lib/asn1c/common/ANY.h diff --git a/lib/s1ap/asn1c/BIT_STRING.c b/lib/asn1c/common/BIT_STRING.c similarity index 100% rename from lib/s1ap/asn1c/BIT_STRING.c rename to lib/asn1c/common/BIT_STRING.c diff --git a/lib/s1ap/asn1c/BIT_STRING.h b/lib/asn1c/common/BIT_STRING.h similarity index 100% rename from lib/s1ap/asn1c/BIT_STRING.h rename to lib/asn1c/common/BIT_STRING.h diff --git a/lib/s1ap/asn1c/BIT_STRING_oer.c b/lib/asn1c/common/BIT_STRING_oer.c similarity index 100% rename from lib/s1ap/asn1c/BIT_STRING_oer.c rename to lib/asn1c/common/BIT_STRING_oer.c diff --git a/lib/s1ap/asn1c/BOOLEAN.c b/lib/asn1c/common/BOOLEAN.c similarity index 100% rename from lib/s1ap/asn1c/BOOLEAN.c rename to lib/asn1c/common/BOOLEAN.c diff --git a/lib/s1ap/asn1c/BOOLEAN.h b/lib/asn1c/common/BOOLEAN.h similarity index 100% rename from lib/s1ap/asn1c/BOOLEAN.h rename to lib/asn1c/common/BOOLEAN.h diff --git a/lib/s1ap/asn1c/INTEGER.c b/lib/asn1c/common/INTEGER.c similarity index 100% rename from lib/s1ap/asn1c/INTEGER.c rename to lib/asn1c/common/INTEGER.c diff --git a/lib/s1ap/asn1c/INTEGER.h b/lib/asn1c/common/INTEGER.h similarity index 100% rename from lib/s1ap/asn1c/INTEGER.h rename to lib/asn1c/common/INTEGER.h diff --git a/lib/s1ap/asn1c/INTEGER_oer.c b/lib/asn1c/common/INTEGER_oer.c similarity index 100% rename from lib/s1ap/asn1c/INTEGER_oer.c rename to lib/asn1c/common/INTEGER_oer.c diff --git a/lib/s1ap/asn1c/NULL.c b/lib/asn1c/common/NULL.c similarity index 100% rename from lib/s1ap/asn1c/NULL.c rename to lib/asn1c/common/NULL.c diff --git a/lib/s1ap/asn1c/NULL.h b/lib/asn1c/common/NULL.h similarity index 100% rename from lib/s1ap/asn1c/NULL.h rename to lib/asn1c/common/NULL.h diff --git a/lib/s1ap/asn1c/NativeEnumerated.c b/lib/asn1c/common/NativeEnumerated.c similarity index 100% rename from lib/s1ap/asn1c/NativeEnumerated.c rename to lib/asn1c/common/NativeEnumerated.c diff --git a/lib/s1ap/asn1c/NativeEnumerated.h b/lib/asn1c/common/NativeEnumerated.h similarity index 100% rename from lib/s1ap/asn1c/NativeEnumerated.h rename to lib/asn1c/common/NativeEnumerated.h diff --git a/lib/s1ap/asn1c/NativeEnumerated_oer.c b/lib/asn1c/common/NativeEnumerated_oer.c similarity index 100% rename from lib/s1ap/asn1c/NativeEnumerated_oer.c rename to lib/asn1c/common/NativeEnumerated_oer.c diff --git a/lib/s1ap/asn1c/NativeInteger.c b/lib/asn1c/common/NativeInteger.c similarity index 100% rename from lib/s1ap/asn1c/NativeInteger.c rename to lib/asn1c/common/NativeInteger.c diff --git a/lib/s1ap/asn1c/NativeInteger.h b/lib/asn1c/common/NativeInteger.h similarity index 100% rename from lib/s1ap/asn1c/NativeInteger.h rename to lib/asn1c/common/NativeInteger.h diff --git a/lib/s1ap/asn1c/NativeInteger_oer.c b/lib/asn1c/common/NativeInteger_oer.c similarity index 100% rename from lib/s1ap/asn1c/NativeInteger_oer.c rename to lib/asn1c/common/NativeInteger_oer.c diff --git a/lib/s1ap/asn1c/OBJECT_IDENTIFIER.c b/lib/asn1c/common/OBJECT_IDENTIFIER.c similarity index 100% rename from lib/s1ap/asn1c/OBJECT_IDENTIFIER.c rename to lib/asn1c/common/OBJECT_IDENTIFIER.c diff --git a/lib/s1ap/asn1c/OBJECT_IDENTIFIER.h b/lib/asn1c/common/OBJECT_IDENTIFIER.h similarity index 100% rename from lib/s1ap/asn1c/OBJECT_IDENTIFIER.h rename to lib/asn1c/common/OBJECT_IDENTIFIER.h diff --git a/lib/s1ap/asn1c/OCTET_STRING.c b/lib/asn1c/common/OCTET_STRING.c similarity index 100% rename from lib/s1ap/asn1c/OCTET_STRING.c rename to lib/asn1c/common/OCTET_STRING.c diff --git a/lib/s1ap/asn1c/OCTET_STRING.h b/lib/asn1c/common/OCTET_STRING.h similarity index 100% rename from lib/s1ap/asn1c/OCTET_STRING.h rename to lib/asn1c/common/OCTET_STRING.h diff --git a/lib/s1ap/asn1c/OCTET_STRING_oer.c b/lib/asn1c/common/OCTET_STRING_oer.c similarity index 100% rename from lib/s1ap/asn1c/OCTET_STRING_oer.c rename to lib/asn1c/common/OCTET_STRING_oer.c diff --git a/lib/s1ap/asn1c/OPEN_TYPE.c b/lib/asn1c/common/OPEN_TYPE.c similarity index 100% rename from lib/s1ap/asn1c/OPEN_TYPE.c rename to lib/asn1c/common/OPEN_TYPE.c diff --git a/lib/s1ap/asn1c/OPEN_TYPE.h b/lib/asn1c/common/OPEN_TYPE.h similarity index 100% rename from lib/s1ap/asn1c/OPEN_TYPE.h rename to lib/asn1c/common/OPEN_TYPE.h diff --git a/lib/s1ap/asn1c/OPEN_TYPE_oer.c b/lib/asn1c/common/OPEN_TYPE_oer.c similarity index 100% rename from lib/s1ap/asn1c/OPEN_TYPE_oer.c rename to lib/asn1c/common/OPEN_TYPE_oer.c diff --git a/lib/s1ap/asn1c/PrintableString.c b/lib/asn1c/common/PrintableString.c similarity index 100% rename from lib/s1ap/asn1c/PrintableString.c rename to lib/asn1c/common/PrintableString.c diff --git a/lib/s1ap/asn1c/PrintableString.h b/lib/asn1c/common/PrintableString.h similarity index 100% rename from lib/s1ap/asn1c/PrintableString.h rename to lib/asn1c/common/PrintableString.h diff --git a/lib/s1ap/asn1c/asn_SEQUENCE_OF.c b/lib/asn1c/common/asn_SEQUENCE_OF.c similarity index 100% rename from lib/s1ap/asn1c/asn_SEQUENCE_OF.c rename to lib/asn1c/common/asn_SEQUENCE_OF.c diff --git a/lib/s1ap/asn1c/asn_SEQUENCE_OF.h b/lib/asn1c/common/asn_SEQUENCE_OF.h similarity index 100% rename from lib/s1ap/asn1c/asn_SEQUENCE_OF.h rename to lib/asn1c/common/asn_SEQUENCE_OF.h diff --git a/lib/s1ap/asn1c/asn_SET_OF.c b/lib/asn1c/common/asn_SET_OF.c similarity index 100% rename from lib/s1ap/asn1c/asn_SET_OF.c rename to lib/asn1c/common/asn_SET_OF.c diff --git a/lib/s1ap/asn1c/asn_SET_OF.h b/lib/asn1c/common/asn_SET_OF.h similarity index 100% rename from lib/s1ap/asn1c/asn_SET_OF.h rename to lib/asn1c/common/asn_SET_OF.h diff --git a/lib/s1ap/asn1c/asn_application.c b/lib/asn1c/common/asn_application.c similarity index 100% rename from lib/s1ap/asn1c/asn_application.c rename to lib/asn1c/common/asn_application.c diff --git a/lib/s1ap/asn1c/asn_application.h b/lib/asn1c/common/asn_application.h similarity index 100% rename from lib/s1ap/asn1c/asn_application.h rename to lib/asn1c/common/asn_application.h diff --git a/lib/s1ap/asn1c/asn_bit_data.c b/lib/asn1c/common/asn_bit_data.c similarity index 100% rename from lib/s1ap/asn1c/asn_bit_data.c rename to lib/asn1c/common/asn_bit_data.c diff --git a/lib/s1ap/asn1c/asn_bit_data.h b/lib/asn1c/common/asn_bit_data.h similarity index 100% rename from lib/s1ap/asn1c/asn_bit_data.h rename to lib/asn1c/common/asn_bit_data.h diff --git a/lib/s1ap/asn1c/asn_codecs.h b/lib/asn1c/common/asn_codecs.h similarity index 100% rename from lib/s1ap/asn1c/asn_codecs.h rename to lib/asn1c/common/asn_codecs.h diff --git a/lib/s1ap/asn1c/asn_codecs_prim.c b/lib/asn1c/common/asn_codecs_prim.c similarity index 100% rename from lib/s1ap/asn1c/asn_codecs_prim.c rename to lib/asn1c/common/asn_codecs_prim.c diff --git a/lib/s1ap/asn1c/asn_codecs_prim.h b/lib/asn1c/common/asn_codecs_prim.h similarity index 100% rename from lib/s1ap/asn1c/asn_codecs_prim.h rename to lib/asn1c/common/asn_codecs_prim.h diff --git a/lib/s1ap/asn1c/asn_internal.c b/lib/asn1c/common/asn_internal.c similarity index 100% rename from lib/s1ap/asn1c/asn_internal.c rename to lib/asn1c/common/asn_internal.c diff --git a/lib/s1ap/asn1c/asn_internal.h b/lib/asn1c/common/asn_internal.h similarity index 93% rename from lib/s1ap/asn1c/asn_internal.h rename to lib/asn1c/common/asn_internal.h index cfb8fa94b..77e005f79 100644 --- a/lib/s1ap/asn1c/asn_internal.h +++ b/lib/asn1c/common/asn_internal.h @@ -29,11 +29,14 @@ int get_asn1c_environment_version(void); /* Run-time version */ #define REALLOC(oldptr, size) realloc(oldptr, size) #define FREEMEM(ptr) free(ptr) #else -#include "core_pkbuf.h" -#define CALLOC(nmemb, size) core_calloc(nmemb, size) -#define MALLOC(size) core_malloc(size) -#define REALLOC(oldptr, size) core_realloc(oldptr, size) -#define FREEMEM(ptr) CORE_FREE(ptr) +extern void *ogs_malloc(size_t size); +extern void ogs_free(void *ptr); +extern void *ogs_calloc(size_t nmemb, size_t size); +extern void *ogs_realloc(void *ptr, size_t size); +#define CALLOC(nmemb, size) ogs_calloc(nmemb, size) +#define MALLOC(size) ogs_malloc(size) +#define REALLOC(oldptr, size) ogs_realloc(oldptr, size) +#define FREEMEM(ptr) ogs_free(ptr) #endif #define asn_debug_indent 0 diff --git a/lib/s1ap/asn1c/asn_ioc.h b/lib/asn1c/common/asn_ioc.h similarity index 100% rename from lib/s1ap/asn1c/asn_ioc.h rename to lib/asn1c/common/asn_ioc.h diff --git a/lib/s1ap/asn1c/asn_random_fill.c b/lib/asn1c/common/asn_random_fill.c similarity index 100% rename from lib/s1ap/asn1c/asn_random_fill.c rename to lib/asn1c/common/asn_random_fill.c diff --git a/lib/s1ap/asn1c/asn_random_fill.h b/lib/asn1c/common/asn_random_fill.h similarity index 100% rename from lib/s1ap/asn1c/asn_random_fill.h rename to lib/asn1c/common/asn_random_fill.h diff --git a/lib/s1ap/asn1c/asn_system.h b/lib/asn1c/common/asn_system.h similarity index 98% rename from lib/s1ap/asn1c/asn_system.h rename to lib/asn1c/common/asn_system.h index fa8cf1165..2bc5493b6 100644 --- a/lib/s1ap/asn1c/asn_system.h +++ b/lib/asn1c/common/asn_system.h @@ -9,7 +9,11 @@ #define ASN_SYSTEM_H #ifdef HAVE_CONFIG_H +#if 0 /* modified by acetcom */ #include "config.h" +#else +#include "base/base.h" +#endif #endif #ifndef _DEFAULT_SOURCE diff --git a/lib/s1ap/asn1c/ber_decoder.c b/lib/asn1c/common/ber_decoder.c similarity index 100% rename from lib/s1ap/asn1c/ber_decoder.c rename to lib/asn1c/common/ber_decoder.c diff --git a/lib/s1ap/asn1c/ber_decoder.h b/lib/asn1c/common/ber_decoder.h similarity index 100% rename from lib/s1ap/asn1c/ber_decoder.h rename to lib/asn1c/common/ber_decoder.h diff --git a/lib/s1ap/asn1c/ber_tlv_length.c b/lib/asn1c/common/ber_tlv_length.c similarity index 100% rename from lib/s1ap/asn1c/ber_tlv_length.c rename to lib/asn1c/common/ber_tlv_length.c diff --git a/lib/s1ap/asn1c/ber_tlv_length.h b/lib/asn1c/common/ber_tlv_length.h similarity index 100% rename from lib/s1ap/asn1c/ber_tlv_length.h rename to lib/asn1c/common/ber_tlv_length.h diff --git a/lib/s1ap/asn1c/ber_tlv_tag.c b/lib/asn1c/common/ber_tlv_tag.c similarity index 100% rename from lib/s1ap/asn1c/ber_tlv_tag.c rename to lib/asn1c/common/ber_tlv_tag.c diff --git a/lib/s1ap/asn1c/ber_tlv_tag.h b/lib/asn1c/common/ber_tlv_tag.h similarity index 100% rename from lib/s1ap/asn1c/ber_tlv_tag.h rename to lib/asn1c/common/ber_tlv_tag.h diff --git a/lib/s1ap/asn1c/constr_CHOICE.c b/lib/asn1c/common/constr_CHOICE.c similarity index 100% rename from lib/s1ap/asn1c/constr_CHOICE.c rename to lib/asn1c/common/constr_CHOICE.c diff --git a/lib/s1ap/asn1c/constr_CHOICE.h b/lib/asn1c/common/constr_CHOICE.h similarity index 100% rename from lib/s1ap/asn1c/constr_CHOICE.h rename to lib/asn1c/common/constr_CHOICE.h diff --git a/lib/s1ap/asn1c/constr_CHOICE_oer.c b/lib/asn1c/common/constr_CHOICE_oer.c similarity index 100% rename from lib/s1ap/asn1c/constr_CHOICE_oer.c rename to lib/asn1c/common/constr_CHOICE_oer.c diff --git a/lib/s1ap/asn1c/constr_SEQUENCE.c b/lib/asn1c/common/constr_SEQUENCE.c similarity index 100% rename from lib/s1ap/asn1c/constr_SEQUENCE.c rename to lib/asn1c/common/constr_SEQUENCE.c diff --git a/lib/s1ap/asn1c/constr_SEQUENCE.h b/lib/asn1c/common/constr_SEQUENCE.h similarity index 100% rename from lib/s1ap/asn1c/constr_SEQUENCE.h rename to lib/asn1c/common/constr_SEQUENCE.h diff --git a/lib/s1ap/asn1c/constr_SEQUENCE_OF.c b/lib/asn1c/common/constr_SEQUENCE_OF.c similarity index 100% rename from lib/s1ap/asn1c/constr_SEQUENCE_OF.c rename to lib/asn1c/common/constr_SEQUENCE_OF.c diff --git a/lib/s1ap/asn1c/constr_SEQUENCE_OF.h b/lib/asn1c/common/constr_SEQUENCE_OF.h similarity index 100% rename from lib/s1ap/asn1c/constr_SEQUENCE_OF.h rename to lib/asn1c/common/constr_SEQUENCE_OF.h diff --git a/lib/s1ap/asn1c/constr_SEQUENCE_oer.c b/lib/asn1c/common/constr_SEQUENCE_oer.c similarity index 100% rename from lib/s1ap/asn1c/constr_SEQUENCE_oer.c rename to lib/asn1c/common/constr_SEQUENCE_oer.c diff --git a/lib/s1ap/asn1c/constr_SET_OF.c b/lib/asn1c/common/constr_SET_OF.c similarity index 100% rename from lib/s1ap/asn1c/constr_SET_OF.c rename to lib/asn1c/common/constr_SET_OF.c diff --git a/lib/s1ap/asn1c/constr_SET_OF.h b/lib/asn1c/common/constr_SET_OF.h similarity index 100% rename from lib/s1ap/asn1c/constr_SET_OF.h rename to lib/asn1c/common/constr_SET_OF.h diff --git a/lib/s1ap/asn1c/constr_SET_OF_oer.c b/lib/asn1c/common/constr_SET_OF_oer.c similarity index 100% rename from lib/s1ap/asn1c/constr_SET_OF_oer.c rename to lib/asn1c/common/constr_SET_OF_oer.c diff --git a/lib/s1ap/asn1c/constr_TYPE.c b/lib/asn1c/common/constr_TYPE.c similarity index 100% rename from lib/s1ap/asn1c/constr_TYPE.c rename to lib/asn1c/common/constr_TYPE.c diff --git a/lib/s1ap/asn1c/constr_TYPE.h b/lib/asn1c/common/constr_TYPE.h similarity index 99% rename from lib/s1ap/asn1c/constr_TYPE.h rename to lib/asn1c/common/constr_TYPE.h index d52cf6b0b..d80dea5a3 100644 --- a/lib/s1ap/asn1c/constr_TYPE.h +++ b/lib/asn1c/common/constr_TYPE.h @@ -44,8 +44,8 @@ typedef struct asn_struct_ctx_s { #include /* Random structures support */ #ifdef ASN_DISABLE_OER_SUPPORT -typedef void (oer_type_decoder_f)(); -typedef void (oer_type_encoder_f)(); +typedef void (oer_type_decoder_f)(void); +typedef void (oer_type_encoder_f)(void); typedef void asn_oer_constraints_t; #else #include /* Octet Encoding Rules encoder */ diff --git a/lib/s1ap/asn1c/constraints.c b/lib/asn1c/common/constraints.c similarity index 100% rename from lib/s1ap/asn1c/constraints.c rename to lib/asn1c/common/constraints.c diff --git a/lib/s1ap/asn1c/constraints.h b/lib/asn1c/common/constraints.h similarity index 100% rename from lib/s1ap/asn1c/constraints.h rename to lib/asn1c/common/constraints.h diff --git a/lib/s1ap/asn1c/der_encoder.c b/lib/asn1c/common/der_encoder.c similarity index 100% rename from lib/s1ap/asn1c/der_encoder.c rename to lib/asn1c/common/der_encoder.c diff --git a/lib/s1ap/asn1c/der_encoder.h b/lib/asn1c/common/der_encoder.h similarity index 100% rename from lib/s1ap/asn1c/der_encoder.h rename to lib/asn1c/common/der_encoder.h diff --git a/lib/s1ap/asn1c/oer_decoder.c b/lib/asn1c/common/oer_decoder.c similarity index 100% rename from lib/s1ap/asn1c/oer_decoder.c rename to lib/asn1c/common/oer_decoder.c diff --git a/lib/s1ap/asn1c/oer_decoder.h b/lib/asn1c/common/oer_decoder.h similarity index 100% rename from lib/s1ap/asn1c/oer_decoder.h rename to lib/asn1c/common/oer_decoder.h diff --git a/lib/s1ap/asn1c/oer_encoder.c b/lib/asn1c/common/oer_encoder.c similarity index 100% rename from lib/s1ap/asn1c/oer_encoder.c rename to lib/asn1c/common/oer_encoder.c diff --git a/lib/s1ap/asn1c/oer_encoder.h b/lib/asn1c/common/oer_encoder.h similarity index 100% rename from lib/s1ap/asn1c/oer_encoder.h rename to lib/asn1c/common/oer_encoder.h diff --git a/lib/s1ap/asn1c/oer_support.c b/lib/asn1c/common/oer_support.c similarity index 100% rename from lib/s1ap/asn1c/oer_support.c rename to lib/asn1c/common/oer_support.c diff --git a/lib/s1ap/asn1c/oer_support.h b/lib/asn1c/common/oer_support.h similarity index 100% rename from lib/s1ap/asn1c/oer_support.h rename to lib/asn1c/common/oer_support.h diff --git a/lib/s1ap/asn1c/per_decoder.c b/lib/asn1c/common/per_decoder.c similarity index 100% rename from lib/s1ap/asn1c/per_decoder.c rename to lib/asn1c/common/per_decoder.c diff --git a/lib/s1ap/asn1c/per_decoder.h b/lib/asn1c/common/per_decoder.h similarity index 100% rename from lib/s1ap/asn1c/per_decoder.h rename to lib/asn1c/common/per_decoder.h diff --git a/lib/s1ap/asn1c/per_encoder.c b/lib/asn1c/common/per_encoder.c similarity index 100% rename from lib/s1ap/asn1c/per_encoder.c rename to lib/asn1c/common/per_encoder.c diff --git a/lib/s1ap/asn1c/per_encoder.h b/lib/asn1c/common/per_encoder.h similarity index 100% rename from lib/s1ap/asn1c/per_encoder.h rename to lib/asn1c/common/per_encoder.h diff --git a/lib/s1ap/asn1c/per_opentype.c b/lib/asn1c/common/per_opentype.c similarity index 100% rename from lib/s1ap/asn1c/per_opentype.c rename to lib/asn1c/common/per_opentype.c diff --git a/lib/s1ap/asn1c/per_opentype.h b/lib/asn1c/common/per_opentype.h similarity index 100% rename from lib/s1ap/asn1c/per_opentype.h rename to lib/asn1c/common/per_opentype.h diff --git a/lib/s1ap/asn1c/per_support.c b/lib/asn1c/common/per_support.c similarity index 100% rename from lib/s1ap/asn1c/per_support.c rename to lib/asn1c/common/per_support.c diff --git a/lib/s1ap/asn1c/per_support.h b/lib/asn1c/common/per_support.h similarity index 100% rename from lib/s1ap/asn1c/per_support.h rename to lib/asn1c/common/per_support.h diff --git a/lib/s1ap/asn1c/xer_decoder.c b/lib/asn1c/common/xer_decoder.c similarity index 100% rename from lib/s1ap/asn1c/xer_decoder.c rename to lib/asn1c/common/xer_decoder.c diff --git a/lib/s1ap/asn1c/xer_decoder.h b/lib/asn1c/common/xer_decoder.h similarity index 100% rename from lib/s1ap/asn1c/xer_decoder.h rename to lib/asn1c/common/xer_decoder.h diff --git a/lib/s1ap/asn1c/xer_encoder.c b/lib/asn1c/common/xer_encoder.c similarity index 100% rename from lib/s1ap/asn1c/xer_encoder.c rename to lib/asn1c/common/xer_encoder.c diff --git a/lib/s1ap/asn1c/xer_encoder.h b/lib/asn1c/common/xer_encoder.h similarity index 100% rename from lib/s1ap/asn1c/xer_encoder.h rename to lib/asn1c/common/xer_encoder.h diff --git a/lib/s1ap/asn1c/xer_support.c b/lib/asn1c/common/xer_support.c similarity index 100% rename from lib/s1ap/asn1c/xer_support.c rename to lib/asn1c/common/xer_support.c diff --git a/lib/s1ap/asn1c/xer_support.h b/lib/asn1c/common/xer_support.h similarity index 100% rename from lib/s1ap/asn1c/xer_support.h rename to lib/asn1c/common/xer_support.h diff --git a/lib/s1ap/asn1c/S1AP_Additional-GUTI.c b/lib/asn1c/s1ap/S1AP_Additional-GUTI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Additional-GUTI.c rename to lib/asn1c/s1ap/S1AP_Additional-GUTI.c index af3c1abdb..3af987116 100644 --- a/lib/s1ap/asn1c/S1AP_Additional-GUTI.c +++ b/lib/asn1c/s1ap/S1AP_Additional-GUTI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Additional-GUTI.h b/lib/asn1c/s1ap/S1AP_Additional-GUTI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Additional-GUTI.h rename to lib/asn1c/s1ap/S1AP_Additional-GUTI.h index 92ced7277..f5477226e 100644 --- a/lib/s1ap/asn1c/S1AP_Additional-GUTI.h +++ b/lib/asn1c/s1ap/S1AP_Additional-GUTI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AdditionalCSFallbackIndicator.c b/lib/asn1c/s1ap/S1AP_AdditionalCSFallbackIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_AdditionalCSFallbackIndicator.c rename to lib/asn1c/s1ap/S1AP_AdditionalCSFallbackIndicator.c index 7da80663e..da2d28a82 100644 --- a/lib/s1ap/asn1c/S1AP_AdditionalCSFallbackIndicator.c +++ b/lib/asn1c/s1ap/S1AP_AdditionalCSFallbackIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AdditionalCSFallbackIndicator.h b/lib/asn1c/s1ap/S1AP_AdditionalCSFallbackIndicator.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_AdditionalCSFallbackIndicator.h rename to lib/asn1c/s1ap/S1AP_AdditionalCSFallbackIndicator.h index a854d23a3..77d36339d 100644 --- a/lib/s1ap/asn1c/S1AP_AdditionalCSFallbackIndicator.h +++ b/lib/asn1c/s1ap/S1AP_AdditionalCSFallbackIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AllocationAndRetentionPriority.c b/lib/asn1c/s1ap/S1AP_AllocationAndRetentionPriority.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_AllocationAndRetentionPriority.c rename to lib/asn1c/s1ap/S1AP_AllocationAndRetentionPriority.c index 9ba5bb859..476dda4e7 100644 --- a/lib/s1ap/asn1c/S1AP_AllocationAndRetentionPriority.c +++ b/lib/asn1c/s1ap/S1AP_AllocationAndRetentionPriority.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AllocationAndRetentionPriority.h b/lib/asn1c/s1ap/S1AP_AllocationAndRetentionPriority.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_AllocationAndRetentionPriority.h rename to lib/asn1c/s1ap/S1AP_AllocationAndRetentionPriority.h index d607ac39d..ca2f53908 100644 --- a/lib/s1ap/asn1c/S1AP_AllocationAndRetentionPriority.h +++ b/lib/asn1c/s1ap/S1AP_AllocationAndRetentionPriority.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AreaScopeOfMDT.c b/lib/asn1c/s1ap/S1AP_AreaScopeOfMDT.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_AreaScopeOfMDT.c rename to lib/asn1c/s1ap/S1AP_AreaScopeOfMDT.c index 1fefb4ec4..2c92a71d9 100644 --- a/lib/s1ap/asn1c/S1AP_AreaScopeOfMDT.c +++ b/lib/asn1c/s1ap/S1AP_AreaScopeOfMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AreaScopeOfMDT.h b/lib/asn1c/s1ap/S1AP_AreaScopeOfMDT.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_AreaScopeOfMDT.h rename to lib/asn1c/s1ap/S1AP_AreaScopeOfMDT.h index b78cfb165..c0204511e 100644 --- a/lib/s1ap/asn1c/S1AP_AreaScopeOfMDT.h +++ b/lib/asn1c/s1ap/S1AP_AreaScopeOfMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AssistanceDataForCECapableUEs.c b/lib/asn1c/s1ap/S1AP_AssistanceDataForCECapableUEs.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_AssistanceDataForCECapableUEs.c rename to lib/asn1c/s1ap/S1AP_AssistanceDataForCECapableUEs.c index f3e0d02d6..444638a57 100644 --- a/lib/s1ap/asn1c/S1AP_AssistanceDataForCECapableUEs.c +++ b/lib/asn1c/s1ap/S1AP_AssistanceDataForCECapableUEs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AssistanceDataForCECapableUEs.h b/lib/asn1c/s1ap/S1AP_AssistanceDataForCECapableUEs.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_AssistanceDataForCECapableUEs.h rename to lib/asn1c/s1ap/S1AP_AssistanceDataForCECapableUEs.h index 2b7a793c1..8ec3cfa79 100644 --- a/lib/s1ap/asn1c/S1AP_AssistanceDataForCECapableUEs.h +++ b/lib/asn1c/s1ap/S1AP_AssistanceDataForCECapableUEs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AssistanceDataForPaging.c b/lib/asn1c/s1ap/S1AP_AssistanceDataForPaging.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_AssistanceDataForPaging.c rename to lib/asn1c/s1ap/S1AP_AssistanceDataForPaging.c index 7dc24d70a..51b9f7872 100644 --- a/lib/s1ap/asn1c/S1AP_AssistanceDataForPaging.c +++ b/lib/asn1c/s1ap/S1AP_AssistanceDataForPaging.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AssistanceDataForPaging.h b/lib/asn1c/s1ap/S1AP_AssistanceDataForPaging.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_AssistanceDataForPaging.h rename to lib/asn1c/s1ap/S1AP_AssistanceDataForPaging.h index 54cc99e45..0c4bc77af 100644 --- a/lib/s1ap/asn1c/S1AP_AssistanceDataForPaging.h +++ b/lib/asn1c/s1ap/S1AP_AssistanceDataForPaging.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AssistanceDataForRecommendedCells.c b/lib/asn1c/s1ap/S1AP_AssistanceDataForRecommendedCells.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_AssistanceDataForRecommendedCells.c rename to lib/asn1c/s1ap/S1AP_AssistanceDataForRecommendedCells.c index 2878e97a0..ff6a8f5a2 100644 --- a/lib/s1ap/asn1c/S1AP_AssistanceDataForRecommendedCells.c +++ b/lib/asn1c/s1ap/S1AP_AssistanceDataForRecommendedCells.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_AssistanceDataForRecommendedCells.h b/lib/asn1c/s1ap/S1AP_AssistanceDataForRecommendedCells.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_AssistanceDataForRecommendedCells.h rename to lib/asn1c/s1ap/S1AP_AssistanceDataForRecommendedCells.h index ef184bc06..ea83419fe 100644 --- a/lib/s1ap/asn1c/S1AP_AssistanceDataForRecommendedCells.h +++ b/lib/asn1c/s1ap/S1AP_AssistanceDataForRecommendedCells.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BPLMNs.c b/lib/asn1c/s1ap/S1AP_BPLMNs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_BPLMNs.c rename to lib/asn1c/s1ap/S1AP_BPLMNs.c index 2478d4445..f026eb386 100644 --- a/lib/s1ap/asn1c/S1AP_BPLMNs.c +++ b/lib/asn1c/s1ap/S1AP_BPLMNs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BPLMNs.h b/lib/asn1c/s1ap/S1AP_BPLMNs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_BPLMNs.h rename to lib/asn1c/s1ap/S1AP_BPLMNs.h index c084038f1..14ad12129 100644 --- a/lib/s1ap/asn1c/S1AP_BPLMNs.h +++ b/lib/asn1c/s1ap/S1AP_BPLMNs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BearerType.c b/lib/asn1c/s1ap/S1AP_BearerType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_BearerType.c rename to lib/asn1c/s1ap/S1AP_BearerType.c index 823eedcf2..a10fe580e 100644 --- a/lib/s1ap/asn1c/S1AP_BearerType.c +++ b/lib/asn1c/s1ap/S1AP_BearerType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BearerType.h b/lib/asn1c/s1ap/S1AP_BearerType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_BearerType.h rename to lib/asn1c/s1ap/S1AP_BearerType.h index 0d6b6af3e..aac5468d9 100644 --- a/lib/s1ap/asn1c/S1AP_BearerType.h +++ b/lib/asn1c/s1ap/S1AP_BearerType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransfer-Item.c b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransfer-Item.c rename to lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.c index df8a46667..d1eb7d936 100644 --- a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransfer-Item.c +++ b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransfer-Item.h b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransfer-Item.h rename to lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.h index 105358d2d..b774debae 100644 --- a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransfer-Item.h +++ b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransfer-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransferList.c b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransferList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransferList.c rename to lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransferList.c index 0fabea5f0..0d9b2cc49 100644 --- a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransferList.c +++ b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransferList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransferList.h b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransferList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransferList.h rename to lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransferList.h index c65027d1c..d3d033609 100644 --- a/lib/s1ap/asn1c/S1AP_Bearers-SubjectToStatusTransferList.h +++ b/lib/asn1c/s1ap/S1AP_Bearers-SubjectToStatusTransferList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BitRate.c b/lib/asn1c/s1ap/S1AP_BitRate.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_BitRate.c rename to lib/asn1c/s1ap/S1AP_BitRate.c index db8d62f0a..ded8cb9aa 100644 --- a/lib/s1ap/asn1c/S1AP_BitRate.c +++ b/lib/asn1c/s1ap/S1AP_BitRate.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BitRate.h b/lib/asn1c/s1ap/S1AP_BitRate.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_BitRate.h rename to lib/asn1c/s1ap/S1AP_BitRate.h index c709c6e85..2b97a7b09 100644 --- a/lib/s1ap/asn1c/S1AP_BitRate.h +++ b/lib/asn1c/s1ap/S1AP_BitRate.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BroadcastCancelledAreaList.c b/lib/asn1c/s1ap/S1AP_BroadcastCancelledAreaList.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_BroadcastCancelledAreaList.c rename to lib/asn1c/s1ap/S1AP_BroadcastCancelledAreaList.c index ba6437d9f..9794560c0 100644 --- a/lib/s1ap/asn1c/S1AP_BroadcastCancelledAreaList.c +++ b/lib/asn1c/s1ap/S1AP_BroadcastCancelledAreaList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BroadcastCancelledAreaList.h b/lib/asn1c/s1ap/S1AP_BroadcastCancelledAreaList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_BroadcastCancelledAreaList.h rename to lib/asn1c/s1ap/S1AP_BroadcastCancelledAreaList.h index d585b3ab0..2a38accb3 100644 --- a/lib/s1ap/asn1c/S1AP_BroadcastCancelledAreaList.h +++ b/lib/asn1c/s1ap/S1AP_BroadcastCancelledAreaList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BroadcastCompletedAreaList.c b/lib/asn1c/s1ap/S1AP_BroadcastCompletedAreaList.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_BroadcastCompletedAreaList.c rename to lib/asn1c/s1ap/S1AP_BroadcastCompletedAreaList.c index a8f904ef9..d2a60c951 100644 --- a/lib/s1ap/asn1c/S1AP_BroadcastCompletedAreaList.c +++ b/lib/asn1c/s1ap/S1AP_BroadcastCompletedAreaList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_BroadcastCompletedAreaList.h b/lib/asn1c/s1ap/S1AP_BroadcastCompletedAreaList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_BroadcastCompletedAreaList.h rename to lib/asn1c/s1ap/S1AP_BroadcastCompletedAreaList.h index 482d32e41..22bfe7e3f 100644 --- a/lib/s1ap/asn1c/S1AP_BroadcastCompletedAreaList.h +++ b/lib/asn1c/s1ap/S1AP_BroadcastCompletedAreaList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CE-mode-B-SupportIndicator.c b/lib/asn1c/s1ap/S1AP_CE-mode-B-SupportIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CE-mode-B-SupportIndicator.c rename to lib/asn1c/s1ap/S1AP_CE-mode-B-SupportIndicator.c index bf3d38b24..ae71e4209 100644 --- a/lib/s1ap/asn1c/S1AP_CE-mode-B-SupportIndicator.c +++ b/lib/asn1c/s1ap/S1AP_CE-mode-B-SupportIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CE-mode-B-SupportIndicator.h b/lib/asn1c/s1ap/S1AP_CE-mode-B-SupportIndicator.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CE-mode-B-SupportIndicator.h rename to lib/asn1c/s1ap/S1AP_CE-mode-B-SupportIndicator.h index 11ecee41b..6a219dc53 100644 --- a/lib/s1ap/asn1c/S1AP_CE-mode-B-SupportIndicator.h +++ b/lib/asn1c/s1ap/S1AP_CE-mode-B-SupportIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CELevel.c b/lib/asn1c/s1ap/S1AP_CELevel.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_CELevel.c rename to lib/asn1c/s1ap/S1AP_CELevel.c index 49407fe4b..77802bd9b 100644 --- a/lib/s1ap/asn1c/S1AP_CELevel.c +++ b/lib/asn1c/s1ap/S1AP_CELevel.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CELevel.h b/lib/asn1c/s1ap/S1AP_CELevel.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CELevel.h rename to lib/asn1c/s1ap/S1AP_CELevel.h index b0da5c22f..77c0ff342 100644 --- a/lib/s1ap/asn1c/S1AP_CELevel.h +++ b/lib/asn1c/s1ap/S1AP_CELevel.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CGI.c b/lib/asn1c/s1ap/S1AP_CGI.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CGI.c rename to lib/asn1c/s1ap/S1AP_CGI.c index 977b4f5d4..067d34b94 100644 --- a/lib/s1ap/asn1c/S1AP_CGI.c +++ b/lib/asn1c/s1ap/S1AP_CGI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CGI.h b/lib/asn1c/s1ap/S1AP_CGI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CGI.h rename to lib/asn1c/s1ap/S1AP_CGI.h index 362861f23..ca6cb3ad0 100644 --- a/lib/s1ap/asn1c/S1AP_CGI.h +++ b/lib/asn1c/s1ap/S1AP_CGI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CI.c b/lib/asn1c/s1ap/S1AP_CI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CI.c rename to lib/asn1c/s1ap/S1AP_CI.c index 7a54eb8b1..2a50acb89 100644 --- a/lib/s1ap/asn1c/S1AP_CI.c +++ b/lib/asn1c/s1ap/S1AP_CI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CI.h b/lib/asn1c/s1ap/S1AP_CI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CI.h rename to lib/asn1c/s1ap/S1AP_CI.h index 4806dbbb0..998a2d699 100644 --- a/lib/s1ap/asn1c/S1AP_CI.h +++ b/lib/asn1c/s1ap/S1AP_CI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CNDomain.c b/lib/asn1c/s1ap/S1AP_CNDomain.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CNDomain.c rename to lib/asn1c/s1ap/S1AP_CNDomain.c index bd1bf5de9..80cdde92d 100644 --- a/lib/s1ap/asn1c/S1AP_CNDomain.c +++ b/lib/asn1c/s1ap/S1AP_CNDomain.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CNDomain.h b/lib/asn1c/s1ap/S1AP_CNDomain.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CNDomain.h rename to lib/asn1c/s1ap/S1AP_CNDomain.h index 51f761148..ca54c0b64 100644 --- a/lib/s1ap/asn1c/S1AP_CNDomain.h +++ b/lib/asn1c/s1ap/S1AP_CNDomain.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_COUNTValueExtended.c b/lib/asn1c/s1ap/S1AP_COUNTValueExtended.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_COUNTValueExtended.c rename to lib/asn1c/s1ap/S1AP_COUNTValueExtended.c index 6fc62d155..76dfda8d7 100644 --- a/lib/s1ap/asn1c/S1AP_COUNTValueExtended.c +++ b/lib/asn1c/s1ap/S1AP_COUNTValueExtended.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_COUNTValueExtended.h b/lib/asn1c/s1ap/S1AP_COUNTValueExtended.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_COUNTValueExtended.h rename to lib/asn1c/s1ap/S1AP_COUNTValueExtended.h index 17c367b42..c2f94afea 100644 --- a/lib/s1ap/asn1c/S1AP_COUNTValueExtended.h +++ b/lib/asn1c/s1ap/S1AP_COUNTValueExtended.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_COUNTvalue.c b/lib/asn1c/s1ap/S1AP_COUNTvalue.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_COUNTvalue.c rename to lib/asn1c/s1ap/S1AP_COUNTvalue.c index bd86ca7b2..f79d259d7 100644 --- a/lib/s1ap/asn1c/S1AP_COUNTvalue.c +++ b/lib/asn1c/s1ap/S1AP_COUNTvalue.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_COUNTvalue.h b/lib/asn1c/s1ap/S1AP_COUNTvalue.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_COUNTvalue.h rename to lib/asn1c/s1ap/S1AP_COUNTvalue.h index 3b3ee1d8e..70f24af46 100644 --- a/lib/s1ap/asn1c/S1AP_COUNTvalue.h +++ b/lib/asn1c/s1ap/S1AP_COUNTvalue.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_COUNTvaluePDCP-SNlength18.c b/lib/asn1c/s1ap/S1AP_COUNTvaluePDCP-SNlength18.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_COUNTvaluePDCP-SNlength18.c rename to lib/asn1c/s1ap/S1AP_COUNTvaluePDCP-SNlength18.c index b15396ac8..e074ffde8 100644 --- a/lib/s1ap/asn1c/S1AP_COUNTvaluePDCP-SNlength18.c +++ b/lib/asn1c/s1ap/S1AP_COUNTvaluePDCP-SNlength18.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_COUNTvaluePDCP-SNlength18.h b/lib/asn1c/s1ap/S1AP_COUNTvaluePDCP-SNlength18.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_COUNTvaluePDCP-SNlength18.h rename to lib/asn1c/s1ap/S1AP_COUNTvaluePDCP-SNlength18.h index 65ad46a38..0ab2d905b 100644 --- a/lib/s1ap/asn1c/S1AP_COUNTvaluePDCP-SNlength18.h +++ b/lib/asn1c/s1ap/S1AP_COUNTvaluePDCP-SNlength18.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSFallbackIndicator.c b/lib/asn1c/s1ap/S1AP_CSFallbackIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CSFallbackIndicator.c rename to lib/asn1c/s1ap/S1AP_CSFallbackIndicator.c index cd7b5cd18..15f57ce56 100644 --- a/lib/s1ap/asn1c/S1AP_CSFallbackIndicator.c +++ b/lib/asn1c/s1ap/S1AP_CSFallbackIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSFallbackIndicator.h b/lib/asn1c/s1ap/S1AP_CSFallbackIndicator.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CSFallbackIndicator.h rename to lib/asn1c/s1ap/S1AP_CSFallbackIndicator.h index 14a08c197..3cfdefd7a 100644 --- a/lib/s1ap/asn1c/S1AP_CSFallbackIndicator.h +++ b/lib/asn1c/s1ap/S1AP_CSFallbackIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSG-Id.c b/lib/asn1c/s1ap/S1AP_CSG-Id.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CSG-Id.c rename to lib/asn1c/s1ap/S1AP_CSG-Id.c index 0822ab352..73327de90 100644 --- a/lib/s1ap/asn1c/S1AP_CSG-Id.c +++ b/lib/asn1c/s1ap/S1AP_CSG-Id.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSG-Id.h b/lib/asn1c/s1ap/S1AP_CSG-Id.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CSG-Id.h rename to lib/asn1c/s1ap/S1AP_CSG-Id.h index 9cb390eeb..61510ef9c 100644 --- a/lib/s1ap/asn1c/S1AP_CSG-Id.h +++ b/lib/asn1c/s1ap/S1AP_CSG-Id.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSG-IdList-Item.c b/lib/asn1c/s1ap/S1AP_CSG-IdList-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CSG-IdList-Item.c rename to lib/asn1c/s1ap/S1AP_CSG-IdList-Item.c index 88bf71db9..0e04902b3 100644 --- a/lib/s1ap/asn1c/S1AP_CSG-IdList-Item.c +++ b/lib/asn1c/s1ap/S1AP_CSG-IdList-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSG-IdList-Item.h b/lib/asn1c/s1ap/S1AP_CSG-IdList-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CSG-IdList-Item.h rename to lib/asn1c/s1ap/S1AP_CSG-IdList-Item.h index b586bc4bb..7adf7b138 100644 --- a/lib/s1ap/asn1c/S1AP_CSG-IdList-Item.h +++ b/lib/asn1c/s1ap/S1AP_CSG-IdList-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSG-IdList.c b/lib/asn1c/s1ap/S1AP_CSG-IdList.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_CSG-IdList.c rename to lib/asn1c/s1ap/S1AP_CSG-IdList.c index b4a409eb6..d5e7a9492 100644 --- a/lib/s1ap/asn1c/S1AP_CSG-IdList.c +++ b/lib/asn1c/s1ap/S1AP_CSG-IdList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSG-IdList.h b/lib/asn1c/s1ap/S1AP_CSG-IdList.h similarity index 93% rename from lib/s1ap/asn1c/S1AP_CSG-IdList.h rename to lib/asn1c/s1ap/S1AP_CSG-IdList.h index a7df832cc..57c1c21aa 100644 --- a/lib/s1ap/asn1c/S1AP_CSG-IdList.h +++ b/lib/asn1c/s1ap/S1AP_CSG-IdList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSGMembershipInfo.c b/lib/asn1c/s1ap/S1AP_CSGMembershipInfo.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CSGMembershipInfo.c rename to lib/asn1c/s1ap/S1AP_CSGMembershipInfo.c index 93b6b691c..a3c5719ef 100644 --- a/lib/s1ap/asn1c/S1AP_CSGMembershipInfo.c +++ b/lib/asn1c/s1ap/S1AP_CSGMembershipInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSGMembershipInfo.h b/lib/asn1c/s1ap/S1AP_CSGMembershipInfo.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CSGMembershipInfo.h rename to lib/asn1c/s1ap/S1AP_CSGMembershipInfo.h index fa2775433..580c0efab 100644 --- a/lib/s1ap/asn1c/S1AP_CSGMembershipInfo.h +++ b/lib/asn1c/s1ap/S1AP_CSGMembershipInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSGMembershipStatus.c b/lib/asn1c/s1ap/S1AP_CSGMembershipStatus.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CSGMembershipStatus.c rename to lib/asn1c/s1ap/S1AP_CSGMembershipStatus.c index 8194034e4..26f754aee 100644 --- a/lib/s1ap/asn1c/S1AP_CSGMembershipStatus.c +++ b/lib/asn1c/s1ap/S1AP_CSGMembershipStatus.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CSGMembershipStatus.h b/lib/asn1c/s1ap/S1AP_CSGMembershipStatus.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CSGMembershipStatus.h rename to lib/asn1c/s1ap/S1AP_CSGMembershipStatus.h index cfd1f85f7..5d529a77c 100644 --- a/lib/s1ap/asn1c/S1AP_CSGMembershipStatus.h +++ b/lib/asn1c/s1ap/S1AP_CSGMembershipStatus.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI-Item.c b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CancelledCellinEAI-Item.c rename to lib/asn1c/s1ap/S1AP_CancelledCellinEAI-Item.c index de34e0492..54e6cdcdc 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI-Item.c +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI-Item.h b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI-Item.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CancelledCellinEAI-Item.h rename to lib/asn1c/s1ap/S1AP_CancelledCellinEAI-Item.h index fccf4f071..c9d1cc035 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI-Item.h +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI.c b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CancelledCellinEAI.c rename to lib/asn1c/s1ap/S1AP_CancelledCellinEAI.c index 0aad0c801..1873bd9a4 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI.c +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI.h b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CancelledCellinEAI.h rename to lib/asn1c/s1ap/S1AP_CancelledCellinEAI.h index bb53d5d0a..6e3b2aba5 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinEAI.h +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinEAI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI-Item.c b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CancelledCellinTAI-Item.c rename to lib/asn1c/s1ap/S1AP_CancelledCellinTAI-Item.c index 0b7e21b71..70fff8181 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI-Item.c +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI-Item.h b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI-Item.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CancelledCellinTAI-Item.h rename to lib/asn1c/s1ap/S1AP_CancelledCellinTAI-Item.h index 35f76be4a..132ff7f63 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI-Item.h +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI.c b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CancelledCellinTAI.c rename to lib/asn1c/s1ap/S1AP_CancelledCellinTAI.c index 9f556d0e5..4055d6a20 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI.c +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI.h b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CancelledCellinTAI.h rename to lib/asn1c/s1ap/S1AP_CancelledCellinTAI.h index 0b17382b3..2924f0999 100644 --- a/lib/s1ap/asn1c/S1AP_CancelledCellinTAI.h +++ b/lib/asn1c/s1ap/S1AP_CancelledCellinTAI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cause.c b/lib/asn1c/s1ap/S1AP_Cause.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_Cause.c rename to lib/asn1c/s1ap/S1AP_Cause.c index ec0920db3..85616f8a9 100644 --- a/lib/s1ap/asn1c/S1AP_Cause.c +++ b/lib/asn1c/s1ap/S1AP_Cause.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cause.h b/lib/asn1c/s1ap/S1AP_Cause.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cause.h rename to lib/asn1c/s1ap/S1AP_Cause.h index 6bbfa1429..2cf6baf1e 100644 --- a/lib/s1ap/asn1c/S1AP_Cause.h +++ b/lib/asn1c/s1ap/S1AP_Cause.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseMisc.c b/lib/asn1c/s1ap/S1AP_CauseMisc.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CauseMisc.c rename to lib/asn1c/s1ap/S1AP_CauseMisc.c index 7b3f685e3..d15db1e9f 100644 --- a/lib/s1ap/asn1c/S1AP_CauseMisc.c +++ b/lib/asn1c/s1ap/S1AP_CauseMisc.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseMisc.h b/lib/asn1c/s1ap/S1AP_CauseMisc.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CauseMisc.h rename to lib/asn1c/s1ap/S1AP_CauseMisc.h index f0377c953..d52fbb8d2 100644 --- a/lib/s1ap/asn1c/S1AP_CauseMisc.h +++ b/lib/asn1c/s1ap/S1AP_CauseMisc.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseNas.c b/lib/asn1c/s1ap/S1AP_CauseNas.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CauseNas.c rename to lib/asn1c/s1ap/S1AP_CauseNas.c index cb91fb384..b7f180b72 100644 --- a/lib/s1ap/asn1c/S1AP_CauseNas.c +++ b/lib/asn1c/s1ap/S1AP_CauseNas.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseNas.h b/lib/asn1c/s1ap/S1AP_CauseNas.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CauseNas.h rename to lib/asn1c/s1ap/S1AP_CauseNas.h index 13f8dc49a..c19cb8953 100644 --- a/lib/s1ap/asn1c/S1AP_CauseNas.h +++ b/lib/asn1c/s1ap/S1AP_CauseNas.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseProtocol.c b/lib/asn1c/s1ap/S1AP_CauseProtocol.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CauseProtocol.c rename to lib/asn1c/s1ap/S1AP_CauseProtocol.c index 342cd2cda..3a153e742 100644 --- a/lib/s1ap/asn1c/S1AP_CauseProtocol.c +++ b/lib/asn1c/s1ap/S1AP_CauseProtocol.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseProtocol.h b/lib/asn1c/s1ap/S1AP_CauseProtocol.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_CauseProtocol.h rename to lib/asn1c/s1ap/S1AP_CauseProtocol.h index 5e5912855..8b51b5142 100644 --- a/lib/s1ap/asn1c/S1AP_CauseProtocol.h +++ b/lib/asn1c/s1ap/S1AP_CauseProtocol.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseRadioNetwork.c b/lib/asn1c/s1ap/S1AP_CauseRadioNetwork.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_CauseRadioNetwork.c rename to lib/asn1c/s1ap/S1AP_CauseRadioNetwork.c index 0f9754aba..061f04636 100644 --- a/lib/s1ap/asn1c/S1AP_CauseRadioNetwork.c +++ b/lib/asn1c/s1ap/S1AP_CauseRadioNetwork.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseRadioNetwork.h b/lib/asn1c/s1ap/S1AP_CauseRadioNetwork.h similarity index 98% rename from lib/s1ap/asn1c/S1AP_CauseRadioNetwork.h rename to lib/asn1c/s1ap/S1AP_CauseRadioNetwork.h index 32bb20fcc..e67cba62c 100644 --- a/lib/s1ap/asn1c/S1AP_CauseRadioNetwork.h +++ b/lib/asn1c/s1ap/S1AP_CauseRadioNetwork.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseTransport.c b/lib/asn1c/s1ap/S1AP_CauseTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CauseTransport.c rename to lib/asn1c/s1ap/S1AP_CauseTransport.c index 5024d7ab1..83e4d97c8 100644 --- a/lib/s1ap/asn1c/S1AP_CauseTransport.c +++ b/lib/asn1c/s1ap/S1AP_CauseTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CauseTransport.h b/lib/asn1c/s1ap/S1AP_CauseTransport.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CauseTransport.h rename to lib/asn1c/s1ap/S1AP_CauseTransport.h index 110e8a683..2d7791c25 100644 --- a/lib/s1ap/asn1c/S1AP_CauseTransport.h +++ b/lib/asn1c/s1ap/S1AP_CauseTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000HORequiredIndication.c b/lib/asn1c/s1ap/S1AP_Cdma2000HORequiredIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Cdma2000HORequiredIndication.c rename to lib/asn1c/s1ap/S1AP_Cdma2000HORequiredIndication.c index bd4adbea1..a17e8e99e 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000HORequiredIndication.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000HORequiredIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000HORequiredIndication.h b/lib/asn1c/s1ap/S1AP_Cdma2000HORequiredIndication.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_Cdma2000HORequiredIndication.h rename to lib/asn1c/s1ap/S1AP_Cdma2000HORequiredIndication.h index e8c5f9ad5..1bd68dcc1 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000HORequiredIndication.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000HORequiredIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000HOStatus.c b/lib/asn1c/s1ap/S1AP_Cdma2000HOStatus.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Cdma2000HOStatus.c rename to lib/asn1c/s1ap/S1AP_Cdma2000HOStatus.c index 46fdb61a1..6b0b08605 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000HOStatus.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000HOStatus.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000HOStatus.h b/lib/asn1c/s1ap/S1AP_Cdma2000HOStatus.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000HOStatus.h rename to lib/asn1c/s1ap/S1AP_Cdma2000HOStatus.h index c82dd62dd..62d40cfe0 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000HOStatus.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000HOStatus.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMEID.c b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMEID.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXMEID.c rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXMEID.c index 02cdee3ac..07002e3c1 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMEID.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMEID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMEID.h b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMEID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXMEID.h rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXMEID.h index 977013755..9c0a513ee 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMEID.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMEID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMSI.c b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMSI.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXMSI.c rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXMSI.c index 4c418fd44..e4e5dd203 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMSI.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMSI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMSI.h b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMSI.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXMSI.h rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXMSI.h index 0a9941b9f..c20e996fc 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXMSI.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXMSI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXPilot.c b/lib/asn1c/s1ap/S1AP_Cdma2000OneXPilot.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXPilot.c rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXPilot.c index 1dc26a84a..0455117bb 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXPilot.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXPilot.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXPilot.h b/lib/asn1c/s1ap/S1AP_Cdma2000OneXPilot.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXPilot.h rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXPilot.h index d18238b1e..57a2d87b7 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXPilot.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXPilot.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXRAND.c b/lib/asn1c/s1ap/S1AP_Cdma2000OneXRAND.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXRAND.c rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXRAND.c index 8b8bfa26d..0b8bed0ad 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXRAND.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXRAND.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXRAND.h b/lib/asn1c/s1ap/S1AP_Cdma2000OneXRAND.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXRAND.h rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXRAND.h index 932e5d12d..f1a0ec50b 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXRAND.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXRAND.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXSRVCCInfo.c b/lib/asn1c/s1ap/S1AP_Cdma2000OneXSRVCCInfo.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXSRVCCInfo.c rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXSRVCCInfo.c index a57d599f2..23585603b 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXSRVCCInfo.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXSRVCCInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000OneXSRVCCInfo.h b/lib/asn1c/s1ap/S1AP_Cdma2000OneXSRVCCInfo.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Cdma2000OneXSRVCCInfo.h rename to lib/asn1c/s1ap/S1AP_Cdma2000OneXSRVCCInfo.h index e175a2f72..f1e22df4f 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000OneXSRVCCInfo.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000OneXSRVCCInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000PDU.c b/lib/asn1c/s1ap/S1AP_Cdma2000PDU.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_Cdma2000PDU.c rename to lib/asn1c/s1ap/S1AP_Cdma2000PDU.c index 94afe4acb..61ca11b2c 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000PDU.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000PDU.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000PDU.h b/lib/asn1c/s1ap/S1AP_Cdma2000PDU.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Cdma2000PDU.h rename to lib/asn1c/s1ap/S1AP_Cdma2000PDU.h index af311825b..636c9d202 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000PDU.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000PDU.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000RATType.c b/lib/asn1c/s1ap/S1AP_Cdma2000RATType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Cdma2000RATType.c rename to lib/asn1c/s1ap/S1AP_Cdma2000RATType.c index 97ff6b661..17ef34746 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000RATType.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000RATType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000RATType.h b/lib/asn1c/s1ap/S1AP_Cdma2000RATType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000RATType.h rename to lib/asn1c/s1ap/S1AP_Cdma2000RATType.h index 59e121bb6..fdcdb4383 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000RATType.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000RATType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000SectorID.c b/lib/asn1c/s1ap/S1AP_Cdma2000SectorID.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_Cdma2000SectorID.c rename to lib/asn1c/s1ap/S1AP_Cdma2000SectorID.c index 2d1240c98..e7353556c 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000SectorID.c +++ b/lib/asn1c/s1ap/S1AP_Cdma2000SectorID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cdma2000SectorID.h b/lib/asn1c/s1ap/S1AP_Cdma2000SectorID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cdma2000SectorID.h rename to lib/asn1c/s1ap/S1AP_Cdma2000SectorID.h index d547376e9..e8158cd04 100644 --- a/lib/s1ap/asn1c/S1AP_Cdma2000SectorID.h +++ b/lib/asn1c/s1ap/S1AP_Cdma2000SectorID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cell-Size.c b/lib/asn1c/s1ap/S1AP_Cell-Size.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Cell-Size.c rename to lib/asn1c/s1ap/S1AP_Cell-Size.c index d5b20c91c..c58d3d80f 100644 --- a/lib/s1ap/asn1c/S1AP_Cell-Size.c +++ b/lib/asn1c/s1ap/S1AP_Cell-Size.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Cell-Size.h b/lib/asn1c/s1ap/S1AP_Cell-Size.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Cell-Size.h rename to lib/asn1c/s1ap/S1AP_Cell-Size.h index f26108d1a..a22bf209b 100644 --- a/lib/s1ap/asn1c/S1AP_Cell-Size.h +++ b/lib/asn1c/s1ap/S1AP_Cell-Size.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellAccessMode.c b/lib/asn1c/s1ap/S1AP_CellAccessMode.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellAccessMode.c rename to lib/asn1c/s1ap/S1AP_CellAccessMode.c index d8f59727c..1807142a9 100644 --- a/lib/s1ap/asn1c/S1AP_CellAccessMode.c +++ b/lib/asn1c/s1ap/S1AP_CellAccessMode.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellAccessMode.h b/lib/asn1c/s1ap/S1AP_CellAccessMode.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CellAccessMode.h rename to lib/asn1c/s1ap/S1AP_CellAccessMode.h index bb42410ca..a9280e23e 100644 --- a/lib/s1ap/asn1c/S1AP_CellAccessMode.h +++ b/lib/asn1c/s1ap/S1AP_CellAccessMode.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellBasedMDT.c b/lib/asn1c/s1ap/S1AP_CellBasedMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellBasedMDT.c rename to lib/asn1c/s1ap/S1AP_CellBasedMDT.c index 35f3a8569..71783ca36 100644 --- a/lib/s1ap/asn1c/S1AP_CellBasedMDT.c +++ b/lib/asn1c/s1ap/S1AP_CellBasedMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellBasedMDT.h b/lib/asn1c/s1ap/S1AP_CellBasedMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellBasedMDT.h rename to lib/asn1c/s1ap/S1AP_CellBasedMDT.h index face29498..3a8626ba2 100644 --- a/lib/s1ap/asn1c/S1AP_CellBasedMDT.h +++ b/lib/asn1c/s1ap/S1AP_CellBasedMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Broadcast-Item.c b/lib/asn1c/s1ap/S1AP_CellID-Broadcast-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellID-Broadcast-Item.c rename to lib/asn1c/s1ap/S1AP_CellID-Broadcast-Item.c index e5000a049..23fd1cbdb 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Broadcast-Item.c +++ b/lib/asn1c/s1ap/S1AP_CellID-Broadcast-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Broadcast-Item.h b/lib/asn1c/s1ap/S1AP_CellID-Broadcast-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellID-Broadcast-Item.h rename to lib/asn1c/s1ap/S1AP_CellID-Broadcast-Item.h index a0d558332..030fb8352 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Broadcast-Item.h +++ b/lib/asn1c/s1ap/S1AP_CellID-Broadcast-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Broadcast.c b/lib/asn1c/s1ap/S1AP_CellID-Broadcast.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellID-Broadcast.c rename to lib/asn1c/s1ap/S1AP_CellID-Broadcast.c index 3de4a63f1..95619c4be 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Broadcast.c +++ b/lib/asn1c/s1ap/S1AP_CellID-Broadcast.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Broadcast.h b/lib/asn1c/s1ap/S1AP_CellID-Broadcast.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellID-Broadcast.h rename to lib/asn1c/s1ap/S1AP_CellID-Broadcast.h index 8133d3f80..ff84884a8 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Broadcast.h +++ b/lib/asn1c/s1ap/S1AP_CellID-Broadcast.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Cancelled-Item.c b/lib/asn1c/s1ap/S1AP_CellID-Cancelled-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CellID-Cancelled-Item.c rename to lib/asn1c/s1ap/S1AP_CellID-Cancelled-Item.c index aabcb0634..bd8ae4092 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Cancelled-Item.c +++ b/lib/asn1c/s1ap/S1AP_CellID-Cancelled-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Cancelled-Item.h b/lib/asn1c/s1ap/S1AP_CellID-Cancelled-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellID-Cancelled-Item.h rename to lib/asn1c/s1ap/S1AP_CellID-Cancelled-Item.h index f7e02494f..b8e56ad73 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Cancelled-Item.h +++ b/lib/asn1c/s1ap/S1AP_CellID-Cancelled-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Cancelled.c b/lib/asn1c/s1ap/S1AP_CellID-Cancelled.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellID-Cancelled.c rename to lib/asn1c/s1ap/S1AP_CellID-Cancelled.c index f673c0c93..607e86020 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Cancelled.c +++ b/lib/asn1c/s1ap/S1AP_CellID-Cancelled.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellID-Cancelled.h b/lib/asn1c/s1ap/S1AP_CellID-Cancelled.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellID-Cancelled.h rename to lib/asn1c/s1ap/S1AP_CellID-Cancelled.h index fcbcd9778..880b36f13 100644 --- a/lib/s1ap/asn1c/S1AP_CellID-Cancelled.h +++ b/lib/asn1c/s1ap/S1AP_CellID-Cancelled.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellIdListforMDT.c b/lib/asn1c/s1ap/S1AP_CellIdListforMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellIdListforMDT.c rename to lib/asn1c/s1ap/S1AP_CellIdListforMDT.c index b4898f701..fee9f64e8 100644 --- a/lib/s1ap/asn1c/S1AP_CellIdListforMDT.c +++ b/lib/asn1c/s1ap/S1AP_CellIdListforMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellIdListforMDT.h b/lib/asn1c/s1ap/S1AP_CellIdListforMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellIdListforMDT.h rename to lib/asn1c/s1ap/S1AP_CellIdListforMDT.h index 0eb27e7f8..04586fb86 100644 --- a/lib/s1ap/asn1c/S1AP_CellIdListforMDT.h +++ b/lib/asn1c/s1ap/S1AP_CellIdListforMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellIdentifierAndCELevelForCECapableUEs.c b/lib/asn1c/s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CellIdentifierAndCELevelForCECapableUEs.c rename to lib/asn1c/s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.c index 854de9204..46698ea48 100644 --- a/lib/s1ap/asn1c/S1AP_CellIdentifierAndCELevelForCECapableUEs.c +++ b/lib/asn1c/s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellIdentifierAndCELevelForCECapableUEs.h b/lib/asn1c/s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CellIdentifierAndCELevelForCECapableUEs.h rename to lib/asn1c/s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.h index ec692d9e0..d6cf527b2 100644 --- a/lib/s1ap/asn1c/S1AP_CellIdentifierAndCELevelForCECapableUEs.h +++ b/lib/asn1c/s1ap/S1AP_CellIdentifierAndCELevelForCECapableUEs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellIdentity.c b/lib/asn1c/s1ap/S1AP_CellIdentity.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellIdentity.c rename to lib/asn1c/s1ap/S1AP_CellIdentity.c index ae8269b3b..62409ac26 100644 --- a/lib/s1ap/asn1c/S1AP_CellIdentity.c +++ b/lib/asn1c/s1ap/S1AP_CellIdentity.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellIdentity.h b/lib/asn1c/s1ap/S1AP_CellIdentity.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CellIdentity.h rename to lib/asn1c/s1ap/S1AP_CellIdentity.h index 5fe4ac096..59592925c 100644 --- a/lib/s1ap/asn1c/S1AP_CellIdentity.h +++ b/lib/asn1c/s1ap/S1AP_CellIdentity.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellTrafficTrace.c b/lib/asn1c/s1ap/S1AP_CellTrafficTrace.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_CellTrafficTrace.c rename to lib/asn1c/s1ap/S1AP_CellTrafficTrace.c index b8a95080f..e3852e4a5 100644 --- a/lib/s1ap/asn1c/S1AP_CellTrafficTrace.c +++ b/lib/asn1c/s1ap/S1AP_CellTrafficTrace.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellTrafficTrace.h b/lib/asn1c/s1ap/S1AP_CellTrafficTrace.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellTrafficTrace.h rename to lib/asn1c/s1ap/S1AP_CellTrafficTrace.h index 501b3712d..12cbf568f 100644 --- a/lib/s1ap/asn1c/S1AP_CellTrafficTrace.h +++ b/lib/asn1c/s1ap/S1AP_CellTrafficTrace.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellType.c b/lib/asn1c/s1ap/S1AP_CellType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CellType.c rename to lib/asn1c/s1ap/S1AP_CellType.c index 0314ab017..84572cacf 100644 --- a/lib/s1ap/asn1c/S1AP_CellType.c +++ b/lib/asn1c/s1ap/S1AP_CellType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CellType.h b/lib/asn1c/s1ap/S1AP_CellType.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CellType.h rename to lib/asn1c/s1ap/S1AP_CellType.h index 4ce1f50bb..c04808b6d 100644 --- a/lib/s1ap/asn1c/S1AP_CellType.h +++ b/lib/asn1c/s1ap/S1AP_CellType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI-Item.c b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CompletedCellinEAI-Item.c rename to lib/asn1c/s1ap/S1AP_CompletedCellinEAI-Item.c index 458c3b001..cffe90187 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI-Item.c +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI-Item.h b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CompletedCellinEAI-Item.h rename to lib/asn1c/s1ap/S1AP_CompletedCellinEAI-Item.h index 7a143684f..313f66577 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI-Item.h +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI.c b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CompletedCellinEAI.c rename to lib/asn1c/s1ap/S1AP_CompletedCellinEAI.c index 5530f89cc..b5ee12dcb 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI.c +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI.h b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CompletedCellinEAI.h rename to lib/asn1c/s1ap/S1AP_CompletedCellinEAI.h index d55ff37ab..3efb13d2a 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinEAI.h +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinEAI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI-Item.c b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CompletedCellinTAI-Item.c rename to lib/asn1c/s1ap/S1AP_CompletedCellinTAI-Item.c index 5e475c696..ca65d99eb 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI-Item.c +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI-Item.h b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CompletedCellinTAI-Item.h rename to lib/asn1c/s1ap/S1AP_CompletedCellinTAI-Item.h index c6d3ff5e4..d6c259148 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI-Item.h +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI.c b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CompletedCellinTAI.c rename to lib/asn1c/s1ap/S1AP_CompletedCellinTAI.c index 23094497c..ae3de897d 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI.c +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI.h b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CompletedCellinTAI.h rename to lib/asn1c/s1ap/S1AP_CompletedCellinTAI.h index 354d5bb58..4f0b03b72 100644 --- a/lib/s1ap/asn1c/S1AP_CompletedCellinTAI.h +++ b/lib/asn1c/s1ap/S1AP_CompletedCellinTAI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ConcurrentWarningMessageIndicator.c b/lib/asn1c/s1ap/S1AP_ConcurrentWarningMessageIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ConcurrentWarningMessageIndicator.c rename to lib/asn1c/s1ap/S1AP_ConcurrentWarningMessageIndicator.c index 3b95dab9c..cc90df31c 100644 --- a/lib/s1ap/asn1c/S1AP_ConcurrentWarningMessageIndicator.c +++ b/lib/asn1c/s1ap/S1AP_ConcurrentWarningMessageIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ConcurrentWarningMessageIndicator.h b/lib/asn1c/s1ap/S1AP_ConcurrentWarningMessageIndicator.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ConcurrentWarningMessageIndicator.h rename to lib/asn1c/s1ap/S1AP_ConcurrentWarningMessageIndicator.h index 8e34482a9..898fbbc2b 100644 --- a/lib/s1ap/asn1c/S1AP_ConcurrentWarningMessageIndicator.h +++ b/lib/asn1c/s1ap/S1AP_ConcurrentWarningMessageIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ConnectionEstablishmentIndication.c b/lib/asn1c/s1ap/S1AP_ConnectionEstablishmentIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ConnectionEstablishmentIndication.c rename to lib/asn1c/s1ap/S1AP_ConnectionEstablishmentIndication.c index 860a68694..17fdf5c85 100644 --- a/lib/s1ap/asn1c/S1AP_ConnectionEstablishmentIndication.c +++ b/lib/asn1c/s1ap/S1AP_ConnectionEstablishmentIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ConnectionEstablishmentIndication.h b/lib/asn1c/s1ap/S1AP_ConnectionEstablishmentIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ConnectionEstablishmentIndication.h rename to lib/asn1c/s1ap/S1AP_ConnectionEstablishmentIndication.h index e997bab92..97afa1351 100644 --- a/lib/s1ap/asn1c/S1AP_ConnectionEstablishmentIndication.h +++ b/lib/asn1c/s1ap/S1AP_ConnectionEstablishmentIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Correlation-ID.c b/lib/asn1c/s1ap/S1AP_Correlation-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Correlation-ID.c rename to lib/asn1c/s1ap/S1AP_Correlation-ID.c index 2bae685ad..f4c4c0a36 100644 --- a/lib/s1ap/asn1c/S1AP_Correlation-ID.c +++ b/lib/asn1c/s1ap/S1AP_Correlation-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Correlation-ID.h b/lib/asn1c/s1ap/S1AP_Correlation-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Correlation-ID.h rename to lib/asn1c/s1ap/S1AP_Correlation-ID.h index af92c8e7f..facb2db7c 100644 --- a/lib/s1ap/asn1c/S1AP_Correlation-ID.h +++ b/lib/asn1c/s1ap/S1AP_Correlation-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Coverage-Level.c b/lib/asn1c/s1ap/S1AP_Coverage-Level.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Coverage-Level.c rename to lib/asn1c/s1ap/S1AP_Coverage-Level.c index 108a0a3b1..f3a3acb17 100644 --- a/lib/s1ap/asn1c/S1AP_Coverage-Level.c +++ b/lib/asn1c/s1ap/S1AP_Coverage-Level.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Coverage-Level.h b/lib/asn1c/s1ap/S1AP_Coverage-Level.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Coverage-Level.h rename to lib/asn1c/s1ap/S1AP_Coverage-Level.h index 449675d01..c1a6ebff5 100644 --- a/lib/s1ap/asn1c/S1AP_Coverage-Level.h +++ b/lib/asn1c/s1ap/S1AP_Coverage-Level.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Criticality.c b/lib/asn1c/s1ap/S1AP_Criticality.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Criticality.c rename to lib/asn1c/s1ap/S1AP_Criticality.c index 64c66b9d9..f8e52ebaf 100644 --- a/lib/s1ap/asn1c/S1AP_Criticality.c +++ b/lib/asn1c/s1ap/S1AP_Criticality.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Criticality.h b/lib/asn1c/s1ap/S1AP_Criticality.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Criticality.h rename to lib/asn1c/s1ap/S1AP_Criticality.h index 9eb58345c..f3bdb8d64 100644 --- a/lib/s1ap/asn1c/S1AP_Criticality.h +++ b/lib/asn1c/s1ap/S1AP_Criticality.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-Item.c b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-Item.c rename to lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-Item.c index 41f3681db..dd4f39f3f 100644 --- a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-Item.c +++ b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-Item.h b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-Item.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-Item.h rename to lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-Item.h index 3cbc3fa9c..1db6ee1bd 100644 --- a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-Item.h +++ b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-List.c b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-List.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-List.c rename to lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-List.c index 596e90221..ec4c8b823 100644 --- a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-List.c +++ b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-List.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-List.h b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-List.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-List.h rename to lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-List.h index 76a7603f1..d68cdabcd 100644 --- a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics-IE-List.h +++ b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics-IE-List.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics.c b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_CriticalityDiagnostics.c rename to lib/asn1c/s1ap/S1AP_CriticalityDiagnostics.c index fc84f21a4..d85cb66e3 100644 --- a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics.c +++ b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics.h b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_CriticalityDiagnostics.h rename to lib/asn1c/s1ap/S1AP_CriticalityDiagnostics.h index 03b19e114..b07177ba9 100644 --- a/lib/s1ap/asn1c/S1AP_CriticalityDiagnostics.h +++ b/lib/asn1c/s1ap/S1AP_CriticalityDiagnostics.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DCN-ID.c b/lib/asn1c/s1ap/S1AP_DCN-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DCN-ID.c rename to lib/asn1c/s1ap/S1AP_DCN-ID.c index bca131e4c..d7b4cb5eb 100644 --- a/lib/s1ap/asn1c/S1AP_DCN-ID.c +++ b/lib/asn1c/s1ap/S1AP_DCN-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DCN-ID.h b/lib/asn1c/s1ap/S1AP_DCN-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DCN-ID.h rename to lib/asn1c/s1ap/S1AP_DCN-ID.h index 24c33b9ff..34d88a319 100644 --- a/lib/s1ap/asn1c/S1AP_DCN-ID.h +++ b/lib/asn1c/s1ap/S1AP_DCN-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DL-CP-SecurityInformation.c b/lib/asn1c/s1ap/S1AP_DL-CP-SecurityInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DL-CP-SecurityInformation.c rename to lib/asn1c/s1ap/S1AP_DL-CP-SecurityInformation.c index 4cfdd04b0..da3b6e13c 100644 --- a/lib/s1ap/asn1c/S1AP_DL-CP-SecurityInformation.c +++ b/lib/asn1c/s1ap/S1AP_DL-CP-SecurityInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DL-CP-SecurityInformation.h b/lib/asn1c/s1ap/S1AP_DL-CP-SecurityInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DL-CP-SecurityInformation.h rename to lib/asn1c/s1ap/S1AP_DL-CP-SecurityInformation.h index a656b3b6b..b4331e788 100644 --- a/lib/s1ap/asn1c/S1AP_DL-CP-SecurityInformation.h +++ b/lib/asn1c/s1ap/S1AP_DL-CP-SecurityInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DL-Forwarding.c b/lib/asn1c/s1ap/S1AP_DL-Forwarding.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DL-Forwarding.c rename to lib/asn1c/s1ap/S1AP_DL-Forwarding.c index 90309560b..20872d4e5 100644 --- a/lib/s1ap/asn1c/S1AP_DL-Forwarding.c +++ b/lib/asn1c/s1ap/S1AP_DL-Forwarding.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DL-Forwarding.h b/lib/asn1c/s1ap/S1AP_DL-Forwarding.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_DL-Forwarding.h rename to lib/asn1c/s1ap/S1AP_DL-Forwarding.h index a9a94552c..45f4a9379 100644 --- a/lib/s1ap/asn1c/S1AP_DL-Forwarding.h +++ b/lib/asn1c/s1ap/S1AP_DL-Forwarding.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DL-NAS-MAC.c b/lib/asn1c/s1ap/S1AP_DL-NAS-MAC.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DL-NAS-MAC.c rename to lib/asn1c/s1ap/S1AP_DL-NAS-MAC.c index f40db2831..275ad2269 100644 --- a/lib/s1ap/asn1c/S1AP_DL-NAS-MAC.c +++ b/lib/asn1c/s1ap/S1AP_DL-NAS-MAC.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DL-NAS-MAC.h b/lib/asn1c/s1ap/S1AP_DL-NAS-MAC.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DL-NAS-MAC.h rename to lib/asn1c/s1ap/S1AP_DL-NAS-MAC.h index ecaddd13d..9f6e396a7 100644 --- a/lib/s1ap/asn1c/S1AP_DL-NAS-MAC.h +++ b/lib/asn1c/s1ap/S1AP_DL-NAS-MAC.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DLNASPDUDeliveryAckRequest.c b/lib/asn1c/s1ap/S1AP_DLNASPDUDeliveryAckRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DLNASPDUDeliveryAckRequest.c rename to lib/asn1c/s1ap/S1AP_DLNASPDUDeliveryAckRequest.c index 824c8ae48..4c57fdac2 100644 --- a/lib/s1ap/asn1c/S1AP_DLNASPDUDeliveryAckRequest.c +++ b/lib/asn1c/s1ap/S1AP_DLNASPDUDeliveryAckRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DLNASPDUDeliveryAckRequest.h b/lib/asn1c/s1ap/S1AP_DLNASPDUDeliveryAckRequest.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_DLNASPDUDeliveryAckRequest.h rename to lib/asn1c/s1ap/S1AP_DLNASPDUDeliveryAckRequest.h index feeffcc19..bc6697f55 100644 --- a/lib/s1ap/asn1c/S1AP_DLNASPDUDeliveryAckRequest.h +++ b/lib/asn1c/s1ap/S1AP_DLNASPDUDeliveryAckRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Data-Forwarding-Not-Possible.c b/lib/asn1c/s1ap/S1AP_Data-Forwarding-Not-Possible.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Data-Forwarding-Not-Possible.c rename to lib/asn1c/s1ap/S1AP_Data-Forwarding-Not-Possible.c index 0feb4ac4f..995b466b0 100644 --- a/lib/s1ap/asn1c/S1AP_Data-Forwarding-Not-Possible.c +++ b/lib/asn1c/s1ap/S1AP_Data-Forwarding-Not-Possible.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Data-Forwarding-Not-Possible.h b/lib/asn1c/s1ap/S1AP_Data-Forwarding-Not-Possible.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_Data-Forwarding-Not-Possible.h rename to lib/asn1c/s1ap/S1AP_Data-Forwarding-Not-Possible.h index 3f5caf8ab..057c06e75 100644 --- a/lib/s1ap/asn1c/S1AP_Data-Forwarding-Not-Possible.h +++ b/lib/asn1c/s1ap/S1AP_Data-Forwarding-Not-Possible.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DataCodingScheme.c b/lib/asn1c/s1ap/S1AP_DataCodingScheme.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DataCodingScheme.c rename to lib/asn1c/s1ap/S1AP_DataCodingScheme.c index efc26226e..816501b5f 100644 --- a/lib/s1ap/asn1c/S1AP_DataCodingScheme.c +++ b/lib/asn1c/s1ap/S1AP_DataCodingScheme.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DataCodingScheme.h b/lib/asn1c/s1ap/S1AP_DataCodingScheme.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_DataCodingScheme.h rename to lib/asn1c/s1ap/S1AP_DataCodingScheme.h index dc9d19f9a..8d5307470 100644 --- a/lib/s1ap/asn1c/S1AP_DataCodingScheme.h +++ b/lib/asn1c/s1ap/S1AP_DataCodingScheme.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DeactivateTrace.c b/lib/asn1c/s1ap/S1AP_DeactivateTrace.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_DeactivateTrace.c rename to lib/asn1c/s1ap/S1AP_DeactivateTrace.c index 4665f0db4..1ab4faa74 100644 --- a/lib/s1ap/asn1c/S1AP_DeactivateTrace.c +++ b/lib/asn1c/s1ap/S1AP_DeactivateTrace.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DeactivateTrace.h b/lib/asn1c/s1ap/S1AP_DeactivateTrace.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DeactivateTrace.h rename to lib/asn1c/s1ap/S1AP_DeactivateTrace.h index fa9f6e653..d32f404d9 100644 --- a/lib/s1ap/asn1c/S1AP_DeactivateTrace.h +++ b/lib/asn1c/s1ap/S1AP_DeactivateTrace.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Direct-Forwarding-Path-Availability.c b/lib/asn1c/s1ap/S1AP_Direct-Forwarding-Path-Availability.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Direct-Forwarding-Path-Availability.c rename to lib/asn1c/s1ap/S1AP_Direct-Forwarding-Path-Availability.c index 35206883f..ee1e5e12c 100644 --- a/lib/s1ap/asn1c/S1AP_Direct-Forwarding-Path-Availability.c +++ b/lib/asn1c/s1ap/S1AP_Direct-Forwarding-Path-Availability.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Direct-Forwarding-Path-Availability.h b/lib/asn1c/s1ap/S1AP_Direct-Forwarding-Path-Availability.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_Direct-Forwarding-Path-Availability.h rename to lib/asn1c/s1ap/S1AP_Direct-Forwarding-Path-Availability.h index 1edeae9bb..77804f9f7 100644 --- a/lib/s1ap/asn1c/S1AP_Direct-Forwarding-Path-Availability.h +++ b/lib/asn1c/s1ap/S1AP_Direct-Forwarding-Path-Availability.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkNASTransport.c b/lib/asn1c/s1ap/S1AP_DownlinkNASTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DownlinkNASTransport.c rename to lib/asn1c/s1ap/S1AP_DownlinkNASTransport.c index 8717ae31a..5d838c6f2 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkNASTransport.c +++ b/lib/asn1c/s1ap/S1AP_DownlinkNASTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkNASTransport.h b/lib/asn1c/s1ap/S1AP_DownlinkNASTransport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DownlinkNASTransport.h rename to lib/asn1c/s1ap/S1AP_DownlinkNASTransport.h index 07be60ba0..c1cc1d273 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkNASTransport.h +++ b/lib/asn1c/s1ap/S1AP_DownlinkNASTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkNonUEAssociatedLPPaTransport.c b/lib/asn1c/s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DownlinkNonUEAssociatedLPPaTransport.c rename to lib/asn1c/s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.c index 0afedb0d1..151ad8bcf 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkNonUEAssociatedLPPaTransport.c +++ b/lib/asn1c/s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkNonUEAssociatedLPPaTransport.h b/lib/asn1c/s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DownlinkNonUEAssociatedLPPaTransport.h rename to lib/asn1c/s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.h index 20a7e94fc..a311f11e7 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkNonUEAssociatedLPPaTransport.h +++ b/lib/asn1c/s1ap/S1AP_DownlinkNonUEAssociatedLPPaTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkS1cdma2000tunnelling.c b/lib/asn1c/s1ap/S1AP_DownlinkS1cdma2000tunnelling.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DownlinkS1cdma2000tunnelling.c rename to lib/asn1c/s1ap/S1AP_DownlinkS1cdma2000tunnelling.c index d924d980e..9941857ed 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkS1cdma2000tunnelling.c +++ b/lib/asn1c/s1ap/S1AP_DownlinkS1cdma2000tunnelling.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkS1cdma2000tunnelling.h b/lib/asn1c/s1ap/S1AP_DownlinkS1cdma2000tunnelling.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DownlinkS1cdma2000tunnelling.h rename to lib/asn1c/s1ap/S1AP_DownlinkS1cdma2000tunnelling.h index 5b51bbca4..03f8070bd 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkS1cdma2000tunnelling.h +++ b/lib/asn1c/s1ap/S1AP_DownlinkS1cdma2000tunnelling.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkUEAssociatedLPPaTransport.c b/lib/asn1c/s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_DownlinkUEAssociatedLPPaTransport.c rename to lib/asn1c/s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.c index f2b5a2d03..1f6f94b9b 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkUEAssociatedLPPaTransport.c +++ b/lib/asn1c/s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_DownlinkUEAssociatedLPPaTransport.h b/lib/asn1c/s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_DownlinkUEAssociatedLPPaTransport.h rename to lib/asn1c/s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.h index 1da03ceeb..6ee1297e1 100644 --- a/lib/s1ap/asn1c/S1AP_DownlinkUEAssociatedLPPaTransport.h +++ b/lib/asn1c/s1ap/S1AP_DownlinkUEAssociatedLPPaTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RAB-ID.c b/lib/asn1c/s1ap/S1AP_E-RAB-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RAB-ID.c rename to lib/asn1c/s1ap/S1AP_E-RAB-ID.c index 8ebc04e54..9e0110e06 100644 --- a/lib/s1ap/asn1c/S1AP_E-RAB-ID.c +++ b/lib/asn1c/s1ap/S1AP_E-RAB-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RAB-ID.h b/lib/asn1c/s1ap/S1AP_E-RAB-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RAB-ID.h rename to lib/asn1c/s1ap/S1AP_E-RAB-ID.h index a8813d16e..e1321cb3d 100644 --- a/lib/s1ap/asn1c/S1AP_E-RAB-ID.h +++ b/lib/asn1c/s1ap/S1AP_E-RAB-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerList.c b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerList.c rename to lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c index 38e1c3610..7826cf110 100644 --- a/lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerList.c +++ b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerList.h b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerList.h rename to lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.h index 9831316ba..1bf09d8cb 100644 --- a/lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerList.h +++ b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerPairList.h b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerPairList.h similarity index 89% rename from lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerPairList.h rename to lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerPairList.h index 2682f6828..4d6bd8ab2 100644 --- a/lib/s1ap/asn1c/S1AP_E-RAB-IE-ContainerPairList.h +++ b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerPairList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABAdmittedItem.c b/lib/asn1c/s1ap/S1AP_E-RABAdmittedItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABAdmittedItem.c rename to lib/asn1c/s1ap/S1AP_E-RABAdmittedItem.c index 2db03efc2..9a6e3e83f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABAdmittedItem.c +++ b/lib/asn1c/s1ap/S1AP_E-RABAdmittedItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABAdmittedItem.h b/lib/asn1c/s1ap/S1AP_E-RABAdmittedItem.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABAdmittedItem.h rename to lib/asn1c/s1ap/S1AP_E-RABAdmittedItem.h index c95a3706e..337451a87 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABAdmittedItem.h +++ b/lib/asn1c/s1ap/S1AP_E-RABAdmittedItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABAdmittedList.c b/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABAdmittedList.c rename to lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c index 22b465781..99511dad0 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABAdmittedList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABAdmittedList.h b/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABAdmittedList.h rename to lib/asn1c/s1ap/S1AP_E-RABAdmittedList.h index 1364f0751..76adb2635 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABAdmittedList.h +++ b/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABDataForwardingItem.c b/lib/asn1c/s1ap/S1AP_E-RABDataForwardingItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABDataForwardingItem.c rename to lib/asn1c/s1ap/S1AP_E-RABDataForwardingItem.c index 43c4e41e5..73e764864 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABDataForwardingItem.c +++ b/lib/asn1c/s1ap/S1AP_E-RABDataForwardingItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABDataForwardingItem.h b/lib/asn1c/s1ap/S1AP_E-RABDataForwardingItem.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABDataForwardingItem.h rename to lib/asn1c/s1ap/S1AP_E-RABDataForwardingItem.h index 200752e77..913f6c4c3 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABDataForwardingItem.h +++ b/lib/asn1c/s1ap/S1AP_E-RABDataForwardingItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeReq.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeReq.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeReq.c rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeReq.c index 3a8837a78..5d82b9cc2 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeReq.h b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeReq.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeReq.h rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeReq.h index 33d34ce8a..c8b91aa47 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeRes.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeRes.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeRes.c rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeRes.c index fc656eb84..5e5865982 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeRes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeRes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeRes.h b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeRes.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeRes.h rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeRes.h index 4d6fc24c6..c0164525a 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeItemResumeRes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeItemResumeRes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeReq.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeReq.c rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c index 875577c0b..13ef2cdb8 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeReq.h b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeReq.h rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.h index 049d64023..b5ee3e450 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeRes.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeRes.c rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c index 4e104d332..df277b86f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeRes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeRes.h b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeRes.h rename to lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.h index db3ab5053..ad2529cc6 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToResumeListResumeRes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToSetupItemHOReqAck.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToSetupItemHOReqAck.c rename to lib/asn1c/s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.c index e9037d62a..736002cf1 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToSetupItemHOReqAck.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedToSetupItemHOReqAck.h b/lib/asn1c/s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABFailedToSetupItemHOReqAck.h rename to lib/asn1c/s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.h index 3ef35cb42..9bea1dde5 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedToSetupItemHOReqAck.h +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToSetupItemHOReqAck.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedtoSetupListHOReqAck.c b/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABFailedtoSetupListHOReqAck.c rename to lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c index d71bdf98e..c82ed1438 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedtoSetupListHOReqAck.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABFailedtoSetupListHOReqAck.h b/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABFailedtoSetupListHOReqAck.h rename to lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.h index 5bbd5e832..ab4bc4637 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABFailedtoSetupListHOReqAck.h +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABInformationList.c b/lib/asn1c/s1ap/S1AP_E-RABInformationList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABInformationList.c rename to lib/asn1c/s1ap/S1AP_E-RABInformationList.c index 5b9ade5c5..464ebf7e8 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABInformationList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABInformationList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABInformationList.h b/lib/asn1c/s1ap/S1AP_E-RABInformationList.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABInformationList.h rename to lib/asn1c/s1ap/S1AP_E-RABInformationList.h index 51d0f760f..f055777c4 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABInformationList.h +++ b/lib/asn1c/s1ap/S1AP_E-RABInformationList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABInformationListItem.c b/lib/asn1c/s1ap/S1AP_E-RABInformationListItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABInformationListItem.c rename to lib/asn1c/s1ap/S1AP_E-RABInformationListItem.c index 717e30f98..fca0f9d9c 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABInformationListItem.c +++ b/lib/asn1c/s1ap/S1AP_E-RABInformationListItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABInformationListItem.h b/lib/asn1c/s1ap/S1AP_E-RABInformationListItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABInformationListItem.h rename to lib/asn1c/s1ap/S1AP_E-RABInformationListItem.h index 9b5d5fc3b..e43c974ad 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABInformationListItem.h +++ b/lib/asn1c/s1ap/S1AP_E-RABInformationListItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABItem.c b/lib/asn1c/s1ap/S1AP_E-RABItem.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABItem.c rename to lib/asn1c/s1ap/S1AP_E-RABItem.c index 0577d1f1c..93a05c066 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABItem.c +++ b/lib/asn1c/s1ap/S1AP_E-RABItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABItem.h b/lib/asn1c/s1ap/S1AP_E-RABItem.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABItem.h rename to lib/asn1c/s1ap/S1AP_E-RABItem.h index fc543f82d..cf58f7f19 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABItem.h +++ b/lib/asn1c/s1ap/S1AP_E-RABItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABLevelQoSParameters.c b/lib/asn1c/s1ap/S1AP_E-RABLevelQoSParameters.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABLevelQoSParameters.c rename to lib/asn1c/s1ap/S1AP_E-RABLevelQoSParameters.c index 68fc80c7f..4b17a846d 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABLevelQoSParameters.c +++ b/lib/asn1c/s1ap/S1AP_E-RABLevelQoSParameters.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABLevelQoSParameters.h b/lib/asn1c/s1ap/S1AP_E-RABLevelQoSParameters.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABLevelQoSParameters.h rename to lib/asn1c/s1ap/S1AP_E-RABLevelQoSParameters.h index 63de84b50..5a3e3517c 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABLevelQoSParameters.h +++ b/lib/asn1c/s1ap/S1AP_E-RABLevelQoSParameters.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABList.c b/lib/asn1c/s1ap/S1AP_E-RABList.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABList.c rename to lib/asn1c/s1ap/S1AP_E-RABList.c index 1c4482322..ca2113e97 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABList.h b/lib/asn1c/s1ap/S1AP_E-RABList.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABList.h rename to lib/asn1c/s1ap/S1AP_E-RABList.h index 190dc644d..d5d405561 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABList.h +++ b/lib/asn1c/s1ap/S1AP_E-RABList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModificationConfirm.c b/lib/asn1c/s1ap/S1AP_E-RABModificationConfirm.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModificationConfirm.c rename to lib/asn1c/s1ap/S1AP_E-RABModificationConfirm.c index aa77581a3..9fac2d553 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModificationConfirm.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModificationConfirm.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModificationConfirm.h b/lib/asn1c/s1ap/S1AP_E-RABModificationConfirm.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABModificationConfirm.h rename to lib/asn1c/s1ap/S1AP_E-RABModificationConfirm.h index 3e984dab6..b6fde55b0 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModificationConfirm.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModificationConfirm.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModificationIndication.c b/lib/asn1c/s1ap/S1AP_E-RABModificationIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModificationIndication.c rename to lib/asn1c/s1ap/S1AP_E-RABModificationIndication.c index 3838bc74c..15e643f43 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModificationIndication.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModificationIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModificationIndication.h b/lib/asn1c/s1ap/S1AP_E-RABModificationIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABModificationIndication.h rename to lib/asn1c/s1ap/S1AP_E-RABModificationIndication.h index bbf6889bf..e6b5c76ad 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModificationIndication.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModificationIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModConf.c b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModConf.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModConf.c rename to lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModConf.c index 433d26aee..0e660193f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModConf.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModConf.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModConf.h b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModConf.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModConf.h rename to lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModConf.h index aa48a0cf8..0a2b85237 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModConf.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModConf.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModRes.c b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModRes.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModRes.c rename to lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModRes.c index a90a96688..c81a5ef07 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModRes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModRes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModRes.h b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModRes.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModRes.h rename to lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModRes.h index 4245cd967..a6d1909a4 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyItemBearerModRes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyItemBearerModRes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModConf.c b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModConf.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModConf.c rename to lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModConf.c index f1244fcd5..1b1e16b9f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModConf.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModConf.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModConf.h b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModConf.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModConf.h rename to lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModConf.h index 7d278eee1..6ec813694 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModConf.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModConf.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModRes.c b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModRes.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModRes.c rename to lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModRes.c index a23395911..194b02b5d 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModRes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModRes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModRes.h b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModRes.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModRes.h rename to lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModRes.h index 33a9a6e63..0e2def240 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyListBearerModRes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyListBearerModRes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyRequest.c b/lib/asn1c/s1ap/S1AP_E-RABModifyRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModifyRequest.c rename to lib/asn1c/s1ap/S1AP_E-RABModifyRequest.c index efe4777da..0237f521e 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyRequest.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyRequest.h b/lib/asn1c/s1ap/S1AP_E-RABModifyRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABModifyRequest.h rename to lib/asn1c/s1ap/S1AP_E-RABModifyRequest.h index a182e18db..81ac72a9f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyRequest.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyResponse.c b/lib/asn1c/s1ap/S1AP_E-RABModifyResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABModifyResponse.c rename to lib/asn1c/s1ap/S1AP_E-RABModifyResponse.c index 0c60141b3..927172487 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyResponse.c +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABModifyResponse.h b/lib/asn1c/s1ap/S1AP_E-RABModifyResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABModifyResponse.h rename to lib/asn1c/s1ap/S1AP_E-RABModifyResponse.h index 150457d39..9b8e98446 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABModifyResponse.h +++ b/lib/asn1c/s1ap/S1AP_E-RABModifyResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedItemBearerModInd.c b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedItemBearerModInd.c rename to lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.c index 9e96e74c3..f17717305 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedItemBearerModInd.c +++ b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedItemBearerModInd.h b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedItemBearerModInd.h rename to lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.h index d62c3f9a0..d19577114 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedItemBearerModInd.h +++ b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedItemBearerModInd.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedListBearerModInd.c b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedListBearerModInd.c rename to lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c index 5602c2055..645a8e490 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedListBearerModInd.c +++ b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedListBearerModInd.h b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedListBearerModInd.h rename to lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.h index 40e0f10c0..905ea8d13 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABNotToBeModifiedListBearerModInd.h +++ b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseCommand.c b/lib/asn1c/s1ap/S1AP_E-RABReleaseCommand.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseCommand.c rename to lib/asn1c/s1ap/S1AP_E-RABReleaseCommand.c index 5d5f3a404..feba0ef70 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseCommand.c +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseCommand.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseCommand.h b/lib/asn1c/s1ap/S1AP_E-RABReleaseCommand.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseCommand.h rename to lib/asn1c/s1ap/S1AP_E-RABReleaseCommand.h index dc5ecabbf..f8e72f237 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseCommand.h +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseCommand.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseIndication.c b/lib/asn1c/s1ap/S1AP_E-RABReleaseIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseIndication.c rename to lib/asn1c/s1ap/S1AP_E-RABReleaseIndication.c index 509614918..45e796c76 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseIndication.c +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseIndication.h b/lib/asn1c/s1ap/S1AP_E-RABReleaseIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseIndication.h rename to lib/asn1c/s1ap/S1AP_E-RABReleaseIndication.h index 748885090..378b0cd1c 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseIndication.h +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseItemBearerRelComp.c b/lib/asn1c/s1ap/S1AP_E-RABReleaseItemBearerRelComp.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseItemBearerRelComp.c rename to lib/asn1c/s1ap/S1AP_E-RABReleaseItemBearerRelComp.c index 1c37a10f5..ecc0ecf39 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseItemBearerRelComp.c +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseItemBearerRelComp.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseItemBearerRelComp.h b/lib/asn1c/s1ap/S1AP_E-RABReleaseItemBearerRelComp.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseItemBearerRelComp.h rename to lib/asn1c/s1ap/S1AP_E-RABReleaseItemBearerRelComp.h index 6b9251162..f71e95991 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseItemBearerRelComp.h +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseItemBearerRelComp.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseListBearerRelComp.c b/lib/asn1c/s1ap/S1AP_E-RABReleaseListBearerRelComp.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseListBearerRelComp.c rename to lib/asn1c/s1ap/S1AP_E-RABReleaseListBearerRelComp.c index 74de3d492..152e1d183 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseListBearerRelComp.c +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseListBearerRelComp.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseListBearerRelComp.h b/lib/asn1c/s1ap/S1AP_E-RABReleaseListBearerRelComp.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseListBearerRelComp.h rename to lib/asn1c/s1ap/S1AP_E-RABReleaseListBearerRelComp.h index 721fbfcab..62e105d11 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseListBearerRelComp.h +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseListBearerRelComp.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseResponse.c b/lib/asn1c/s1ap/S1AP_E-RABReleaseResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseResponse.c rename to lib/asn1c/s1ap/S1AP_E-RABReleaseResponse.c index c40203d8b..3c629b6f9 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseResponse.c +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABReleaseResponse.h b/lib/asn1c/s1ap/S1AP_E-RABReleaseResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABReleaseResponse.h rename to lib/asn1c/s1ap/S1AP_E-RABReleaseResponse.h index d2aaf3543..2e0aef009 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABReleaseResponse.h +++ b/lib/asn1c/s1ap/S1AP_E-RABReleaseResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupItemBearerSURes.c b/lib/asn1c/s1ap/S1AP_E-RABSetupItemBearerSURes.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABSetupItemBearerSURes.c rename to lib/asn1c/s1ap/S1AP_E-RABSetupItemBearerSURes.c index a328f745b..411ad4f73 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupItemBearerSURes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupItemBearerSURes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupItemBearerSURes.h b/lib/asn1c/s1ap/S1AP_E-RABSetupItemBearerSURes.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABSetupItemBearerSURes.h rename to lib/asn1c/s1ap/S1AP_E-RABSetupItemBearerSURes.h index 6be2948a6..c2822b6e5 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupItemBearerSURes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupItemBearerSURes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupItemCtxtSURes.c b/lib/asn1c/s1ap/S1AP_E-RABSetupItemCtxtSURes.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABSetupItemCtxtSURes.c rename to lib/asn1c/s1ap/S1AP_E-RABSetupItemCtxtSURes.c index d3dfa383e..01eff91e1 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupItemCtxtSURes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupItemCtxtSURes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupItemCtxtSURes.h b/lib/asn1c/s1ap/S1AP_E-RABSetupItemCtxtSURes.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABSetupItemCtxtSURes.h rename to lib/asn1c/s1ap/S1AP_E-RABSetupItemCtxtSURes.h index 0bdaf0159..75f6b18c1 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupItemCtxtSURes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupItemCtxtSURes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupListBearerSURes.c b/lib/asn1c/s1ap/S1AP_E-RABSetupListBearerSURes.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABSetupListBearerSURes.c rename to lib/asn1c/s1ap/S1AP_E-RABSetupListBearerSURes.c index 2f1183e7c..771570bdf 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupListBearerSURes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupListBearerSURes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupListBearerSURes.h b/lib/asn1c/s1ap/S1AP_E-RABSetupListBearerSURes.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABSetupListBearerSURes.h rename to lib/asn1c/s1ap/S1AP_E-RABSetupListBearerSURes.h index 6ec96d10b..7a55ac086 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupListBearerSURes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupListBearerSURes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupListCtxtSURes.c b/lib/asn1c/s1ap/S1AP_E-RABSetupListCtxtSURes.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABSetupListCtxtSURes.c rename to lib/asn1c/s1ap/S1AP_E-RABSetupListCtxtSURes.c index a9a64df9f..b337a8046 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupListCtxtSURes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupListCtxtSURes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupListCtxtSURes.h b/lib/asn1c/s1ap/S1AP_E-RABSetupListCtxtSURes.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABSetupListCtxtSURes.h rename to lib/asn1c/s1ap/S1AP_E-RABSetupListCtxtSURes.h index 07999a0b1..a91ba4b21 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupListCtxtSURes.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupListCtxtSURes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupRequest.c b/lib/asn1c/s1ap/S1AP_E-RABSetupRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABSetupRequest.c rename to lib/asn1c/s1ap/S1AP_E-RABSetupRequest.c index 66dc3febf..6503a4426 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupRequest.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupRequest.h b/lib/asn1c/s1ap/S1AP_E-RABSetupRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABSetupRequest.h rename to lib/asn1c/s1ap/S1AP_E-RABSetupRequest.h index 79e324593..f3060c144 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupRequest.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupResponse.c b/lib/asn1c/s1ap/S1AP_E-RABSetupResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABSetupResponse.c rename to lib/asn1c/s1ap/S1AP_E-RABSetupResponse.c index af416b16b..550aaf29c 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupResponse.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSetupResponse.h b/lib/asn1c/s1ap/S1AP_E-RABSetupResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABSetupResponse.h rename to lib/asn1c/s1ap/S1AP_E-RABSetupResponse.h index 115f60e4b..0ea709180 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSetupResponse.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSetupResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSubjecttoDataForwardingList.c b/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABSubjecttoDataForwardingList.c rename to lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c index f7defdc2d..8fdf0f159 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSubjecttoDataForwardingList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABSubjecttoDataForwardingList.h b/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABSubjecttoDataForwardingList.h rename to lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.h index 1495d575b..258a7b9b3 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABSubjecttoDataForwardingList.h +++ b/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModInd.c b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModInd.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.c index 83f75ce90..7751b9a6f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModInd.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModInd.h b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModInd.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.h index 3a7006082..63c4823ad 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModInd.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModInd.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.c index 77c178d93..900bb7771 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.h index 8db1ed870..c0096b102 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedItemBearerModReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedItemBearerModReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModInd.c b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModInd.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c index 1322967e4..3a07e902f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModInd.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModInd.h b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModInd.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.h index 894c02df7..3c04dd9dc 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModInd.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModReq.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModReq.c index 86ddf5896..894c0e894 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModReq.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModReq.h index d11f01b3d..de08f6466 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeModifiedListBearerModReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemBearerSUReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemBearerSUReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.c index 18c493509..824a635b3 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemBearerSUReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemBearerSUReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemBearerSUReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.h index eed354eb1..66fca897d 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemBearerSUReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemBearerSUReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemCtxtSUReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemCtxtSUReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.c index 49eacbe72..c2b65bb63 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemCtxtSUReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemCtxtSUReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemCtxtSUReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.h index 6028797f0..3448fb92d 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemCtxtSUReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemCtxtSUReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemHOReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemHOReq.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemHOReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemHOReq.c index d73b3d189..f7ca9f1af 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemHOReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemHOReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemHOReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemHOReq.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemHOReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemHOReq.h index 74994c3c7..2050df29d 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupItemHOReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupItemHOReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListBearerSUReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListBearerSUReq.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupListBearerSUReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupListBearerSUReq.c index a230c986a..f7caa227f 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListBearerSUReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListBearerSUReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListBearerSUReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListBearerSUReq.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupListBearerSUReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupListBearerSUReq.h index 772fb729c..7653d0d7e 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListBearerSUReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListBearerSUReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListCtxtSUReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupListCtxtSUReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.c index 490128104..18b137aba 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListCtxtSUReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListCtxtSUReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupListCtxtSUReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.h index 613202dbb..dcdb72c21 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListCtxtSUReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListCtxtSUReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListHOReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupListHOReq.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c index bc1fbd015..64c659af2 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListHOReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListHOReq.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSetupListHOReq.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.h index b757e77ca..33d5b3f3e 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSetupListHOReq.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLItem.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLItem.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLItem.c index f3724a5e2..b0aa34c60 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLItem.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLItem.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLItem.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLItem.h index 3784c2edb..e37e16f68 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLItem.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLList.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLList.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c index b181506e9..bc0def666 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLList.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLList.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.h index da54b6511..3ae7ddedd 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedDLList.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULItem.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULItem.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULItem.c index 5b062bf3f..a4a665e74 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULItem.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULItem.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULItem.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULItem.h index a0d782afb..6d5bdca93 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULItem.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULList.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULList.c rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c index 98fe6d04b..3aa8513a0 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULList.h b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULList.h rename to lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.h index 1c4735f91..61e680403 100644 --- a/lib/s1ap/asn1c/S1AP_E-RABToBeSwitchedULList.h +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-UTRAN-Trace-ID.c b/lib/asn1c/s1ap/S1AP_E-UTRAN-Trace-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_E-UTRAN-Trace-ID.c rename to lib/asn1c/s1ap/S1AP_E-UTRAN-Trace-ID.c index d47cb2b64..2d53ad20b 100644 --- a/lib/s1ap/asn1c/S1AP_E-UTRAN-Trace-ID.c +++ b/lib/asn1c/s1ap/S1AP_E-UTRAN-Trace-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_E-UTRAN-Trace-ID.h b/lib/asn1c/s1ap/S1AP_E-UTRAN-Trace-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_E-UTRAN-Trace-ID.h rename to lib/asn1c/s1ap/S1AP_E-UTRAN-Trace-ID.h index 205dc7337..58d2c3212 100644 --- a/lib/s1ap/asn1c/S1AP_E-UTRAN-Trace-ID.h +++ b/lib/asn1c/s1ap/S1AP_E-UTRAN-Trace-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EARFCN.c b/lib/asn1c/s1ap/S1AP_EARFCN.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EARFCN.c rename to lib/asn1c/s1ap/S1AP_EARFCN.c index 0a2ba890c..b8d8d1695 100644 --- a/lib/s1ap/asn1c/S1AP_EARFCN.c +++ b/lib/asn1c/s1ap/S1AP_EARFCN.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EARFCN.h b/lib/asn1c/s1ap/S1AP_EARFCN.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_EARFCN.h rename to lib/asn1c/s1ap/S1AP_EARFCN.h index a6dac5e47..dc8fcb0f5 100644 --- a/lib/s1ap/asn1c/S1AP_EARFCN.h +++ b/lib/asn1c/s1ap/S1AP_EARFCN.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ECGI-List.c b/lib/asn1c/s1ap/S1AP_ECGI-List.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ECGI-List.c rename to lib/asn1c/s1ap/S1AP_ECGI-List.c index 5e5dd4584..d0f19e3bd 100644 --- a/lib/s1ap/asn1c/S1AP_ECGI-List.c +++ b/lib/asn1c/s1ap/S1AP_ECGI-List.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ECGI-List.h b/lib/asn1c/s1ap/S1AP_ECGI-List.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ECGI-List.h rename to lib/asn1c/s1ap/S1AP_ECGI-List.h index 372064742..cbf396f8a 100644 --- a/lib/s1ap/asn1c/S1AP_ECGI-List.h +++ b/lib/asn1c/s1ap/S1AP_ECGI-List.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ECGIList.c b/lib/asn1c/s1ap/S1AP_ECGIList.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ECGIList.c rename to lib/asn1c/s1ap/S1AP_ECGIList.c index d292c47c5..acddb715c 100644 --- a/lib/s1ap/asn1c/S1AP_ECGIList.c +++ b/lib/asn1c/s1ap/S1AP_ECGIList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ECGIList.h b/lib/asn1c/s1ap/S1AP_ECGIList.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ECGIList.h rename to lib/asn1c/s1ap/S1AP_ECGIList.h index 8ae0f21a0..3b368a923 100644 --- a/lib/s1ap/asn1c/S1AP_ECGIList.h +++ b/lib/asn1c/s1ap/S1AP_ECGIList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ECGIListForRestart.c b/lib/asn1c/s1ap/S1AP_ECGIListForRestart.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ECGIListForRestart.c rename to lib/asn1c/s1ap/S1AP_ECGIListForRestart.c index bcb6b3b16..1d42574c5 100644 --- a/lib/s1ap/asn1c/S1AP_ECGIListForRestart.c +++ b/lib/asn1c/s1ap/S1AP_ECGIListForRestart.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ECGIListForRestart.h b/lib/asn1c/s1ap/S1AP_ECGIListForRestart.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ECGIListForRestart.h rename to lib/asn1c/s1ap/S1AP_ECGIListForRestart.h index 65988a0cb..e42ae06a9 100644 --- a/lib/s1ap/asn1c/S1AP_ECGIListForRestart.h +++ b/lib/asn1c/s1ap/S1AP_ECGIListForRestart.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENB-ID.c b/lib/asn1c/s1ap/S1AP_ENB-ID.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ENB-ID.c rename to lib/asn1c/s1ap/S1AP_ENB-ID.c index 0d5cf5d21..9ed3ac747 100644 --- a/lib/s1ap/asn1c/S1AP_ENB-ID.c +++ b/lib/asn1c/s1ap/S1AP_ENB-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENB-ID.h b/lib/asn1c/s1ap/S1AP_ENB-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ENB-ID.h rename to lib/asn1c/s1ap/S1AP_ENB-ID.h index fd321d5b9..122eb77d7 100644 --- a/lib/s1ap/asn1c/S1AP_ENB-ID.h +++ b/lib/asn1c/s1ap/S1AP_ENB-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENB-StatusTransfer-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ENB-StatusTransfer-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.c index 18d225bd4..10f6c8fbb 100644 --- a/lib/s1ap/asn1c/S1AP_ENB-StatusTransfer-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENB-StatusTransfer-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENB-StatusTransfer-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.h index 6a92cfcd6..2cc5e8270 100644 --- a/lib/s1ap/asn1c/S1AP_ENB-StatusTransfer-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_ENB-StatusTransfer-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENB-UE-S1AP-ID.c b/lib/asn1c/s1ap/S1AP_ENB-UE-S1AP-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENB-UE-S1AP-ID.c rename to lib/asn1c/s1ap/S1AP_ENB-UE-S1AP-ID.c index e1748e4b6..253c0a943 100644 --- a/lib/s1ap/asn1c/S1AP_ENB-UE-S1AP-ID.c +++ b/lib/asn1c/s1ap/S1AP_ENB-UE-S1AP-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENB-UE-S1AP-ID.h b/lib/asn1c/s1ap/S1AP_ENB-UE-S1AP-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ENB-UE-S1AP-ID.h rename to lib/asn1c/s1ap/S1AP_ENB-UE-S1AP-ID.h index f4574e61e..1315858c3 100644 --- a/lib/s1ap/asn1c/S1AP_ENB-UE-S1AP-ID.h +++ b/lib/asn1c/s1ap/S1AP_ENB-UE-S1AP-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBCPRelocationIndication.c b/lib/asn1c/s1ap/S1AP_ENBCPRelocationIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBCPRelocationIndication.c rename to lib/asn1c/s1ap/S1AP_ENBCPRelocationIndication.c index 11d02d2ee..29347f443 100644 --- a/lib/s1ap/asn1c/S1AP_ENBCPRelocationIndication.c +++ b/lib/asn1c/s1ap/S1AP_ENBCPRelocationIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBCPRelocationIndication.h b/lib/asn1c/s1ap/S1AP_ENBCPRelocationIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBCPRelocationIndication.h rename to lib/asn1c/s1ap/S1AP_ENBCPRelocationIndication.h index 56244e947..8fe55e008 100644 --- a/lib/s1ap/asn1c/S1AP_ENBCPRelocationIndication.h +++ b/lib/asn1c/s1ap/S1AP_ENBCPRelocationIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationTransfer.c b/lib/asn1c/s1ap/S1AP_ENBConfigurationTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationTransfer.c rename to lib/asn1c/s1ap/S1AP_ENBConfigurationTransfer.c index df2b40b7e..575ecf2eb 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationTransfer.c +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationTransfer.h b/lib/asn1c/s1ap/S1AP_ENBConfigurationTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationTransfer.h rename to lib/asn1c/s1ap/S1AP_ENBConfigurationTransfer.h index 3b26a0d91..8181ef530 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationTransfer.h +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdate.c b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdate.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationUpdate.c rename to lib/asn1c/s1ap/S1AP_ENBConfigurationUpdate.c index 0d72f9a18..d8e476b47 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdate.c +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdate.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdate.h b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdate.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationUpdate.h rename to lib/asn1c/s1ap/S1AP_ENBConfigurationUpdate.h index 5188dff76..90ff5b7a4 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdate.h +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdate.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateAcknowledge.c b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateAcknowledge.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateAcknowledge.c rename to lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateAcknowledge.c index 8f03401ae..a3b84891b 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateAcknowledge.c +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateAcknowledge.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateAcknowledge.h b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateAcknowledge.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateAcknowledge.h rename to lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateAcknowledge.h index c27923c34..38f81f927 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateAcknowledge.h +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateAcknowledge.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateFailure.c b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateFailure.c rename to lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateFailure.c index 2d644cfe4..41f98b5f6 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateFailure.c +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateFailure.h b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateFailure.h rename to lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateFailure.h index 83dfc77f1..ebef47d08 100644 --- a/lib/s1ap/asn1c/S1AP_ENBConfigurationUpdateFailure.h +++ b/lib/asn1c/s1ap/S1AP_ENBConfigurationUpdateFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBDirectInformationTransfer.c b/lib/asn1c/s1ap/S1AP_ENBDirectInformationTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBDirectInformationTransfer.c rename to lib/asn1c/s1ap/S1AP_ENBDirectInformationTransfer.c index d17b1e186..bd1e4029b 100644 --- a/lib/s1ap/asn1c/S1AP_ENBDirectInformationTransfer.c +++ b/lib/asn1c/s1ap/S1AP_ENBDirectInformationTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBDirectInformationTransfer.h b/lib/asn1c/s1ap/S1AP_ENBDirectInformationTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBDirectInformationTransfer.h rename to lib/asn1c/s1ap/S1AP_ENBDirectInformationTransfer.h index 6c4eb5260..a5d465584 100644 --- a/lib/s1ap/asn1c/S1AP_ENBDirectInformationTransfer.h +++ b/lib/asn1c/s1ap/S1AP_ENBDirectInformationTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBIndirectX2TransportLayerAddresses.c b/lib/asn1c/s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBIndirectX2TransportLayerAddresses.c rename to lib/asn1c/s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.c index 0172fb057..f0c47079a 100644 --- a/lib/s1ap/asn1c/S1AP_ENBIndirectX2TransportLayerAddresses.c +++ b/lib/asn1c/s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBIndirectX2TransportLayerAddresses.h b/lib/asn1c/s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ENBIndirectX2TransportLayerAddresses.h rename to lib/asn1c/s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.h index 3b48a7671..f9bdb7cdb 100644 --- a/lib/s1ap/asn1c/S1AP_ENBIndirectX2TransportLayerAddresses.h +++ b/lib/asn1c/s1ap/S1AP_ENBIndirectX2TransportLayerAddresses.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBStatusTransfer.c b/lib/asn1c/s1ap/S1AP_ENBStatusTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBStatusTransfer.c rename to lib/asn1c/s1ap/S1AP_ENBStatusTransfer.c index 411466933..9f21a259b 100644 --- a/lib/s1ap/asn1c/S1AP_ENBStatusTransfer.c +++ b/lib/asn1c/s1ap/S1AP_ENBStatusTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBStatusTransfer.h b/lib/asn1c/s1ap/S1AP_ENBStatusTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBStatusTransfer.h rename to lib/asn1c/s1ap/S1AP_ENBStatusTransfer.h index b603ab361..2147114b1 100644 --- a/lib/s1ap/asn1c/S1AP_ENBStatusTransfer.h +++ b/lib/asn1c/s1ap/S1AP_ENBStatusTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLA.c b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLA.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBX2ExtTLA.c rename to lib/asn1c/s1ap/S1AP_ENBX2ExtTLA.c index 122f8f27f..5d72b073d 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLA.c +++ b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLA.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLA.h b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLA.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBX2ExtTLA.h rename to lib/asn1c/s1ap/S1AP_ENBX2ExtTLA.h index 7b432db41..a120da79e 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLA.h +++ b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLA.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLAs.c b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLAs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ENBX2ExtTLAs.c rename to lib/asn1c/s1ap/S1AP_ENBX2ExtTLAs.c index 711ea1e2f..b83e1fda3 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLAs.c +++ b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLAs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLAs.h b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLAs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ENBX2ExtTLAs.h rename to lib/asn1c/s1ap/S1AP_ENBX2ExtTLAs.h index 34204b132..277da7116 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2ExtTLAs.h +++ b/lib/asn1c/s1ap/S1AP_ENBX2ExtTLAs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2GTPTLAs.c b/lib/asn1c/s1ap/S1AP_ENBX2GTPTLAs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ENBX2GTPTLAs.c rename to lib/asn1c/s1ap/S1AP_ENBX2GTPTLAs.c index fef6b8d15..ad72a0436 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2GTPTLAs.c +++ b/lib/asn1c/s1ap/S1AP_ENBX2GTPTLAs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2GTPTLAs.h b/lib/asn1c/s1ap/S1AP_ENBX2GTPTLAs.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBX2GTPTLAs.h rename to lib/asn1c/s1ap/S1AP_ENBX2GTPTLAs.h index 2075e9f39..22c74af64 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2GTPTLAs.h +++ b/lib/asn1c/s1ap/S1AP_ENBX2GTPTLAs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2TLAs.c b/lib/asn1c/s1ap/S1AP_ENBX2TLAs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ENBX2TLAs.c rename to lib/asn1c/s1ap/S1AP_ENBX2TLAs.c index 1ff5eaca4..31ea816d4 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2TLAs.c +++ b/lib/asn1c/s1ap/S1AP_ENBX2TLAs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBX2TLAs.h b/lib/asn1c/s1ap/S1AP_ENBX2TLAs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ENBX2TLAs.h rename to lib/asn1c/s1ap/S1AP_ENBX2TLAs.h index 73fbe8461..91d6c23bf 100644 --- a/lib/s1ap/asn1c/S1AP_ENBX2TLAs.h +++ b/lib/asn1c/s1ap/S1AP_ENBX2TLAs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBname.c b/lib/asn1c/s1ap/S1AP_ENBname.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ENBname.c rename to lib/asn1c/s1ap/S1AP_ENBname.c index e20fa6991..dc2528ea9 100644 --- a/lib/s1ap/asn1c/S1AP_ENBname.c +++ b/lib/asn1c/s1ap/S1AP_ENBname.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ENBname.h b/lib/asn1c/s1ap/S1AP_ENBname.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ENBname.h rename to lib/asn1c/s1ap/S1AP_ENBname.h index a9073c956..1f7c3dcd0 100644 --- a/lib/s1ap/asn1c/S1AP_ENBname.h +++ b/lib/asn1c/s1ap/S1AP_ENBname.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EPLMNs.c b/lib/asn1c/s1ap/S1AP_EPLMNs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_EPLMNs.c rename to lib/asn1c/s1ap/S1AP_EPLMNs.c index 316996661..036f6b4db 100644 --- a/lib/s1ap/asn1c/S1AP_EPLMNs.c +++ b/lib/asn1c/s1ap/S1AP_EPLMNs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EPLMNs.h b/lib/asn1c/s1ap/S1AP_EPLMNs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_EPLMNs.h rename to lib/asn1c/s1ap/S1AP_EPLMNs.h index 74a7cfe19..db6a1074b 100644 --- a/lib/s1ap/asn1c/S1AP_EPLMNs.h +++ b/lib/asn1c/s1ap/S1AP_EPLMNs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EUTRAN-CGI.c b/lib/asn1c/s1ap/S1AP_EUTRAN-CGI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EUTRAN-CGI.c rename to lib/asn1c/s1ap/S1AP_EUTRAN-CGI.c index 4e99add0e..e3d8ba9dc 100644 --- a/lib/s1ap/asn1c/S1AP_EUTRAN-CGI.c +++ b/lib/asn1c/s1ap/S1AP_EUTRAN-CGI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EUTRAN-CGI.h b/lib/asn1c/s1ap/S1AP_EUTRAN-CGI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_EUTRAN-CGI.h rename to lib/asn1c/s1ap/S1AP_EUTRAN-CGI.h index 8f44fdea7..b0460602b 100644 --- a/lib/s1ap/asn1c/S1AP_EUTRAN-CGI.h +++ b/lib/asn1c/s1ap/S1AP_EUTRAN-CGI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EUTRANRoundTripDelayEstimationInfo.c b/lib/asn1c/s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EUTRANRoundTripDelayEstimationInfo.c rename to lib/asn1c/s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.c index a5c654bdd..f89f93b50 100644 --- a/lib/s1ap/asn1c/S1AP_EUTRANRoundTripDelayEstimationInfo.c +++ b/lib/asn1c/s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EUTRANRoundTripDelayEstimationInfo.h b/lib/asn1c/s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EUTRANRoundTripDelayEstimationInfo.h rename to lib/asn1c/s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.h index 82ab563b7..27aa9b01b 100644 --- a/lib/s1ap/asn1c/S1AP_EUTRANRoundTripDelayEstimationInfo.h +++ b/lib/asn1c/s1ap/S1AP_EUTRANRoundTripDelayEstimationInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast-Item.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast-Item.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast-Item.c index 433bfb869..17c437544 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast-Item.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast-Item.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast-Item.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast-Item.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast-Item.h index 7c60569a4..f88a61830 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast-Item.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast.c index 47b8246fe..4164080ca 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast.h index 595789a08..23b6edf5e 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Broadcast.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Broadcast.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled-Item.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled-Item.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled-Item.c index 9242877ef..ad3a2fb61 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled-Item.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled-Item.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled-Item.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled-Item.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled-Item.h index 6d4c73cd3..89b67fe34 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled-Item.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled.c index 31833f88b..c818bd0c7 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled.h index 451129d39..b8310b3bd 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID-Cancelled.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID-Cancelled.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID.c index fbc8e8d86..189c2f3fa 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaID.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaID.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaID.h index 8489bbe0b..291132b52 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaID.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDList.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaIDList.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaIDList.c index b1c99de56..14a13aa28 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDList.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDList.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDList.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaIDList.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaIDList.h index 2816e7a9e..2dbda5b49 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDList.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDListForRestart.c b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDListForRestart.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaIDListForRestart.c rename to lib/asn1c/s1ap/S1AP_EmergencyAreaIDListForRestart.c index a36810770..ca00c0ea4 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDListForRestart.c +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDListForRestart.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDListForRestart.h b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDListForRestart.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_EmergencyAreaIDListForRestart.h rename to lib/asn1c/s1ap/S1AP_EmergencyAreaIDListForRestart.h index c82020e94..3bd07fe8a 100644 --- a/lib/s1ap/asn1c/S1AP_EmergencyAreaIDListForRestart.h +++ b/lib/asn1c/s1ap/S1AP_EmergencyAreaIDListForRestart.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EncryptionAlgorithms.c b/lib/asn1c/s1ap/S1AP_EncryptionAlgorithms.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EncryptionAlgorithms.c rename to lib/asn1c/s1ap/S1AP_EncryptionAlgorithms.c index 00d8a37b2..e173fba3c 100644 --- a/lib/s1ap/asn1c/S1AP_EncryptionAlgorithms.c +++ b/lib/asn1c/s1ap/S1AP_EncryptionAlgorithms.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EncryptionAlgorithms.h b/lib/asn1c/s1ap/S1AP_EncryptionAlgorithms.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EncryptionAlgorithms.h rename to lib/asn1c/s1ap/S1AP_EncryptionAlgorithms.h index 23f446d23..47944c29e 100644 --- a/lib/s1ap/asn1c/S1AP_EncryptionAlgorithms.h +++ b/lib/asn1c/s1ap/S1AP_EncryptionAlgorithms.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EnhancedCoverageRestricted.c b/lib/asn1c/s1ap/S1AP_EnhancedCoverageRestricted.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EnhancedCoverageRestricted.c rename to lib/asn1c/s1ap/S1AP_EnhancedCoverageRestricted.c index 103ece727..1098fbfd6 100644 --- a/lib/s1ap/asn1c/S1AP_EnhancedCoverageRestricted.c +++ b/lib/asn1c/s1ap/S1AP_EnhancedCoverageRestricted.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EnhancedCoverageRestricted.h b/lib/asn1c/s1ap/S1AP_EnhancedCoverageRestricted.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EnhancedCoverageRestricted.h rename to lib/asn1c/s1ap/S1AP_EnhancedCoverageRestricted.h index f901b0dc8..027e6bc14 100644 --- a/lib/s1ap/asn1c/S1AP_EnhancedCoverageRestricted.h +++ b/lib/asn1c/s1ap/S1AP_EnhancedCoverageRestricted.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ErrorIndication.c b/lib/asn1c/s1ap/S1AP_ErrorIndication.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ErrorIndication.c rename to lib/asn1c/s1ap/S1AP_ErrorIndication.c index b80b529eb..818c15722 100644 --- a/lib/s1ap/asn1c/S1AP_ErrorIndication.c +++ b/lib/asn1c/s1ap/S1AP_ErrorIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ErrorIndication.h b/lib/asn1c/s1ap/S1AP_ErrorIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ErrorIndication.h rename to lib/asn1c/s1ap/S1AP_ErrorIndication.h index c40abba78..b84b8ab15 100644 --- a/lib/s1ap/asn1c/S1AP_ErrorIndication.h +++ b/lib/asn1c/s1ap/S1AP_ErrorIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EventType.c b/lib/asn1c/s1ap/S1AP_EventType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_EventType.c rename to lib/asn1c/s1ap/S1AP_EventType.c index 75855e096..ed00a3079 100644 --- a/lib/s1ap/asn1c/S1AP_EventType.c +++ b/lib/asn1c/s1ap/S1AP_EventType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_EventType.h b/lib/asn1c/s1ap/S1AP_EventType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_EventType.h rename to lib/asn1c/s1ap/S1AP_EventType.h index 9a96df8ab..676bfed93 100644 --- a/lib/s1ap/asn1c/S1AP_EventType.h +++ b/lib/asn1c/s1ap/S1AP_EventType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedActivityPeriod.c b/lib/asn1c/s1ap/S1AP_ExpectedActivityPeriod.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ExpectedActivityPeriod.c rename to lib/asn1c/s1ap/S1AP_ExpectedActivityPeriod.c index 731ccffb6..580c8bc97 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedActivityPeriod.c +++ b/lib/asn1c/s1ap/S1AP_ExpectedActivityPeriod.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedActivityPeriod.h b/lib/asn1c/s1ap/S1AP_ExpectedActivityPeriod.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ExpectedActivityPeriod.h rename to lib/asn1c/s1ap/S1AP_ExpectedActivityPeriod.h index c25339feb..76296868f 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedActivityPeriod.h +++ b/lib/asn1c/s1ap/S1AP_ExpectedActivityPeriod.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedHOInterval.c b/lib/asn1c/s1ap/S1AP_ExpectedHOInterval.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ExpectedHOInterval.c rename to lib/asn1c/s1ap/S1AP_ExpectedHOInterval.c index 33fb385df..93b8b0e4e 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedHOInterval.c +++ b/lib/asn1c/s1ap/S1AP_ExpectedHOInterval.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedHOInterval.h b/lib/asn1c/s1ap/S1AP_ExpectedHOInterval.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ExpectedHOInterval.h rename to lib/asn1c/s1ap/S1AP_ExpectedHOInterval.h index ad7aced73..678c061a3 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedHOInterval.h +++ b/lib/asn1c/s1ap/S1AP_ExpectedHOInterval.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedIdlePeriod.c b/lib/asn1c/s1ap/S1AP_ExpectedIdlePeriod.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ExpectedIdlePeriod.c rename to lib/asn1c/s1ap/S1AP_ExpectedIdlePeriod.c index ef03af5d1..121a8993e 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedIdlePeriod.c +++ b/lib/asn1c/s1ap/S1AP_ExpectedIdlePeriod.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedIdlePeriod.h b/lib/asn1c/s1ap/S1AP_ExpectedIdlePeriod.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ExpectedIdlePeriod.h rename to lib/asn1c/s1ap/S1AP_ExpectedIdlePeriod.h index 71f20b0ab..c4b06bbb3 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedIdlePeriod.h +++ b/lib/asn1c/s1ap/S1AP_ExpectedIdlePeriod.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedUEActivityBehaviour.c b/lib/asn1c/s1ap/S1AP_ExpectedUEActivityBehaviour.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ExpectedUEActivityBehaviour.c rename to lib/asn1c/s1ap/S1AP_ExpectedUEActivityBehaviour.c index e0a233f85..6f4f8e664 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedUEActivityBehaviour.c +++ b/lib/asn1c/s1ap/S1AP_ExpectedUEActivityBehaviour.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedUEActivityBehaviour.h b/lib/asn1c/s1ap/S1AP_ExpectedUEActivityBehaviour.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ExpectedUEActivityBehaviour.h rename to lib/asn1c/s1ap/S1AP_ExpectedUEActivityBehaviour.h index c54ac0952..71c3916cb 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedUEActivityBehaviour.h +++ b/lib/asn1c/s1ap/S1AP_ExpectedUEActivityBehaviour.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedUEBehaviour.c b/lib/asn1c/s1ap/S1AP_ExpectedUEBehaviour.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ExpectedUEBehaviour.c rename to lib/asn1c/s1ap/S1AP_ExpectedUEBehaviour.c index 82990e80d..ff269c351 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedUEBehaviour.c +++ b/lib/asn1c/s1ap/S1AP_ExpectedUEBehaviour.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExpectedUEBehaviour.h b/lib/asn1c/s1ap/S1AP_ExpectedUEBehaviour.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ExpectedUEBehaviour.h rename to lib/asn1c/s1ap/S1AP_ExpectedUEBehaviour.h index e16386a4c..0c1d6ed32 100644 --- a/lib/s1ap/asn1c/S1AP_ExpectedUEBehaviour.h +++ b/lib/asn1c/s1ap/S1AP_ExpectedUEBehaviour.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Extended-UEIdentityIndexValue.c b/lib/asn1c/s1ap/S1AP_Extended-UEIdentityIndexValue.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Extended-UEIdentityIndexValue.c rename to lib/asn1c/s1ap/S1AP_Extended-UEIdentityIndexValue.c index a61ca932d..1f4e08ebf 100644 --- a/lib/s1ap/asn1c/S1AP_Extended-UEIdentityIndexValue.c +++ b/lib/asn1c/s1ap/S1AP_Extended-UEIdentityIndexValue.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Extended-UEIdentityIndexValue.h b/lib/asn1c/s1ap/S1AP_Extended-UEIdentityIndexValue.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Extended-UEIdentityIndexValue.h rename to lib/asn1c/s1ap/S1AP_Extended-UEIdentityIndexValue.h index 88f25197e..e9bcb6947 100644 --- a/lib/s1ap/asn1c/S1AP_Extended-UEIdentityIndexValue.h +++ b/lib/asn1c/s1ap/S1AP_Extended-UEIdentityIndexValue.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExtendedRNC-ID.c b/lib/asn1c/s1ap/S1AP_ExtendedRNC-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ExtendedRNC-ID.c rename to lib/asn1c/s1ap/S1AP_ExtendedRNC-ID.c index f42f8041b..157a9e6f6 100644 --- a/lib/s1ap/asn1c/S1AP_ExtendedRNC-ID.c +++ b/lib/asn1c/s1ap/S1AP_ExtendedRNC-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExtendedRNC-ID.h b/lib/asn1c/s1ap/S1AP_ExtendedRNC-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ExtendedRNC-ID.h rename to lib/asn1c/s1ap/S1AP_ExtendedRNC-ID.h index b29bf16ae..61738e95d 100644 --- a/lib/s1ap/asn1c/S1AP_ExtendedRNC-ID.h +++ b/lib/asn1c/s1ap/S1AP_ExtendedRNC-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExtendedRepetitionPeriod.c b/lib/asn1c/s1ap/S1AP_ExtendedRepetitionPeriod.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ExtendedRepetitionPeriod.c rename to lib/asn1c/s1ap/S1AP_ExtendedRepetitionPeriod.c index f98580916..e11865a0c 100644 --- a/lib/s1ap/asn1c/S1AP_ExtendedRepetitionPeriod.c +++ b/lib/asn1c/s1ap/S1AP_ExtendedRepetitionPeriod.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ExtendedRepetitionPeriod.h b/lib/asn1c/s1ap/S1AP_ExtendedRepetitionPeriod.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ExtendedRepetitionPeriod.h rename to lib/asn1c/s1ap/S1AP_ExtendedRepetitionPeriod.h index f50f4e044..456ad1c29 100644 --- a/lib/s1ap/asn1c/S1AP_ExtendedRepetitionPeriod.h +++ b/lib/asn1c/s1ap/S1AP_ExtendedRepetitionPeriod.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenInterRATs.c b/lib/asn1c/s1ap/S1AP_ForbiddenInterRATs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ForbiddenInterRATs.c rename to lib/asn1c/s1ap/S1AP_ForbiddenInterRATs.c index b76ccf327..4a9da0918 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenInterRATs.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenInterRATs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenInterRATs.h b/lib/asn1c/s1ap/S1AP_ForbiddenInterRATs.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ForbiddenInterRATs.h rename to lib/asn1c/s1ap/S1AP_ForbiddenInterRATs.h index 9f1b030ef..3dacc8568 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenInterRATs.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenInterRATs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenLACs.c b/lib/asn1c/s1ap/S1AP_ForbiddenLACs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ForbiddenLACs.c rename to lib/asn1c/s1ap/S1AP_ForbiddenLACs.c index 0341eebe2..c6974f03b 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenLACs.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenLACs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenLACs.h b/lib/asn1c/s1ap/S1AP_ForbiddenLACs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ForbiddenLACs.h rename to lib/asn1c/s1ap/S1AP_ForbiddenLACs.h index 3be827a27..5c5c1428f 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenLACs.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenLACs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenLAs-Item.c b/lib/asn1c/s1ap/S1AP_ForbiddenLAs-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ForbiddenLAs-Item.c rename to lib/asn1c/s1ap/S1AP_ForbiddenLAs-Item.c index 6ff4b94cf..07857ec72 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenLAs-Item.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenLAs-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenLAs-Item.h b/lib/asn1c/s1ap/S1AP_ForbiddenLAs-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ForbiddenLAs-Item.h rename to lib/asn1c/s1ap/S1AP_ForbiddenLAs-Item.h index 2882350bd..915e08a14 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenLAs-Item.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenLAs-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenLAs.c b/lib/asn1c/s1ap/S1AP_ForbiddenLAs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ForbiddenLAs.c rename to lib/asn1c/s1ap/S1AP_ForbiddenLAs.c index 162be4824..3c35676ec 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenLAs.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenLAs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenLAs.h b/lib/asn1c/s1ap/S1AP_ForbiddenLAs.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ForbiddenLAs.h rename to lib/asn1c/s1ap/S1AP_ForbiddenLAs.h index 3adaef525..e1f9b9dda 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenLAs.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenLAs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenTACs.c b/lib/asn1c/s1ap/S1AP_ForbiddenTACs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ForbiddenTACs.c rename to lib/asn1c/s1ap/S1AP_ForbiddenTACs.c index c34f6bc6a..7cece2b71 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenTACs.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenTACs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenTACs.h b/lib/asn1c/s1ap/S1AP_ForbiddenTACs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ForbiddenTACs.h rename to lib/asn1c/s1ap/S1AP_ForbiddenTACs.h index cf0f2c13a..78d93891f 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenTACs.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenTACs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenTAs-Item.c b/lib/asn1c/s1ap/S1AP_ForbiddenTAs-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ForbiddenTAs-Item.c rename to lib/asn1c/s1ap/S1AP_ForbiddenTAs-Item.c index 46db349f6..671441646 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenTAs-Item.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenTAs-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenTAs-Item.h b/lib/asn1c/s1ap/S1AP_ForbiddenTAs-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ForbiddenTAs-Item.h rename to lib/asn1c/s1ap/S1AP_ForbiddenTAs-Item.h index 6405ff49d..994dfb965 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenTAs-Item.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenTAs-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenTAs.c b/lib/asn1c/s1ap/S1AP_ForbiddenTAs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ForbiddenTAs.c rename to lib/asn1c/s1ap/S1AP_ForbiddenTAs.c index 84442694d..92d90f0b2 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenTAs.c +++ b/lib/asn1c/s1ap/S1AP_ForbiddenTAs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ForbiddenTAs.h b/lib/asn1c/s1ap/S1AP_ForbiddenTAs.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ForbiddenTAs.h rename to lib/asn1c/s1ap/S1AP_ForbiddenTAs.h index aa4e5b288..f3be01510 100644 --- a/lib/s1ap/asn1c/S1AP_ForbiddenTAs.h +++ b/lib/asn1c/s1ap/S1AP_ForbiddenTAs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GBR-QosInformation.c b/lib/asn1c/s1ap/S1AP_GBR-QosInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_GBR-QosInformation.c rename to lib/asn1c/s1ap/S1AP_GBR-QosInformation.c index 8237d4a2e..8a98cef2e 100644 --- a/lib/s1ap/asn1c/S1AP_GBR-QosInformation.c +++ b/lib/asn1c/s1ap/S1AP_GBR-QosInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GBR-QosInformation.h b/lib/asn1c/s1ap/S1AP_GBR-QosInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_GBR-QosInformation.h rename to lib/asn1c/s1ap/S1AP_GBR-QosInformation.h index 821f7f401..f58727214 100644 --- a/lib/s1ap/asn1c/S1AP_GBR-QosInformation.h +++ b/lib/asn1c/s1ap/S1AP_GBR-QosInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GERAN-Cell-ID.c b/lib/asn1c/s1ap/S1AP_GERAN-Cell-ID.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_GERAN-Cell-ID.c rename to lib/asn1c/s1ap/S1AP_GERAN-Cell-ID.c index 146c4e94f..788066ae1 100644 --- a/lib/s1ap/asn1c/S1AP_GERAN-Cell-ID.c +++ b/lib/asn1c/s1ap/S1AP_GERAN-Cell-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GERAN-Cell-ID.h b/lib/asn1c/s1ap/S1AP_GERAN-Cell-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_GERAN-Cell-ID.h rename to lib/asn1c/s1ap/S1AP_GERAN-Cell-ID.h index bdabd2a5f..241ee82dc 100644 --- a/lib/s1ap/asn1c/S1AP_GERAN-Cell-ID.h +++ b/lib/asn1c/s1ap/S1AP_GERAN-Cell-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GTP-TEID.c b/lib/asn1c/s1ap/S1AP_GTP-TEID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_GTP-TEID.c rename to lib/asn1c/s1ap/S1AP_GTP-TEID.c index a75b85c5d..aa9492d34 100644 --- a/lib/s1ap/asn1c/S1AP_GTP-TEID.c +++ b/lib/asn1c/s1ap/S1AP_GTP-TEID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GTP-TEID.h b/lib/asn1c/s1ap/S1AP_GTP-TEID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_GTP-TEID.h rename to lib/asn1c/s1ap/S1AP_GTP-TEID.h index 39838fa1b..58da7f345 100644 --- a/lib/s1ap/asn1c/S1AP_GTP-TEID.h +++ b/lib/asn1c/s1ap/S1AP_GTP-TEID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GUMMEI.c b/lib/asn1c/s1ap/S1AP_GUMMEI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_GUMMEI.c rename to lib/asn1c/s1ap/S1AP_GUMMEI.c index 319497c66..765f1f06b 100644 --- a/lib/s1ap/asn1c/S1AP_GUMMEI.c +++ b/lib/asn1c/s1ap/S1AP_GUMMEI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GUMMEI.h b/lib/asn1c/s1ap/S1AP_GUMMEI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_GUMMEI.h rename to lib/asn1c/s1ap/S1AP_GUMMEI.h index 518d4b454..8b395361e 100644 --- a/lib/s1ap/asn1c/S1AP_GUMMEI.h +++ b/lib/asn1c/s1ap/S1AP_GUMMEI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GUMMEIList.c b/lib/asn1c/s1ap/S1AP_GUMMEIList.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_GUMMEIList.c rename to lib/asn1c/s1ap/S1AP_GUMMEIList.c index 595773c75..5b991383d 100644 --- a/lib/s1ap/asn1c/S1AP_GUMMEIList.c +++ b/lib/asn1c/s1ap/S1AP_GUMMEIList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GUMMEIList.h b/lib/asn1c/s1ap/S1AP_GUMMEIList.h similarity index 93% rename from lib/s1ap/asn1c/S1AP_GUMMEIList.h rename to lib/asn1c/s1ap/S1AP_GUMMEIList.h index c0c678beb..442129aa3 100644 --- a/lib/s1ap/asn1c/S1AP_GUMMEIList.h +++ b/lib/asn1c/s1ap/S1AP_GUMMEIList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GUMMEIType.c b/lib/asn1c/s1ap/S1AP_GUMMEIType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_GUMMEIType.c rename to lib/asn1c/s1ap/S1AP_GUMMEIType.c index 517efe453..e11cff853 100644 --- a/lib/s1ap/asn1c/S1AP_GUMMEIType.c +++ b/lib/asn1c/s1ap/S1AP_GUMMEIType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GUMMEIType.h b/lib/asn1c/s1ap/S1AP_GUMMEIType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_GUMMEIType.h rename to lib/asn1c/s1ap/S1AP_GUMMEIType.h index f05165e1a..c70965a73 100644 --- a/lib/s1ap/asn1c/S1AP_GUMMEIType.h +++ b/lib/asn1c/s1ap/S1AP_GUMMEIType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GWContextReleaseIndication.c b/lib/asn1c/s1ap/S1AP_GWContextReleaseIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_GWContextReleaseIndication.c rename to lib/asn1c/s1ap/S1AP_GWContextReleaseIndication.c index bd3819be1..591753fc2 100644 --- a/lib/s1ap/asn1c/S1AP_GWContextReleaseIndication.c +++ b/lib/asn1c/s1ap/S1AP_GWContextReleaseIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_GWContextReleaseIndication.h b/lib/asn1c/s1ap/S1AP_GWContextReleaseIndication.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_GWContextReleaseIndication.h rename to lib/asn1c/s1ap/S1AP_GWContextReleaseIndication.h index 75e8e77c1..b45c9a9e4 100644 --- a/lib/s1ap/asn1c/S1AP_GWContextReleaseIndication.h +++ b/lib/asn1c/s1ap/S1AP_GWContextReleaseIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Global-ENB-ID.c b/lib/asn1c/s1ap/S1AP_Global-ENB-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Global-ENB-ID.c rename to lib/asn1c/s1ap/S1AP_Global-ENB-ID.c index 7290e0091..bc3322be9 100644 --- a/lib/s1ap/asn1c/S1AP_Global-ENB-ID.c +++ b/lib/asn1c/s1ap/S1AP_Global-ENB-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Global-ENB-ID.h b/lib/asn1c/s1ap/S1AP_Global-ENB-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Global-ENB-ID.h rename to lib/asn1c/s1ap/S1AP_Global-ENB-ID.h index a2340ffa8..3ad79ec1d 100644 --- a/lib/s1ap/asn1c/S1AP_Global-ENB-ID.h +++ b/lib/asn1c/s1ap/S1AP_Global-ENB-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HFN.c b/lib/asn1c/s1ap/S1AP_HFN.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HFN.c rename to lib/asn1c/s1ap/S1AP_HFN.c index 8c49baa11..692a4db29 100644 --- a/lib/s1ap/asn1c/S1AP_HFN.c +++ b/lib/asn1c/s1ap/S1AP_HFN.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HFN.h b/lib/asn1c/s1ap/S1AP_HFN.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HFN.h rename to lib/asn1c/s1ap/S1AP_HFN.h index 15da2e68b..14382f843 100644 --- a/lib/s1ap/asn1c/S1AP_HFN.h +++ b/lib/asn1c/s1ap/S1AP_HFN.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HFNModified.c b/lib/asn1c/s1ap/S1AP_HFNModified.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_HFNModified.c rename to lib/asn1c/s1ap/S1AP_HFNModified.c index d4a3e4123..1b79726b8 100644 --- a/lib/s1ap/asn1c/S1AP_HFNModified.c +++ b/lib/asn1c/s1ap/S1AP_HFNModified.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HFNModified.h b/lib/asn1c/s1ap/S1AP_HFNModified.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_HFNModified.h rename to lib/asn1c/s1ap/S1AP_HFNModified.h index 3d5562342..8da2ce440 100644 --- a/lib/s1ap/asn1c/S1AP_HFNModified.h +++ b/lib/asn1c/s1ap/S1AP_HFNModified.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HFNforPDCP-SNlength18.c b/lib/asn1c/s1ap/S1AP_HFNforPDCP-SNlength18.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_HFNforPDCP-SNlength18.c rename to lib/asn1c/s1ap/S1AP_HFNforPDCP-SNlength18.c index 24e52d097..7c9823c4a 100644 --- a/lib/s1ap/asn1c/S1AP_HFNforPDCP-SNlength18.c +++ b/lib/asn1c/s1ap/S1AP_HFNforPDCP-SNlength18.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HFNforPDCP-SNlength18.h b/lib/asn1c/s1ap/S1AP_HFNforPDCP-SNlength18.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_HFNforPDCP-SNlength18.h rename to lib/asn1c/s1ap/S1AP_HFNforPDCP-SNlength18.h index 42e97454f..dbc00d983 100644 --- a/lib/s1ap/asn1c/S1AP_HFNforPDCP-SNlength18.h +++ b/lib/asn1c/s1ap/S1AP_HFNforPDCP-SNlength18.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverCancel.c b/lib/asn1c/s1ap/S1AP_HandoverCancel.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverCancel.c rename to lib/asn1c/s1ap/S1AP_HandoverCancel.c index 320c30219..9544b9e62 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverCancel.c +++ b/lib/asn1c/s1ap/S1AP_HandoverCancel.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverCancel.h b/lib/asn1c/s1ap/S1AP_HandoverCancel.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverCancel.h rename to lib/asn1c/s1ap/S1AP_HandoverCancel.h index e0cd4cedb..9749e8094 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverCancel.h +++ b/lib/asn1c/s1ap/S1AP_HandoverCancel.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverCancelAcknowledge.c b/lib/asn1c/s1ap/S1AP_HandoverCancelAcknowledge.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_HandoverCancelAcknowledge.c rename to lib/asn1c/s1ap/S1AP_HandoverCancelAcknowledge.c index 67e005031..5344f30ec 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverCancelAcknowledge.c +++ b/lib/asn1c/s1ap/S1AP_HandoverCancelAcknowledge.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverCancelAcknowledge.h b/lib/asn1c/s1ap/S1AP_HandoverCancelAcknowledge.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverCancelAcknowledge.h rename to lib/asn1c/s1ap/S1AP_HandoverCancelAcknowledge.h index 91073e4a8..5fafa0517 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverCancelAcknowledge.h +++ b/lib/asn1c/s1ap/S1AP_HandoverCancelAcknowledge.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverCommand.c b/lib/asn1c/s1ap/S1AP_HandoverCommand.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverCommand.c rename to lib/asn1c/s1ap/S1AP_HandoverCommand.c index a50aab1d2..ba59ae8a1 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverCommand.c +++ b/lib/asn1c/s1ap/S1AP_HandoverCommand.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverCommand.h b/lib/asn1c/s1ap/S1AP_HandoverCommand.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverCommand.h rename to lib/asn1c/s1ap/S1AP_HandoverCommand.h index 82fd12678..543848bb9 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverCommand.h +++ b/lib/asn1c/s1ap/S1AP_HandoverCommand.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverFailure.c b/lib/asn1c/s1ap/S1AP_HandoverFailure.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverFailure.c rename to lib/asn1c/s1ap/S1AP_HandoverFailure.c index 8fd9edb5a..35e06e65d 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverFailure.c +++ b/lib/asn1c/s1ap/S1AP_HandoverFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverFailure.h b/lib/asn1c/s1ap/S1AP_HandoverFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverFailure.h rename to lib/asn1c/s1ap/S1AP_HandoverFailure.h index d9e6a56c3..9b740fe20 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverFailure.h +++ b/lib/asn1c/s1ap/S1AP_HandoverFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverNotify.c b/lib/asn1c/s1ap/S1AP_HandoverNotify.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverNotify.c rename to lib/asn1c/s1ap/S1AP_HandoverNotify.c index 25648fcb3..962af18b0 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverNotify.c +++ b/lib/asn1c/s1ap/S1AP_HandoverNotify.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverNotify.h b/lib/asn1c/s1ap/S1AP_HandoverNotify.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverNotify.h rename to lib/asn1c/s1ap/S1AP_HandoverNotify.h index 99b5edf38..17618f709 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverNotify.h +++ b/lib/asn1c/s1ap/S1AP_HandoverNotify.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverPreparationFailure.c b/lib/asn1c/s1ap/S1AP_HandoverPreparationFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_HandoverPreparationFailure.c rename to lib/asn1c/s1ap/S1AP_HandoverPreparationFailure.c index eb13454b3..6923c6f87 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverPreparationFailure.c +++ b/lib/asn1c/s1ap/S1AP_HandoverPreparationFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverPreparationFailure.h b/lib/asn1c/s1ap/S1AP_HandoverPreparationFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverPreparationFailure.h rename to lib/asn1c/s1ap/S1AP_HandoverPreparationFailure.h index d983b2397..01aebbf45 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverPreparationFailure.h +++ b/lib/asn1c/s1ap/S1AP_HandoverPreparationFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRequest.c b/lib/asn1c/s1ap/S1AP_HandoverRequest.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverRequest.c rename to lib/asn1c/s1ap/S1AP_HandoverRequest.c index a861bc655..75ba5d2dc 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRequest.c +++ b/lib/asn1c/s1ap/S1AP_HandoverRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRequest.h b/lib/asn1c/s1ap/S1AP_HandoverRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverRequest.h rename to lib/asn1c/s1ap/S1AP_HandoverRequest.h index 3501074dc..81a7648f7 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRequest.h +++ b/lib/asn1c/s1ap/S1AP_HandoverRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRequestAcknowledge.c b/lib/asn1c/s1ap/S1AP_HandoverRequestAcknowledge.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_HandoverRequestAcknowledge.c rename to lib/asn1c/s1ap/S1AP_HandoverRequestAcknowledge.c index 7d844a04b..904adf76c 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRequestAcknowledge.c +++ b/lib/asn1c/s1ap/S1AP_HandoverRequestAcknowledge.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRequestAcknowledge.h b/lib/asn1c/s1ap/S1AP_HandoverRequestAcknowledge.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverRequestAcknowledge.h rename to lib/asn1c/s1ap/S1AP_HandoverRequestAcknowledge.h index befab1618..e599846d8 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRequestAcknowledge.h +++ b/lib/asn1c/s1ap/S1AP_HandoverRequestAcknowledge.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRequired.c b/lib/asn1c/s1ap/S1AP_HandoverRequired.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverRequired.c rename to lib/asn1c/s1ap/S1AP_HandoverRequired.c index 19164c46f..11c454f08 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRequired.c +++ b/lib/asn1c/s1ap/S1AP_HandoverRequired.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRequired.h b/lib/asn1c/s1ap/S1AP_HandoverRequired.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_HandoverRequired.h rename to lib/asn1c/s1ap/S1AP_HandoverRequired.h index 8c3155f8a..2209730ce 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRequired.h +++ b/lib/asn1c/s1ap/S1AP_HandoverRequired.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRestrictionList.c b/lib/asn1c/s1ap/S1AP_HandoverRestrictionList.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_HandoverRestrictionList.c rename to lib/asn1c/s1ap/S1AP_HandoverRestrictionList.c index d16ae00e0..510211023 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRestrictionList.c +++ b/lib/asn1c/s1ap/S1AP_HandoverRestrictionList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverRestrictionList.h b/lib/asn1c/s1ap/S1AP_HandoverRestrictionList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverRestrictionList.h rename to lib/asn1c/s1ap/S1AP_HandoverRestrictionList.h index 63bff0481..5fa2aca8f 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverRestrictionList.h +++ b/lib/asn1c/s1ap/S1AP_HandoverRestrictionList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverType.c b/lib/asn1c/s1ap/S1AP_HandoverType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_HandoverType.c rename to lib/asn1c/s1ap/S1AP_HandoverType.c index 96eea6aef..6962542d5 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverType.c +++ b/lib/asn1c/s1ap/S1AP_HandoverType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_HandoverType.h b/lib/asn1c/s1ap/S1AP_HandoverType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_HandoverType.h rename to lib/asn1c/s1ap/S1AP_HandoverType.h index 77a949489..fcd06d9ad 100644 --- a/lib/s1ap/asn1c/S1AP_HandoverType.h +++ b/lib/asn1c/s1ap/S1AP_HandoverType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_IMSI.c b/lib/asn1c/s1ap/S1AP_IMSI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_IMSI.c rename to lib/asn1c/s1ap/S1AP_IMSI.c index 14061caeb..50ec89702 100644 --- a/lib/s1ap/asn1c/S1AP_IMSI.c +++ b/lib/asn1c/s1ap/S1AP_IMSI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_IMSI.h b/lib/asn1c/s1ap/S1AP_IMSI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_IMSI.h rename to lib/asn1c/s1ap/S1AP_IMSI.h index 2a5b8b890..ce87999df 100644 --- a/lib/s1ap/asn1c/S1AP_IMSI.h +++ b/lib/asn1c/s1ap/S1AP_IMSI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ImmediateMDT.c b/lib/asn1c/s1ap/S1AP_ImmediateMDT.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ImmediateMDT.c rename to lib/asn1c/s1ap/S1AP_ImmediateMDT.c index e755ed6b5..02d11678e 100644 --- a/lib/s1ap/asn1c/S1AP_ImmediateMDT.c +++ b/lib/asn1c/s1ap/S1AP_ImmediateMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ImmediateMDT.h b/lib/asn1c/s1ap/S1AP_ImmediateMDT.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ImmediateMDT.h rename to lib/asn1c/s1ap/S1AP_ImmediateMDT.h index 52640afdf..b44ba1641 100644 --- a/lib/s1ap/asn1c/S1AP_ImmediateMDT.h +++ b/lib/asn1c/s1ap/S1AP_ImmediateMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c b/lib/asn1c/s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c rename to lib/asn1c/s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c index dbc5cfb1e..d25f807ed 100644 --- a/lib/s1ap/asn1c/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c +++ b/lib/asn1c/s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h b/lib/asn1c/s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h rename to lib/asn1c/s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h index 6b5dd7eaf..f115121e2 100644 --- a/lib/s1ap/asn1c/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h +++ b/lib/asn1c/s1ap/S1AP_InformationOnRecommendedCellsAndENBsForPaging.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialContextSetupFailure.c b/lib/asn1c/s1ap/S1AP_InitialContextSetupFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_InitialContextSetupFailure.c rename to lib/asn1c/s1ap/S1AP_InitialContextSetupFailure.c index 168b8fc5e..f99e20392 100644 --- a/lib/s1ap/asn1c/S1AP_InitialContextSetupFailure.c +++ b/lib/asn1c/s1ap/S1AP_InitialContextSetupFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialContextSetupFailure.h b/lib/asn1c/s1ap/S1AP_InitialContextSetupFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_InitialContextSetupFailure.h rename to lib/asn1c/s1ap/S1AP_InitialContextSetupFailure.h index 928d8ad7e..3ca43c609 100644 --- a/lib/s1ap/asn1c/S1AP_InitialContextSetupFailure.h +++ b/lib/asn1c/s1ap/S1AP_InitialContextSetupFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialContextSetupRequest.c b/lib/asn1c/s1ap/S1AP_InitialContextSetupRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_InitialContextSetupRequest.c rename to lib/asn1c/s1ap/S1AP_InitialContextSetupRequest.c index eac7902e5..2e22e837c 100644 --- a/lib/s1ap/asn1c/S1AP_InitialContextSetupRequest.c +++ b/lib/asn1c/s1ap/S1AP_InitialContextSetupRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialContextSetupRequest.h b/lib/asn1c/s1ap/S1AP_InitialContextSetupRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_InitialContextSetupRequest.h rename to lib/asn1c/s1ap/S1AP_InitialContextSetupRequest.h index baabf931c..ab73bdcb1 100644 --- a/lib/s1ap/asn1c/S1AP_InitialContextSetupRequest.h +++ b/lib/asn1c/s1ap/S1AP_InitialContextSetupRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialContextSetupResponse.c b/lib/asn1c/s1ap/S1AP_InitialContextSetupResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_InitialContextSetupResponse.c rename to lib/asn1c/s1ap/S1AP_InitialContextSetupResponse.c index 8d2c9b859..bceaa884e 100644 --- a/lib/s1ap/asn1c/S1AP_InitialContextSetupResponse.c +++ b/lib/asn1c/s1ap/S1AP_InitialContextSetupResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialContextSetupResponse.h b/lib/asn1c/s1ap/S1AP_InitialContextSetupResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_InitialContextSetupResponse.h rename to lib/asn1c/s1ap/S1AP_InitialContextSetupResponse.h index b9c3f201f..e0596066c 100644 --- a/lib/s1ap/asn1c/S1AP_InitialContextSetupResponse.h +++ b/lib/asn1c/s1ap/S1AP_InitialContextSetupResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialUEMessage.c b/lib/asn1c/s1ap/S1AP_InitialUEMessage.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_InitialUEMessage.c rename to lib/asn1c/s1ap/S1AP_InitialUEMessage.c index 23f079dc0..43e36b144 100644 --- a/lib/s1ap/asn1c/S1AP_InitialUEMessage.c +++ b/lib/asn1c/s1ap/S1AP_InitialUEMessage.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitialUEMessage.h b/lib/asn1c/s1ap/S1AP_InitialUEMessage.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_InitialUEMessage.h rename to lib/asn1c/s1ap/S1AP_InitialUEMessage.h index 355195591..51bf76b1e 100644 --- a/lib/s1ap/asn1c/S1AP_InitialUEMessage.h +++ b/lib/asn1c/s1ap/S1AP_InitialUEMessage.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitiatingMessage.c b/lib/asn1c/s1ap/S1AP_InitiatingMessage.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_InitiatingMessage.c rename to lib/asn1c/s1ap/S1AP_InitiatingMessage.c index 0fe6df889..9fd32f018 100644 --- a/lib/s1ap/asn1c/S1AP_InitiatingMessage.c +++ b/lib/asn1c/s1ap/S1AP_InitiatingMessage.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InitiatingMessage.h b/lib/asn1c/s1ap/S1AP_InitiatingMessage.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_InitiatingMessage.h rename to lib/asn1c/s1ap/S1AP_InitiatingMessage.h index 4bc5a2a16..4e76f8242 100644 --- a/lib/s1ap/asn1c/S1AP_InitiatingMessage.h +++ b/lib/asn1c/s1ap/S1AP_InitiatingMessage.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_IntegrityProtectionAlgorithms.c b/lib/asn1c/s1ap/S1AP_IntegrityProtectionAlgorithms.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_IntegrityProtectionAlgorithms.c rename to lib/asn1c/s1ap/S1AP_IntegrityProtectionAlgorithms.c index d84472e40..1b5518128 100644 --- a/lib/s1ap/asn1c/S1AP_IntegrityProtectionAlgorithms.c +++ b/lib/asn1c/s1ap/S1AP_IntegrityProtectionAlgorithms.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_IntegrityProtectionAlgorithms.h b/lib/asn1c/s1ap/S1AP_IntegrityProtectionAlgorithms.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_IntegrityProtectionAlgorithms.h rename to lib/asn1c/s1ap/S1AP_IntegrityProtectionAlgorithms.h index 4af70f094..6bbecc520 100644 --- a/lib/s1ap/asn1c/S1AP_IntegrityProtectionAlgorithms.h +++ b/lib/asn1c/s1ap/S1AP_IntegrityProtectionAlgorithms.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_IntendedNumberOfPagingAttempts.c b/lib/asn1c/s1ap/S1AP_IntendedNumberOfPagingAttempts.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_IntendedNumberOfPagingAttempts.c rename to lib/asn1c/s1ap/S1AP_IntendedNumberOfPagingAttempts.c index d29b5dc21..20712481f 100644 --- a/lib/s1ap/asn1c/S1AP_IntendedNumberOfPagingAttempts.c +++ b/lib/asn1c/s1ap/S1AP_IntendedNumberOfPagingAttempts.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_IntendedNumberOfPagingAttempts.h b/lib/asn1c/s1ap/S1AP_IntendedNumberOfPagingAttempts.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_IntendedNumberOfPagingAttempts.h rename to lib/asn1c/s1ap/S1AP_IntendedNumberOfPagingAttempts.h index 27fb0e7dc..aac4e101e 100644 --- a/lib/s1ap/asn1c/S1AP_IntendedNumberOfPagingAttempts.h +++ b/lib/asn1c/s1ap/S1AP_IntendedNumberOfPagingAttempts.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Inter-SystemInformationTransferType.c b/lib/asn1c/s1ap/S1AP_Inter-SystemInformationTransferType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Inter-SystemInformationTransferType.c rename to lib/asn1c/s1ap/S1AP_Inter-SystemInformationTransferType.c index 6c1d371a2..209c2d138 100644 --- a/lib/s1ap/asn1c/S1AP_Inter-SystemInformationTransferType.c +++ b/lib/asn1c/s1ap/S1AP_Inter-SystemInformationTransferType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Inter-SystemInformationTransferType.h b/lib/asn1c/s1ap/S1AP_Inter-SystemInformationTransferType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Inter-SystemInformationTransferType.h rename to lib/asn1c/s1ap/S1AP_Inter-SystemInformationTransferType.h index 1d519f1c0..73fe8cbe6 100644 --- a/lib/s1ap/asn1c/S1AP_Inter-SystemInformationTransferType.h +++ b/lib/asn1c/s1ap/S1AP_Inter-SystemInformationTransferType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InterfacesToTrace.c b/lib/asn1c/s1ap/S1AP_InterfacesToTrace.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_InterfacesToTrace.c rename to lib/asn1c/s1ap/S1AP_InterfacesToTrace.c index 5e368ee87..ed7915388 100644 --- a/lib/s1ap/asn1c/S1AP_InterfacesToTrace.c +++ b/lib/asn1c/s1ap/S1AP_InterfacesToTrace.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_InterfacesToTrace.h b/lib/asn1c/s1ap/S1AP_InterfacesToTrace.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_InterfacesToTrace.h rename to lib/asn1c/s1ap/S1AP_InterfacesToTrace.h index dda96ebf1..f24c350e7 100644 --- a/lib/s1ap/asn1c/S1AP_InterfacesToTrace.h +++ b/lib/asn1c/s1ap/S1AP_InterfacesToTrace.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_KillAllWarningMessages.c b/lib/asn1c/s1ap/S1AP_KillAllWarningMessages.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_KillAllWarningMessages.c rename to lib/asn1c/s1ap/S1AP_KillAllWarningMessages.c index 90d925b54..05ba7e5b8 100644 --- a/lib/s1ap/asn1c/S1AP_KillAllWarningMessages.c +++ b/lib/asn1c/s1ap/S1AP_KillAllWarningMessages.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_KillAllWarningMessages.h b/lib/asn1c/s1ap/S1AP_KillAllWarningMessages.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_KillAllWarningMessages.h rename to lib/asn1c/s1ap/S1AP_KillAllWarningMessages.h index bd2c79674..2d5b78d8f 100644 --- a/lib/s1ap/asn1c/S1AP_KillAllWarningMessages.h +++ b/lib/asn1c/s1ap/S1AP_KillAllWarningMessages.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_KillRequest.c b/lib/asn1c/s1ap/S1AP_KillRequest.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_KillRequest.c rename to lib/asn1c/s1ap/S1AP_KillRequest.c index cb2fd71cf..ab3a12301 100644 --- a/lib/s1ap/asn1c/S1AP_KillRequest.c +++ b/lib/asn1c/s1ap/S1AP_KillRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_KillRequest.h b/lib/asn1c/s1ap/S1AP_KillRequest.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_KillRequest.h rename to lib/asn1c/s1ap/S1AP_KillRequest.h index e894c1820..c7cb5d2f2 100644 --- a/lib/s1ap/asn1c/S1AP_KillRequest.h +++ b/lib/asn1c/s1ap/S1AP_KillRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_KillResponse.c b/lib/asn1c/s1ap/S1AP_KillResponse.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_KillResponse.c rename to lib/asn1c/s1ap/S1AP_KillResponse.c index bab9f0a30..f340f968f 100644 --- a/lib/s1ap/asn1c/S1AP_KillResponse.c +++ b/lib/asn1c/s1ap/S1AP_KillResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_KillResponse.h b/lib/asn1c/s1ap/S1AP_KillResponse.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_KillResponse.h rename to lib/asn1c/s1ap/S1AP_KillResponse.h index 7babb4b72..869c0bbdb 100644 --- a/lib/s1ap/asn1c/S1AP_KillResponse.h +++ b/lib/asn1c/s1ap/S1AP_KillResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_L3-Information.c b/lib/asn1c/s1ap/S1AP_L3-Information.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_L3-Information.c rename to lib/asn1c/s1ap/S1AP_L3-Information.c index 3660dfb4d..a7554815b 100644 --- a/lib/s1ap/asn1c/S1AP_L3-Information.c +++ b/lib/asn1c/s1ap/S1AP_L3-Information.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_L3-Information.h b/lib/asn1c/s1ap/S1AP_L3-Information.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_L3-Information.h rename to lib/asn1c/s1ap/S1AP_L3-Information.h index 0f54ee09b..72e5a46c8 100644 --- a/lib/s1ap/asn1c/S1AP_L3-Information.h +++ b/lib/asn1c/s1ap/S1AP_L3-Information.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LAC.c b/lib/asn1c/s1ap/S1AP_LAC.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LAC.c rename to lib/asn1c/s1ap/S1AP_LAC.c index f017da50a..ec7eae752 100644 --- a/lib/s1ap/asn1c/S1AP_LAC.c +++ b/lib/asn1c/s1ap/S1AP_LAC.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LAC.h b/lib/asn1c/s1ap/S1AP_LAC.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LAC.h rename to lib/asn1c/s1ap/S1AP_LAC.h index 72cf9b3f5..2cdce1af9 100644 --- a/lib/s1ap/asn1c/S1AP_LAC.h +++ b/lib/asn1c/s1ap/S1AP_LAC.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LAI.c b/lib/asn1c/s1ap/S1AP_LAI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LAI.c rename to lib/asn1c/s1ap/S1AP_LAI.c index abae47ecd..ad16f9364 100644 --- a/lib/s1ap/asn1c/S1AP_LAI.c +++ b/lib/asn1c/s1ap/S1AP_LAI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LAI.h b/lib/asn1c/s1ap/S1AP_LAI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LAI.h rename to lib/asn1c/s1ap/S1AP_LAI.h index 403e1778e..553cd9eb9 100644 --- a/lib/s1ap/asn1c/S1AP_LAI.h +++ b/lib/asn1c/s1ap/S1AP_LAI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LHN-ID.c b/lib/asn1c/s1ap/S1AP_LHN-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LHN-ID.c rename to lib/asn1c/s1ap/S1AP_LHN-ID.c index 1433acc77..8649e4fea 100644 --- a/lib/s1ap/asn1c/S1AP_LHN-ID.c +++ b/lib/asn1c/s1ap/S1AP_LHN-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LHN-ID.h b/lib/asn1c/s1ap/S1AP_LHN-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LHN-ID.h rename to lib/asn1c/s1ap/S1AP_LHN-ID.h index 783cbdf85..22e3d8f5a 100644 --- a/lib/s1ap/asn1c/S1AP_LHN-ID.h +++ b/lib/asn1c/s1ap/S1AP_LHN-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LPPa-PDU.c b/lib/asn1c/s1ap/S1AP_LPPa-PDU.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_LPPa-PDU.c rename to lib/asn1c/s1ap/S1AP_LPPa-PDU.c index 81b013691..ffbc6a81a 100644 --- a/lib/s1ap/asn1c/S1AP_LPPa-PDU.c +++ b/lib/asn1c/s1ap/S1AP_LPPa-PDU.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LPPa-PDU.h b/lib/asn1c/s1ap/S1AP_LPPa-PDU.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LPPa-PDU.h rename to lib/asn1c/s1ap/S1AP_LPPa-PDU.h index 91b0b23b6..23fe1cb9a 100644 --- a/lib/s1ap/asn1c/S1AP_LPPa-PDU.h +++ b/lib/asn1c/s1ap/S1AP_LPPa-PDU.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedCell-Item.c b/lib/asn1c/s1ap/S1AP_LastVisitedCell-Item.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_LastVisitedCell-Item.c rename to lib/asn1c/s1ap/S1AP_LastVisitedCell-Item.c index c5a29b74a..ef8c1254b 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedCell-Item.c +++ b/lib/asn1c/s1ap/S1AP_LastVisitedCell-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedCell-Item.h b/lib/asn1c/s1ap/S1AP_LastVisitedCell-Item.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_LastVisitedCell-Item.h rename to lib/asn1c/s1ap/S1AP_LastVisitedCell-Item.h index 3c1293c7d..9ce3962f6 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedCell-Item.h +++ b/lib/asn1c/s1ap/S1AP_LastVisitedCell-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedEUTRANCellInformation.c b/lib/asn1c/s1ap/S1AP_LastVisitedEUTRANCellInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_LastVisitedEUTRANCellInformation.c rename to lib/asn1c/s1ap/S1AP_LastVisitedEUTRANCellInformation.c index 64a2d2eb4..7db83f8c5 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedEUTRANCellInformation.c +++ b/lib/asn1c/s1ap/S1AP_LastVisitedEUTRANCellInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedEUTRANCellInformation.h b/lib/asn1c/s1ap/S1AP_LastVisitedEUTRANCellInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_LastVisitedEUTRANCellInformation.h rename to lib/asn1c/s1ap/S1AP_LastVisitedEUTRANCellInformation.h index 26fdcdf0d..efa3bd0ef 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedEUTRANCellInformation.h +++ b/lib/asn1c/s1ap/S1AP_LastVisitedEUTRANCellInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedGERANCellInformation.c b/lib/asn1c/s1ap/S1AP_LastVisitedGERANCellInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LastVisitedGERANCellInformation.c rename to lib/asn1c/s1ap/S1AP_LastVisitedGERANCellInformation.c index 148f06a46..c7ce8be42 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedGERANCellInformation.c +++ b/lib/asn1c/s1ap/S1AP_LastVisitedGERANCellInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedGERANCellInformation.h b/lib/asn1c/s1ap/S1AP_LastVisitedGERANCellInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_LastVisitedGERANCellInformation.h rename to lib/asn1c/s1ap/S1AP_LastVisitedGERANCellInformation.h index 920bf687d..351a5cf49 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedGERANCellInformation.h +++ b/lib/asn1c/s1ap/S1AP_LastVisitedGERANCellInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedUTRANCellInformation.c b/lib/asn1c/s1ap/S1AP_LastVisitedUTRANCellInformation.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_LastVisitedUTRANCellInformation.c rename to lib/asn1c/s1ap/S1AP_LastVisitedUTRANCellInformation.c index 37dff89c2..d07fdc2ac 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedUTRANCellInformation.c +++ b/lib/asn1c/s1ap/S1AP_LastVisitedUTRANCellInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LastVisitedUTRANCellInformation.h b/lib/asn1c/s1ap/S1AP_LastVisitedUTRANCellInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_LastVisitedUTRANCellInformation.h rename to lib/asn1c/s1ap/S1AP_LastVisitedUTRANCellInformation.h index f2af069a3..73b1cd9ac 100644 --- a/lib/s1ap/asn1c/S1AP_LastVisitedUTRANCellInformation.h +++ b/lib/asn1c/s1ap/S1AP_LastVisitedUTRANCellInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Links-to-log.c b/lib/asn1c/s1ap/S1AP_Links-to-log.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Links-to-log.c rename to lib/asn1c/s1ap/S1AP_Links-to-log.c index c4d656888..a117ee1b4 100644 --- a/lib/s1ap/asn1c/S1AP_Links-to-log.c +++ b/lib/asn1c/s1ap/S1AP_Links-to-log.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Links-to-log.h b/lib/asn1c/s1ap/S1AP_Links-to-log.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Links-to-log.h rename to lib/asn1c/s1ap/S1AP_Links-to-log.h index 3d7091116..964c3789d 100644 --- a/lib/s1ap/asn1c/S1AP_Links-to-log.h +++ b/lib/asn1c/s1ap/S1AP_Links-to-log.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ListeningSubframePattern.c b/lib/asn1c/s1ap/S1AP_ListeningSubframePattern.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ListeningSubframePattern.c rename to lib/asn1c/s1ap/S1AP_ListeningSubframePattern.c index f41dee77c..00f32e72a 100644 --- a/lib/s1ap/asn1c/S1AP_ListeningSubframePattern.c +++ b/lib/asn1c/s1ap/S1AP_ListeningSubframePattern.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ListeningSubframePattern.h b/lib/asn1c/s1ap/S1AP_ListeningSubframePattern.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ListeningSubframePattern.h rename to lib/asn1c/s1ap/S1AP_ListeningSubframePattern.h index f29baae79..1fc110a84 100644 --- a/lib/s1ap/asn1c/S1AP_ListeningSubframePattern.h +++ b/lib/asn1c/s1ap/S1AP_ListeningSubframePattern.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LocationReport.c b/lib/asn1c/s1ap/S1AP_LocationReport.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_LocationReport.c rename to lib/asn1c/s1ap/S1AP_LocationReport.c index d9ba805c9..0651f48af 100644 --- a/lib/s1ap/asn1c/S1AP_LocationReport.c +++ b/lib/asn1c/s1ap/S1AP_LocationReport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LocationReport.h b/lib/asn1c/s1ap/S1AP_LocationReport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LocationReport.h rename to lib/asn1c/s1ap/S1AP_LocationReport.h index dcc9c482e..769f90d45 100644 --- a/lib/s1ap/asn1c/S1AP_LocationReport.h +++ b/lib/asn1c/s1ap/S1AP_LocationReport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LocationReportingControl.c b/lib/asn1c/s1ap/S1AP_LocationReportingControl.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LocationReportingControl.c rename to lib/asn1c/s1ap/S1AP_LocationReportingControl.c index b0e916a3f..fe36c5070 100644 --- a/lib/s1ap/asn1c/S1AP_LocationReportingControl.c +++ b/lib/asn1c/s1ap/S1AP_LocationReportingControl.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LocationReportingControl.h b/lib/asn1c/s1ap/S1AP_LocationReportingControl.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LocationReportingControl.h rename to lib/asn1c/s1ap/S1AP_LocationReportingControl.h index f86a3b45f..c0e0fb3e3 100644 --- a/lib/s1ap/asn1c/S1AP_LocationReportingControl.h +++ b/lib/asn1c/s1ap/S1AP_LocationReportingControl.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LocationReportingFailureIndication.c b/lib/asn1c/s1ap/S1AP_LocationReportingFailureIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LocationReportingFailureIndication.c rename to lib/asn1c/s1ap/S1AP_LocationReportingFailureIndication.c index d19b8e5ef..3a0ead9ed 100644 --- a/lib/s1ap/asn1c/S1AP_LocationReportingFailureIndication.c +++ b/lib/asn1c/s1ap/S1AP_LocationReportingFailureIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LocationReportingFailureIndication.h b/lib/asn1c/s1ap/S1AP_LocationReportingFailureIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LocationReportingFailureIndication.h rename to lib/asn1c/s1ap/S1AP_LocationReportingFailureIndication.h index dd829667d..1e23f2794 100644 --- a/lib/s1ap/asn1c/S1AP_LocationReportingFailureIndication.h +++ b/lib/asn1c/s1ap/S1AP_LocationReportingFailureIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggedMBSFNMDT.c b/lib/asn1c/s1ap/S1AP_LoggedMBSFNMDT.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_LoggedMBSFNMDT.c rename to lib/asn1c/s1ap/S1AP_LoggedMBSFNMDT.c index 411b0cfb0..abecda16b 100644 --- a/lib/s1ap/asn1c/S1AP_LoggedMBSFNMDT.c +++ b/lib/asn1c/s1ap/S1AP_LoggedMBSFNMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggedMBSFNMDT.h b/lib/asn1c/s1ap/S1AP_LoggedMBSFNMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LoggedMBSFNMDT.h rename to lib/asn1c/s1ap/S1AP_LoggedMBSFNMDT.h index dd6b10ee6..49e8d7d24 100644 --- a/lib/s1ap/asn1c/S1AP_LoggedMBSFNMDT.h +++ b/lib/asn1c/s1ap/S1AP_LoggedMBSFNMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggedMDT.c b/lib/asn1c/s1ap/S1AP_LoggedMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LoggedMDT.c rename to lib/asn1c/s1ap/S1AP_LoggedMDT.c index 6d51ae3d8..b1e80c45e 100644 --- a/lib/s1ap/asn1c/S1AP_LoggedMDT.c +++ b/lib/asn1c/s1ap/S1AP_LoggedMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggedMDT.h b/lib/asn1c/s1ap/S1AP_LoggedMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_LoggedMDT.h rename to lib/asn1c/s1ap/S1AP_LoggedMDT.h index 7b65036c5..9ee1e9ffd 100644 --- a/lib/s1ap/asn1c/S1AP_LoggedMDT.h +++ b/lib/asn1c/s1ap/S1AP_LoggedMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggingDuration.c b/lib/asn1c/s1ap/S1AP_LoggingDuration.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LoggingDuration.c rename to lib/asn1c/s1ap/S1AP_LoggingDuration.c index bd1c40a35..413bd334d 100644 --- a/lib/s1ap/asn1c/S1AP_LoggingDuration.c +++ b/lib/asn1c/s1ap/S1AP_LoggingDuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggingDuration.h b/lib/asn1c/s1ap/S1AP_LoggingDuration.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_LoggingDuration.h rename to lib/asn1c/s1ap/S1AP_LoggingDuration.h index b80223321..7763a4599 100644 --- a/lib/s1ap/asn1c/S1AP_LoggingDuration.h +++ b/lib/asn1c/s1ap/S1AP_LoggingDuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggingInterval.c b/lib/asn1c/s1ap/S1AP_LoggingInterval.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_LoggingInterval.c rename to lib/asn1c/s1ap/S1AP_LoggingInterval.c index f81ea5a66..5cc1737bc 100644 --- a/lib/s1ap/asn1c/S1AP_LoggingInterval.c +++ b/lib/asn1c/s1ap/S1AP_LoggingInterval.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_LoggingInterval.h b/lib/asn1c/s1ap/S1AP_LoggingInterval.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_LoggingInterval.h rename to lib/asn1c/s1ap/S1AP_LoggingInterval.h index c5aaa0dd5..1f133ebea 100644 --- a/lib/s1ap/asn1c/S1AP_LoggingInterval.h +++ b/lib/asn1c/s1ap/S1AP_LoggingInterval.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M-TMSI.c b/lib/asn1c/s1ap/S1AP_M-TMSI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M-TMSI.c rename to lib/asn1c/s1ap/S1AP_M-TMSI.c index 078964f48..d9771ab52 100644 --- a/lib/s1ap/asn1c/S1AP_M-TMSI.c +++ b/lib/asn1c/s1ap/S1AP_M-TMSI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M-TMSI.h b/lib/asn1c/s1ap/S1AP_M-TMSI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M-TMSI.h rename to lib/asn1c/s1ap/S1AP_M-TMSI.h index c24630962..f004a9d59 100644 --- a/lib/s1ap/asn1c/S1AP_M-TMSI.h +++ b/lib/asn1c/s1ap/S1AP_M-TMSI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M1PeriodicReporting.c b/lib/asn1c/s1ap/S1AP_M1PeriodicReporting.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_M1PeriodicReporting.c rename to lib/asn1c/s1ap/S1AP_M1PeriodicReporting.c index adbea9767..01facf67a 100644 --- a/lib/s1ap/asn1c/S1AP_M1PeriodicReporting.c +++ b/lib/asn1c/s1ap/S1AP_M1PeriodicReporting.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M1PeriodicReporting.h b/lib/asn1c/s1ap/S1AP_M1PeriodicReporting.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M1PeriodicReporting.h rename to lib/asn1c/s1ap/S1AP_M1PeriodicReporting.h index 00c1ca484..b69ae1bd6 100644 --- a/lib/s1ap/asn1c/S1AP_M1PeriodicReporting.h +++ b/lib/asn1c/s1ap/S1AP_M1PeriodicReporting.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M1ReportingTrigger.c b/lib/asn1c/s1ap/S1AP_M1ReportingTrigger.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M1ReportingTrigger.c rename to lib/asn1c/s1ap/S1AP_M1ReportingTrigger.c index 4b4aed877..23912039d 100644 --- a/lib/s1ap/asn1c/S1AP_M1ReportingTrigger.c +++ b/lib/asn1c/s1ap/S1AP_M1ReportingTrigger.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M1ReportingTrigger.h b/lib/asn1c/s1ap/S1AP_M1ReportingTrigger.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_M1ReportingTrigger.h rename to lib/asn1c/s1ap/S1AP_M1ReportingTrigger.h index 3654884c8..a512a3cb6 100644 --- a/lib/s1ap/asn1c/S1AP_M1ReportingTrigger.h +++ b/lib/asn1c/s1ap/S1AP_M1ReportingTrigger.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M1ThresholdEventA2.c b/lib/asn1c/s1ap/S1AP_M1ThresholdEventA2.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M1ThresholdEventA2.c rename to lib/asn1c/s1ap/S1AP_M1ThresholdEventA2.c index 52f9ab80a..3ee31bda4 100644 --- a/lib/s1ap/asn1c/S1AP_M1ThresholdEventA2.c +++ b/lib/asn1c/s1ap/S1AP_M1ThresholdEventA2.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M1ThresholdEventA2.h b/lib/asn1c/s1ap/S1AP_M1ThresholdEventA2.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M1ThresholdEventA2.h rename to lib/asn1c/s1ap/S1AP_M1ThresholdEventA2.h index c57032fa0..8e8bf4fea 100644 --- a/lib/s1ap/asn1c/S1AP_M1ThresholdEventA2.h +++ b/lib/asn1c/s1ap/S1AP_M1ThresholdEventA2.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M3Configuration.c b/lib/asn1c/s1ap/S1AP_M3Configuration.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M3Configuration.c rename to lib/asn1c/s1ap/S1AP_M3Configuration.c index f934ca33b..fa991baa8 100644 --- a/lib/s1ap/asn1c/S1AP_M3Configuration.c +++ b/lib/asn1c/s1ap/S1AP_M3Configuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M3Configuration.h b/lib/asn1c/s1ap/S1AP_M3Configuration.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_M3Configuration.h rename to lib/asn1c/s1ap/S1AP_M3Configuration.h index b573b78e1..284790d17 100644 --- a/lib/s1ap/asn1c/S1AP_M3Configuration.h +++ b/lib/asn1c/s1ap/S1AP_M3Configuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M3period.c b/lib/asn1c/s1ap/S1AP_M3period.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M3period.c rename to lib/asn1c/s1ap/S1AP_M3period.c index 3a3081390..f6a76c953 100644 --- a/lib/s1ap/asn1c/S1AP_M3period.c +++ b/lib/asn1c/s1ap/S1AP_M3period.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M3period.h b/lib/asn1c/s1ap/S1AP_M3period.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_M3period.h rename to lib/asn1c/s1ap/S1AP_M3period.h index 946b2b60b..e80f52e17 100644 --- a/lib/s1ap/asn1c/S1AP_M3period.h +++ b/lib/asn1c/s1ap/S1AP_M3period.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M4Configuration.c b/lib/asn1c/s1ap/S1AP_M4Configuration.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M4Configuration.c rename to lib/asn1c/s1ap/S1AP_M4Configuration.c index 6501a8483..16efc4482 100644 --- a/lib/s1ap/asn1c/S1AP_M4Configuration.c +++ b/lib/asn1c/s1ap/S1AP_M4Configuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M4Configuration.h b/lib/asn1c/s1ap/S1AP_M4Configuration.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M4Configuration.h rename to lib/asn1c/s1ap/S1AP_M4Configuration.h index fc2c78d9c..e085edeca 100644 --- a/lib/s1ap/asn1c/S1AP_M4Configuration.h +++ b/lib/asn1c/s1ap/S1AP_M4Configuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M4period.c b/lib/asn1c/s1ap/S1AP_M4period.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M4period.c rename to lib/asn1c/s1ap/S1AP_M4period.c index fa4662686..ae9ff1974 100644 --- a/lib/s1ap/asn1c/S1AP_M4period.c +++ b/lib/asn1c/s1ap/S1AP_M4period.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M4period.h b/lib/asn1c/s1ap/S1AP_M4period.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_M4period.h rename to lib/asn1c/s1ap/S1AP_M4period.h index e9e915c41..8c0cb21cf 100644 --- a/lib/s1ap/asn1c/S1AP_M4period.h +++ b/lib/asn1c/s1ap/S1AP_M4period.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M5Configuration.c b/lib/asn1c/s1ap/S1AP_M5Configuration.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M5Configuration.c rename to lib/asn1c/s1ap/S1AP_M5Configuration.c index efb5b50ff..fb04327c2 100644 --- a/lib/s1ap/asn1c/S1AP_M5Configuration.c +++ b/lib/asn1c/s1ap/S1AP_M5Configuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M5Configuration.h b/lib/asn1c/s1ap/S1AP_M5Configuration.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M5Configuration.h rename to lib/asn1c/s1ap/S1AP_M5Configuration.h index 3580b7af1..188076771 100644 --- a/lib/s1ap/asn1c/S1AP_M5Configuration.h +++ b/lib/asn1c/s1ap/S1AP_M5Configuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M5period.c b/lib/asn1c/s1ap/S1AP_M5period.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M5period.c rename to lib/asn1c/s1ap/S1AP_M5period.c index 97bea631e..50740e554 100644 --- a/lib/s1ap/asn1c/S1AP_M5period.c +++ b/lib/asn1c/s1ap/S1AP_M5period.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M5period.h b/lib/asn1c/s1ap/S1AP_M5period.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_M5period.h rename to lib/asn1c/s1ap/S1AP_M5period.h index 8f9999d9c..1cedd618c 100644 --- a/lib/s1ap/asn1c/S1AP_M5period.h +++ b/lib/asn1c/s1ap/S1AP_M5period.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M6Configuration.c b/lib/asn1c/s1ap/S1AP_M6Configuration.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_M6Configuration.c rename to lib/asn1c/s1ap/S1AP_M6Configuration.c index e4dca3bee..07405c296 100644 --- a/lib/s1ap/asn1c/S1AP_M6Configuration.c +++ b/lib/asn1c/s1ap/S1AP_M6Configuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M6Configuration.h b/lib/asn1c/s1ap/S1AP_M6Configuration.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M6Configuration.h rename to lib/asn1c/s1ap/S1AP_M6Configuration.h index 07eedab11..0ebd5e4e2 100644 --- a/lib/s1ap/asn1c/S1AP_M6Configuration.h +++ b/lib/asn1c/s1ap/S1AP_M6Configuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M6delay-threshold.c b/lib/asn1c/s1ap/S1AP_M6delay-threshold.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M6delay-threshold.c rename to lib/asn1c/s1ap/S1AP_M6delay-threshold.c index b41abbfce..59d5df2a8 100644 --- a/lib/s1ap/asn1c/S1AP_M6delay-threshold.c +++ b/lib/asn1c/s1ap/S1AP_M6delay-threshold.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M6delay-threshold.h b/lib/asn1c/s1ap/S1AP_M6delay-threshold.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_M6delay-threshold.h rename to lib/asn1c/s1ap/S1AP_M6delay-threshold.h index 844222278..f804345d6 100644 --- a/lib/s1ap/asn1c/S1AP_M6delay-threshold.h +++ b/lib/asn1c/s1ap/S1AP_M6delay-threshold.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M6report-Interval.c b/lib/asn1c/s1ap/S1AP_M6report-Interval.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M6report-Interval.c rename to lib/asn1c/s1ap/S1AP_M6report-Interval.c index a105169b3..f943a5661 100644 --- a/lib/s1ap/asn1c/S1AP_M6report-Interval.c +++ b/lib/asn1c/s1ap/S1AP_M6report-Interval.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M6report-Interval.h b/lib/asn1c/s1ap/S1AP_M6report-Interval.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_M6report-Interval.h rename to lib/asn1c/s1ap/S1AP_M6report-Interval.h index 1ffe73442..a82ec5374 100644 --- a/lib/s1ap/asn1c/S1AP_M6report-Interval.h +++ b/lib/asn1c/s1ap/S1AP_M6report-Interval.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M7Configuration.c b/lib/asn1c/s1ap/S1AP_M7Configuration.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M7Configuration.c rename to lib/asn1c/s1ap/S1AP_M7Configuration.c index d8d87cd8f..717ebf474 100644 --- a/lib/s1ap/asn1c/S1AP_M7Configuration.c +++ b/lib/asn1c/s1ap/S1AP_M7Configuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M7Configuration.h b/lib/asn1c/s1ap/S1AP_M7Configuration.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M7Configuration.h rename to lib/asn1c/s1ap/S1AP_M7Configuration.h index f898143de..abc82dd46 100644 --- a/lib/s1ap/asn1c/S1AP_M7Configuration.h +++ b/lib/asn1c/s1ap/S1AP_M7Configuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M7period.c b/lib/asn1c/s1ap/S1AP_M7period.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_M7period.c rename to lib/asn1c/s1ap/S1AP_M7period.c index 1eb3a0f48..0db5164b7 100644 --- a/lib/s1ap/asn1c/S1AP_M7period.c +++ b/lib/asn1c/s1ap/S1AP_M7period.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_M7period.h b/lib/asn1c/s1ap/S1AP_M7period.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_M7period.h rename to lib/asn1c/s1ap/S1AP_M7period.h index a3b6e8d92..bcbf21ba6 100644 --- a/lib/s1ap/asn1c/S1AP_M7period.h +++ b/lib/asn1c/s1ap/S1AP_M7period.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLog.c b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLog.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MBSFN-ResultToLog.c rename to lib/asn1c/s1ap/S1AP_MBSFN-ResultToLog.c index 41fbc4f43..52af0daf1 100644 --- a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLog.c +++ b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLog.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLog.h b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLog.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MBSFN-ResultToLog.h rename to lib/asn1c/s1ap/S1AP_MBSFN-ResultToLog.h index 0b1de55f1..218f8ee44 100644 --- a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLog.h +++ b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLog.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLogInfo.c b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLogInfo.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_MBSFN-ResultToLogInfo.c rename to lib/asn1c/s1ap/S1AP_MBSFN-ResultToLogInfo.c index 0a5a18ac3..c5de7b9f9 100644 --- a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLogInfo.c +++ b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLogInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLogInfo.h b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLogInfo.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MBSFN-ResultToLogInfo.h rename to lib/asn1c/s1ap/S1AP_MBSFN-ResultToLogInfo.h index 2a5af07d1..fea982b22 100644 --- a/lib/s1ap/asn1c/S1AP_MBSFN-ResultToLogInfo.h +++ b/lib/asn1c/s1ap/S1AP_MBSFN-ResultToLogInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDT-Activation.c b/lib/asn1c/s1ap/S1AP_MDT-Activation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MDT-Activation.c rename to lib/asn1c/s1ap/S1AP_MDT-Activation.c index aeb4f4583..b994ad11e 100644 --- a/lib/s1ap/asn1c/S1AP_MDT-Activation.c +++ b/lib/asn1c/s1ap/S1AP_MDT-Activation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDT-Activation.h b/lib/asn1c/s1ap/S1AP_MDT-Activation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MDT-Activation.h rename to lib/asn1c/s1ap/S1AP_MDT-Activation.h index 3015eb821..ae5d532ef 100644 --- a/lib/s1ap/asn1c/S1AP_MDT-Activation.h +++ b/lib/asn1c/s1ap/S1AP_MDT-Activation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDT-Configuration.c b/lib/asn1c/s1ap/S1AP_MDT-Configuration.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_MDT-Configuration.c rename to lib/asn1c/s1ap/S1AP_MDT-Configuration.c index e8b0844a3..9e546ee8e 100644 --- a/lib/s1ap/asn1c/S1AP_MDT-Configuration.c +++ b/lib/asn1c/s1ap/S1AP_MDT-Configuration.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDT-Configuration.h b/lib/asn1c/s1ap/S1AP_MDT-Configuration.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MDT-Configuration.h rename to lib/asn1c/s1ap/S1AP_MDT-Configuration.h index 337c9c5bb..c846fb002 100644 --- a/lib/s1ap/asn1c/S1AP_MDT-Configuration.h +++ b/lib/asn1c/s1ap/S1AP_MDT-Configuration.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDT-Location-Info.c b/lib/asn1c/s1ap/S1AP_MDT-Location-Info.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MDT-Location-Info.c rename to lib/asn1c/s1ap/S1AP_MDT-Location-Info.c index bcfc4ff7b..013ebe58b 100644 --- a/lib/s1ap/asn1c/S1AP_MDT-Location-Info.c +++ b/lib/asn1c/s1ap/S1AP_MDT-Location-Info.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDT-Location-Info.h b/lib/asn1c/s1ap/S1AP_MDT-Location-Info.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MDT-Location-Info.h rename to lib/asn1c/s1ap/S1AP_MDT-Location-Info.h index 7170f90e7..341777577 100644 --- a/lib/s1ap/asn1c/S1AP_MDT-Location-Info.h +++ b/lib/asn1c/s1ap/S1AP_MDT-Location-Info.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDTMode-Extension.c b/lib/asn1c/s1ap/S1AP_MDTMode-Extension.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_MDTMode-Extension.c rename to lib/asn1c/s1ap/S1AP_MDTMode-Extension.c index 30af590fd..c71e4e408 100644 --- a/lib/s1ap/asn1c/S1AP_MDTMode-Extension.c +++ b/lib/asn1c/s1ap/S1AP_MDTMode-Extension.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDTMode-Extension.h b/lib/asn1c/s1ap/S1AP_MDTMode-Extension.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MDTMode-Extension.h rename to lib/asn1c/s1ap/S1AP_MDTMode-Extension.h index 87743e67b..71aa60efa 100644 --- a/lib/s1ap/asn1c/S1AP_MDTMode-Extension.h +++ b/lib/asn1c/s1ap/S1AP_MDTMode-Extension.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDTMode.c b/lib/asn1c/s1ap/S1AP_MDTMode.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MDTMode.c rename to lib/asn1c/s1ap/S1AP_MDTMode.c index ae0c501b5..120e70a93 100644 --- a/lib/s1ap/asn1c/S1AP_MDTMode.c +++ b/lib/asn1c/s1ap/S1AP_MDTMode.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDTMode.h b/lib/asn1c/s1ap/S1AP_MDTMode.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MDTMode.h rename to lib/asn1c/s1ap/S1AP_MDTMode.h index cb078ac7e..6a8a6f74a 100644 --- a/lib/s1ap/asn1c/S1AP_MDTMode.h +++ b/lib/asn1c/s1ap/S1AP_MDTMode.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDTPLMNList.c b/lib/asn1c/s1ap/S1AP_MDTPLMNList.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_MDTPLMNList.c rename to lib/asn1c/s1ap/S1AP_MDTPLMNList.c index 3c2d66fc6..f889ff514 100644 --- a/lib/s1ap/asn1c/S1AP_MDTPLMNList.c +++ b/lib/asn1c/s1ap/S1AP_MDTPLMNList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MDTPLMNList.h b/lib/asn1c/s1ap/S1AP_MDTPLMNList.h similarity index 93% rename from lib/s1ap/asn1c/S1AP_MDTPLMNList.h rename to lib/asn1c/s1ap/S1AP_MDTPLMNList.h index 9979d348d..18a4a0ece 100644 --- a/lib/s1ap/asn1c/S1AP_MDTPLMNList.h +++ b/lib/asn1c/s1ap/S1AP_MDTPLMNList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MME-Code.c b/lib/asn1c/s1ap/S1AP_MME-Code.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MME-Code.c rename to lib/asn1c/s1ap/S1AP_MME-Code.c index fd2255e33..ddddc8d45 100644 --- a/lib/s1ap/asn1c/S1AP_MME-Code.c +++ b/lib/asn1c/s1ap/S1AP_MME-Code.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MME-Code.h b/lib/asn1c/s1ap/S1AP_MME-Code.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MME-Code.h rename to lib/asn1c/s1ap/S1AP_MME-Code.h index 01a93a4e3..d2a7a5109 100644 --- a/lib/s1ap/asn1c/S1AP_MME-Code.h +++ b/lib/asn1c/s1ap/S1AP_MME-Code.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MME-Group-ID.c b/lib/asn1c/s1ap/S1AP_MME-Group-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MME-Group-ID.c rename to lib/asn1c/s1ap/S1AP_MME-Group-ID.c index a44007f13..a2120dc5d 100644 --- a/lib/s1ap/asn1c/S1AP_MME-Group-ID.c +++ b/lib/asn1c/s1ap/S1AP_MME-Group-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MME-Group-ID.h b/lib/asn1c/s1ap/S1AP_MME-Group-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MME-Group-ID.h rename to lib/asn1c/s1ap/S1AP_MME-Group-ID.h index 507988d49..463223486 100644 --- a/lib/s1ap/asn1c/S1AP_MME-Group-ID.h +++ b/lib/asn1c/s1ap/S1AP_MME-Group-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MME-UE-S1AP-ID.c b/lib/asn1c/s1ap/S1AP_MME-UE-S1AP-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MME-UE-S1AP-ID.c rename to lib/asn1c/s1ap/S1AP_MME-UE-S1AP-ID.c index 71d8b1b18..14dc1a1ec 100644 --- a/lib/s1ap/asn1c/S1AP_MME-UE-S1AP-ID.c +++ b/lib/asn1c/s1ap/S1AP_MME-UE-S1AP-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MME-UE-S1AP-ID.h b/lib/asn1c/s1ap/S1AP_MME-UE-S1AP-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MME-UE-S1AP-ID.h rename to lib/asn1c/s1ap/S1AP_MME-UE-S1AP-ID.h index ee6651ce7..f9f016a83 100644 --- a/lib/s1ap/asn1c/S1AP_MME-UE-S1AP-ID.h +++ b/lib/asn1c/s1ap/S1AP_MME-UE-S1AP-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMECPRelocationIndication.c b/lib/asn1c/s1ap/S1AP_MMECPRelocationIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMECPRelocationIndication.c rename to lib/asn1c/s1ap/S1AP_MMECPRelocationIndication.c index 387b91e8d..73090b403 100644 --- a/lib/s1ap/asn1c/S1AP_MMECPRelocationIndication.c +++ b/lib/asn1c/s1ap/S1AP_MMECPRelocationIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMECPRelocationIndication.h b/lib/asn1c/s1ap/S1AP_MMECPRelocationIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMECPRelocationIndication.h rename to lib/asn1c/s1ap/S1AP_MMECPRelocationIndication.h index 040ceaa6f..87573675c 100644 --- a/lib/s1ap/asn1c/S1AP_MMECPRelocationIndication.h +++ b/lib/asn1c/s1ap/S1AP_MMECPRelocationIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationTransfer.c b/lib/asn1c/s1ap/S1AP_MMEConfigurationTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationTransfer.c rename to lib/asn1c/s1ap/S1AP_MMEConfigurationTransfer.c index b2c757fc5..6a7565d1c 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationTransfer.c +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationTransfer.h b/lib/asn1c/s1ap/S1AP_MMEConfigurationTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationTransfer.h rename to lib/asn1c/s1ap/S1AP_MMEConfigurationTransfer.h index 0508fcc94..6611521d6 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationTransfer.h +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdate.c b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdate.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationUpdate.c rename to lib/asn1c/s1ap/S1AP_MMEConfigurationUpdate.c index 7e410f845..9dee33940 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdate.c +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdate.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdate.h b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdate.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationUpdate.h rename to lib/asn1c/s1ap/S1AP_MMEConfigurationUpdate.h index 4db304bd8..61d18f8b9 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdate.h +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdate.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateAcknowledge.c b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateAcknowledge.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateAcknowledge.c rename to lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateAcknowledge.c index 7ebdee573..71095c88c 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateAcknowledge.c +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateAcknowledge.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateAcknowledge.h b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateAcknowledge.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateAcknowledge.h rename to lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateAcknowledge.h index 70391e95e..87f0dc2cb 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateAcknowledge.h +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateAcknowledge.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateFailure.c b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateFailure.c rename to lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateFailure.c index e3343aefd..21d030ad8 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateFailure.c +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateFailure.h b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateFailure.h rename to lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateFailure.h index 97dc8395b..13631ec7f 100644 --- a/lib/s1ap/asn1c/S1AP_MMEConfigurationUpdateFailure.h +++ b/lib/asn1c/s1ap/S1AP_MMEConfigurationUpdateFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEDirectInformationTransfer.c b/lib/asn1c/s1ap/S1AP_MMEDirectInformationTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEDirectInformationTransfer.c rename to lib/asn1c/s1ap/S1AP_MMEDirectInformationTransfer.c index e66164a8b..b36cc5dac 100644 --- a/lib/s1ap/asn1c/S1AP_MMEDirectInformationTransfer.c +++ b/lib/asn1c/s1ap/S1AP_MMEDirectInformationTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEDirectInformationTransfer.h b/lib/asn1c/s1ap/S1AP_MMEDirectInformationTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEDirectInformationTransfer.h rename to lib/asn1c/s1ap/S1AP_MMEDirectInformationTransfer.h index 572b2476c..d22bdecd9 100644 --- a/lib/s1ap/asn1c/S1AP_MMEDirectInformationTransfer.h +++ b/lib/asn1c/s1ap/S1AP_MMEDirectInformationTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEPagingTarget.c b/lib/asn1c/s1ap/S1AP_MMEPagingTarget.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEPagingTarget.c rename to lib/asn1c/s1ap/S1AP_MMEPagingTarget.c index 60333b99d..0ca95c14d 100644 --- a/lib/s1ap/asn1c/S1AP_MMEPagingTarget.c +++ b/lib/asn1c/s1ap/S1AP_MMEPagingTarget.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEPagingTarget.h b/lib/asn1c/s1ap/S1AP_MMEPagingTarget.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MMEPagingTarget.h rename to lib/asn1c/s1ap/S1AP_MMEPagingTarget.h index 85dbcae89..2d1002c1e 100644 --- a/lib/s1ap/asn1c/S1AP_MMEPagingTarget.h +++ b/lib/asn1c/s1ap/S1AP_MMEPagingTarget.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMERelaySupportIndicator.c b/lib/asn1c/s1ap/S1AP_MMERelaySupportIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMERelaySupportIndicator.c rename to lib/asn1c/s1ap/S1AP_MMERelaySupportIndicator.c index ffbf2ead8..a535dd95a 100644 --- a/lib/s1ap/asn1c/S1AP_MMERelaySupportIndicator.c +++ b/lib/asn1c/s1ap/S1AP_MMERelaySupportIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMERelaySupportIndicator.h b/lib/asn1c/s1ap/S1AP_MMERelaySupportIndicator.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MMERelaySupportIndicator.h rename to lib/asn1c/s1ap/S1AP_MMERelaySupportIndicator.h index f537442eb..72e1bac61 100644 --- a/lib/s1ap/asn1c/S1AP_MMERelaySupportIndicator.h +++ b/lib/asn1c/s1ap/S1AP_MMERelaySupportIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEStatusTransfer.c b/lib/asn1c/s1ap/S1AP_MMEStatusTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MMEStatusTransfer.c rename to lib/asn1c/s1ap/S1AP_MMEStatusTransfer.c index 86ab2406b..f67c717fb 100644 --- a/lib/s1ap/asn1c/S1AP_MMEStatusTransfer.c +++ b/lib/asn1c/s1ap/S1AP_MMEStatusTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEStatusTransfer.h b/lib/asn1c/s1ap/S1AP_MMEStatusTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEStatusTransfer.h rename to lib/asn1c/s1ap/S1AP_MMEStatusTransfer.h index 342aa6896..9ca8ffdc4 100644 --- a/lib/s1ap/asn1c/S1AP_MMEStatusTransfer.h +++ b/lib/asn1c/s1ap/S1AP_MMEStatusTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEname.c b/lib/asn1c/s1ap/S1AP_MMEname.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_MMEname.c rename to lib/asn1c/s1ap/S1AP_MMEname.c index 83c815c6b..cb2a03cae 100644 --- a/lib/s1ap/asn1c/S1AP_MMEname.c +++ b/lib/asn1c/s1ap/S1AP_MMEname.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MMEname.h b/lib/asn1c/s1ap/S1AP_MMEname.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MMEname.h rename to lib/asn1c/s1ap/S1AP_MMEname.h index 8e58261de..346de2385 100644 --- a/lib/s1ap/asn1c/S1AP_MMEname.h +++ b/lib/asn1c/s1ap/S1AP_MMEname.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MSClassmark2.c b/lib/asn1c/s1ap/S1AP_MSClassmark2.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_MSClassmark2.c rename to lib/asn1c/s1ap/S1AP_MSClassmark2.c index bd0bb2178..4ddad13e2 100644 --- a/lib/s1ap/asn1c/S1AP_MSClassmark2.c +++ b/lib/asn1c/s1ap/S1AP_MSClassmark2.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MSClassmark2.h b/lib/asn1c/s1ap/S1AP_MSClassmark2.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MSClassmark2.h rename to lib/asn1c/s1ap/S1AP_MSClassmark2.h index 84938c8f0..4f2fc7e37 100644 --- a/lib/s1ap/asn1c/S1AP_MSClassmark2.h +++ b/lib/asn1c/s1ap/S1AP_MSClassmark2.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MSClassmark3.c b/lib/asn1c/s1ap/S1AP_MSClassmark3.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_MSClassmark3.c rename to lib/asn1c/s1ap/S1AP_MSClassmark3.c index f019ddcbd..14dd8bd86 100644 --- a/lib/s1ap/asn1c/S1AP_MSClassmark3.c +++ b/lib/asn1c/s1ap/S1AP_MSClassmark3.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MSClassmark3.h b/lib/asn1c/s1ap/S1AP_MSClassmark3.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_MSClassmark3.h rename to lib/asn1c/s1ap/S1AP_MSClassmark3.h index bfefc910e..d968127de 100644 --- a/lib/s1ap/asn1c/S1AP_MSClassmark3.h +++ b/lib/asn1c/s1ap/S1AP_MSClassmark3.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ManagementBasedMDTAllowed.c b/lib/asn1c/s1ap/S1AP_ManagementBasedMDTAllowed.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ManagementBasedMDTAllowed.c rename to lib/asn1c/s1ap/S1AP_ManagementBasedMDTAllowed.c index fa7a2e894..350918003 100644 --- a/lib/s1ap/asn1c/S1AP_ManagementBasedMDTAllowed.c +++ b/lib/asn1c/s1ap/S1AP_ManagementBasedMDTAllowed.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ManagementBasedMDTAllowed.h b/lib/asn1c/s1ap/S1AP_ManagementBasedMDTAllowed.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ManagementBasedMDTAllowed.h rename to lib/asn1c/s1ap/S1AP_ManagementBasedMDTAllowed.h index 0d5fa58df..f5c482694 100644 --- a/lib/s1ap/asn1c/S1AP_ManagementBasedMDTAllowed.h +++ b/lib/asn1c/s1ap/S1AP_ManagementBasedMDTAllowed.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Masked-IMEISV.c b/lib/asn1c/s1ap/S1AP_Masked-IMEISV.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Masked-IMEISV.c rename to lib/asn1c/s1ap/S1AP_Masked-IMEISV.c index 05fa7c7cf..696c34c84 100644 --- a/lib/s1ap/asn1c/S1AP_Masked-IMEISV.c +++ b/lib/asn1c/s1ap/S1AP_Masked-IMEISV.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Masked-IMEISV.h b/lib/asn1c/s1ap/S1AP_Masked-IMEISV.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Masked-IMEISV.h rename to lib/asn1c/s1ap/S1AP_Masked-IMEISV.h index 23a2c8ccb..4debcdec2 100644 --- a/lib/s1ap/asn1c/S1AP_Masked-IMEISV.h +++ b/lib/asn1c/s1ap/S1AP_Masked-IMEISV.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MeasurementThresholdA2.c b/lib/asn1c/s1ap/S1AP_MeasurementThresholdA2.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MeasurementThresholdA2.c rename to lib/asn1c/s1ap/S1AP_MeasurementThresholdA2.c index 63faebdff..a595d3666 100644 --- a/lib/s1ap/asn1c/S1AP_MeasurementThresholdA2.c +++ b/lib/asn1c/s1ap/S1AP_MeasurementThresholdA2.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MeasurementThresholdA2.h b/lib/asn1c/s1ap/S1AP_MeasurementThresholdA2.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MeasurementThresholdA2.h rename to lib/asn1c/s1ap/S1AP_MeasurementThresholdA2.h index 57e03bf6b..7db27f54f 100644 --- a/lib/s1ap/asn1c/S1AP_MeasurementThresholdA2.h +++ b/lib/asn1c/s1ap/S1AP_MeasurementThresholdA2.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MeasurementsToActivate.c b/lib/asn1c/s1ap/S1AP_MeasurementsToActivate.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MeasurementsToActivate.c rename to lib/asn1c/s1ap/S1AP_MeasurementsToActivate.c index 9ef866fca..992c3fc51 100644 --- a/lib/s1ap/asn1c/S1AP_MeasurementsToActivate.c +++ b/lib/asn1c/s1ap/S1AP_MeasurementsToActivate.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MeasurementsToActivate.h b/lib/asn1c/s1ap/S1AP_MeasurementsToActivate.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MeasurementsToActivate.h rename to lib/asn1c/s1ap/S1AP_MeasurementsToActivate.h index dd62fb378..ac3e1e95f 100644 --- a/lib/s1ap/asn1c/S1AP_MeasurementsToActivate.h +++ b/lib/asn1c/s1ap/S1AP_MeasurementsToActivate.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MessageIdentifier.c b/lib/asn1c/s1ap/S1AP_MessageIdentifier.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MessageIdentifier.c rename to lib/asn1c/s1ap/S1AP_MessageIdentifier.c index 35e4a8c0a..6b85293ad 100644 --- a/lib/s1ap/asn1c/S1AP_MessageIdentifier.c +++ b/lib/asn1c/s1ap/S1AP_MessageIdentifier.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MessageIdentifier.h b/lib/asn1c/s1ap/S1AP_MessageIdentifier.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MessageIdentifier.h rename to lib/asn1c/s1ap/S1AP_MessageIdentifier.h index 7762deb18..dd0c565de 100644 --- a/lib/s1ap/asn1c/S1AP_MessageIdentifier.h +++ b/lib/asn1c/s1ap/S1AP_MessageIdentifier.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MobilityInformation.c b/lib/asn1c/s1ap/S1AP_MobilityInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MobilityInformation.c rename to lib/asn1c/s1ap/S1AP_MobilityInformation.c index 056f78c26..f78fc737d 100644 --- a/lib/s1ap/asn1c/S1AP_MobilityInformation.c +++ b/lib/asn1c/s1ap/S1AP_MobilityInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MobilityInformation.h b/lib/asn1c/s1ap/S1AP_MobilityInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_MobilityInformation.h rename to lib/asn1c/s1ap/S1AP_MobilityInformation.h index 934680890..2de969a35 100644 --- a/lib/s1ap/asn1c/S1AP_MobilityInformation.h +++ b/lib/asn1c/s1ap/S1AP_MobilityInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MutingAvailabilityIndication.c b/lib/asn1c/s1ap/S1AP_MutingAvailabilityIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_MutingAvailabilityIndication.c rename to lib/asn1c/s1ap/S1AP_MutingAvailabilityIndication.c index d48f38a7f..6ea6bb3d4 100644 --- a/lib/s1ap/asn1c/S1AP_MutingAvailabilityIndication.c +++ b/lib/asn1c/s1ap/S1AP_MutingAvailabilityIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MutingAvailabilityIndication.h b/lib/asn1c/s1ap/S1AP_MutingAvailabilityIndication.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_MutingAvailabilityIndication.h rename to lib/asn1c/s1ap/S1AP_MutingAvailabilityIndication.h index 8a7af1a9a..35cf2b7aa 100644 --- a/lib/s1ap/asn1c/S1AP_MutingAvailabilityIndication.h +++ b/lib/asn1c/s1ap/S1AP_MutingAvailabilityIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MutingPatternInformation.c b/lib/asn1c/s1ap/S1AP_MutingPatternInformation.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_MutingPatternInformation.c rename to lib/asn1c/s1ap/S1AP_MutingPatternInformation.c index e08718e23..266313c64 100644 --- a/lib/s1ap/asn1c/S1AP_MutingPatternInformation.c +++ b/lib/asn1c/s1ap/S1AP_MutingPatternInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_MutingPatternInformation.h b/lib/asn1c/s1ap/S1AP_MutingPatternInformation.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_MutingPatternInformation.h rename to lib/asn1c/s1ap/S1AP_MutingPatternInformation.h index 8fa371949..afc32a513 100644 --- a/lib/s1ap/asn1c/S1AP_MutingPatternInformation.h +++ b/lib/asn1c/s1ap/S1AP_MutingPatternInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NAS-PDU.c b/lib/asn1c/s1ap/S1AP_NAS-PDU.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_NAS-PDU.c rename to lib/asn1c/s1ap/S1AP_NAS-PDU.c index 5e6d8480b..827c5a644 100644 --- a/lib/s1ap/asn1c/S1AP_NAS-PDU.c +++ b/lib/asn1c/s1ap/S1AP_NAS-PDU.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NAS-PDU.h b/lib/asn1c/s1ap/S1AP_NAS-PDU.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_NAS-PDU.h rename to lib/asn1c/s1ap/S1AP_NAS-PDU.h index dff4cb12d..1c754f2fe 100644 --- a/lib/s1ap/asn1c/S1AP_NAS-PDU.h +++ b/lib/asn1c/s1ap/S1AP_NAS-PDU.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASDeliveryIndication.c b/lib/asn1c/s1ap/S1AP_NASDeliveryIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NASDeliveryIndication.c rename to lib/asn1c/s1ap/S1AP_NASDeliveryIndication.c index 54530d900..0e697869d 100644 --- a/lib/s1ap/asn1c/S1AP_NASDeliveryIndication.c +++ b/lib/asn1c/s1ap/S1AP_NASDeliveryIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASDeliveryIndication.h b/lib/asn1c/s1ap/S1AP_NASDeliveryIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_NASDeliveryIndication.h rename to lib/asn1c/s1ap/S1AP_NASDeliveryIndication.h index 7736c18b9..1193fc873 100644 --- a/lib/s1ap/asn1c/S1AP_NASDeliveryIndication.h +++ b/lib/asn1c/s1ap/S1AP_NASDeliveryIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASNonDeliveryIndication.c b/lib/asn1c/s1ap/S1AP_NASNonDeliveryIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NASNonDeliveryIndication.c rename to lib/asn1c/s1ap/S1AP_NASNonDeliveryIndication.c index 420894848..01ae28300 100644 --- a/lib/s1ap/asn1c/S1AP_NASNonDeliveryIndication.c +++ b/lib/asn1c/s1ap/S1AP_NASNonDeliveryIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASNonDeliveryIndication.h b/lib/asn1c/s1ap/S1AP_NASNonDeliveryIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_NASNonDeliveryIndication.h rename to lib/asn1c/s1ap/S1AP_NASNonDeliveryIndication.h index 9518dea8e..0f8fab61b 100644 --- a/lib/s1ap/asn1c/S1AP_NASNonDeliveryIndication.h +++ b/lib/asn1c/s1ap/S1AP_NASNonDeliveryIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASSecurityParametersfromE-UTRAN.c b/lib/asn1c/s1ap/S1AP_NASSecurityParametersfromE-UTRAN.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_NASSecurityParametersfromE-UTRAN.c rename to lib/asn1c/s1ap/S1AP_NASSecurityParametersfromE-UTRAN.c index 5ac4184aa..a72b8b9b5 100644 --- a/lib/s1ap/asn1c/S1AP_NASSecurityParametersfromE-UTRAN.c +++ b/lib/asn1c/s1ap/S1AP_NASSecurityParametersfromE-UTRAN.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASSecurityParametersfromE-UTRAN.h b/lib/asn1c/s1ap/S1AP_NASSecurityParametersfromE-UTRAN.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_NASSecurityParametersfromE-UTRAN.h rename to lib/asn1c/s1ap/S1AP_NASSecurityParametersfromE-UTRAN.h index 945103108..1693e36d7 100644 --- a/lib/s1ap/asn1c/S1AP_NASSecurityParametersfromE-UTRAN.h +++ b/lib/asn1c/s1ap/S1AP_NASSecurityParametersfromE-UTRAN.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASSecurityParameterstoE-UTRAN.c b/lib/asn1c/s1ap/S1AP_NASSecurityParameterstoE-UTRAN.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_NASSecurityParameterstoE-UTRAN.c rename to lib/asn1c/s1ap/S1AP_NASSecurityParameterstoE-UTRAN.c index 8f551908a..403980da9 100644 --- a/lib/s1ap/asn1c/S1AP_NASSecurityParameterstoE-UTRAN.c +++ b/lib/asn1c/s1ap/S1AP_NASSecurityParameterstoE-UTRAN.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NASSecurityParameterstoE-UTRAN.h b/lib/asn1c/s1ap/S1AP_NASSecurityParameterstoE-UTRAN.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_NASSecurityParameterstoE-UTRAN.h rename to lib/asn1c/s1ap/S1AP_NASSecurityParameterstoE-UTRAN.h index c4e3f14f1..8ceebea87 100644 --- a/lib/s1ap/asn1c/S1AP_NASSecurityParameterstoE-UTRAN.h +++ b/lib/asn1c/s1ap/S1AP_NASSecurityParameterstoE-UTRAN.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-DefaultPagingDRX.c b/lib/asn1c/s1ap/S1AP_NB-IoT-DefaultPagingDRX.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NB-IoT-DefaultPagingDRX.c rename to lib/asn1c/s1ap/S1AP_NB-IoT-DefaultPagingDRX.c index d30a28c21..d262decf7 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-DefaultPagingDRX.c +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-DefaultPagingDRX.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-DefaultPagingDRX.h b/lib/asn1c/s1ap/S1AP_NB-IoT-DefaultPagingDRX.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_NB-IoT-DefaultPagingDRX.h rename to lib/asn1c/s1ap/S1AP_NB-IoT-DefaultPagingDRX.h index f74b2a3ea..13acc8e58 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-DefaultPagingDRX.h +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-DefaultPagingDRX.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRX-Cycle.c b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRX-Cycle.c rename to lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.c index 4a7df889e..22ba3ff8b 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRX-Cycle.c +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRX-Cycle.h b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRX-Cycle.h rename to lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.h index 54e348d8b..9d5842a8d 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRX-Cycle.h +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRX-Cycle.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRXInformation.c b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRXInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRXInformation.c rename to lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRXInformation.c index d7cc834fa..48d5d94a5 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRXInformation.c +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRXInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRXInformation.h b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRXInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRXInformation.h rename to lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRXInformation.h index 49267eee1..8ad56cf13 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-Paging-eDRXInformation.h +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-Paging-eDRXInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-PagingTimeWindow.c b/lib/asn1c/s1ap/S1AP_NB-IoT-PagingTimeWindow.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_NB-IoT-PagingTimeWindow.c rename to lib/asn1c/s1ap/S1AP_NB-IoT-PagingTimeWindow.c index b6410b405..8f4fdccd0 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-PagingTimeWindow.c +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-PagingTimeWindow.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-PagingTimeWindow.h b/lib/asn1c/s1ap/S1AP_NB-IoT-PagingTimeWindow.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_NB-IoT-PagingTimeWindow.h rename to lib/asn1c/s1ap/S1AP_NB-IoT-PagingTimeWindow.h index 6d2c66c37..8de2c7e17 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-PagingTimeWindow.h +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-PagingTimeWindow.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-UEIdentityIndexValue.c b/lib/asn1c/s1ap/S1AP_NB-IoT-UEIdentityIndexValue.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NB-IoT-UEIdentityIndexValue.c rename to lib/asn1c/s1ap/S1AP_NB-IoT-UEIdentityIndexValue.c index eb086b274..738e9246e 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-UEIdentityIndexValue.c +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-UEIdentityIndexValue.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NB-IoT-UEIdentityIndexValue.h b/lib/asn1c/s1ap/S1AP_NB-IoT-UEIdentityIndexValue.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_NB-IoT-UEIdentityIndexValue.h rename to lib/asn1c/s1ap/S1AP_NB-IoT-UEIdentityIndexValue.h index 5b0f8b257..23dfb5c5f 100644 --- a/lib/s1ap/asn1c/S1AP_NB-IoT-UEIdentityIndexValue.h +++ b/lib/asn1c/s1ap/S1AP_NB-IoT-UEIdentityIndexValue.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NextPagingAreaScope.c b/lib/asn1c/s1ap/S1AP_NextPagingAreaScope.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NextPagingAreaScope.c rename to lib/asn1c/s1ap/S1AP_NextPagingAreaScope.c index 645d7dc92..aee808967 100644 --- a/lib/s1ap/asn1c/S1AP_NextPagingAreaScope.c +++ b/lib/asn1c/s1ap/S1AP_NextPagingAreaScope.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NextPagingAreaScope.h b/lib/asn1c/s1ap/S1AP_NextPagingAreaScope.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_NextPagingAreaScope.h rename to lib/asn1c/s1ap/S1AP_NextPagingAreaScope.h index 4ad03db49..7f82a4f75 100644 --- a/lib/s1ap/asn1c/S1AP_NextPagingAreaScope.h +++ b/lib/asn1c/s1ap/S1AP_NextPagingAreaScope.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NumberOfBroadcasts.c b/lib/asn1c/s1ap/S1AP_NumberOfBroadcasts.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NumberOfBroadcasts.c rename to lib/asn1c/s1ap/S1AP_NumberOfBroadcasts.c index 142142c06..3a4fcd4db 100644 --- a/lib/s1ap/asn1c/S1AP_NumberOfBroadcasts.c +++ b/lib/asn1c/s1ap/S1AP_NumberOfBroadcasts.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NumberOfBroadcasts.h b/lib/asn1c/s1ap/S1AP_NumberOfBroadcasts.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_NumberOfBroadcasts.h rename to lib/asn1c/s1ap/S1AP_NumberOfBroadcasts.h index f26ac96eb..bde969a31 100644 --- a/lib/s1ap/asn1c/S1AP_NumberOfBroadcasts.h +++ b/lib/asn1c/s1ap/S1AP_NumberOfBroadcasts.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NumberofBroadcastRequest.c b/lib/asn1c/s1ap/S1AP_NumberofBroadcastRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_NumberofBroadcastRequest.c rename to lib/asn1c/s1ap/S1AP_NumberofBroadcastRequest.c index 73ed2629f..7d54a8db5 100644 --- a/lib/s1ap/asn1c/S1AP_NumberofBroadcastRequest.c +++ b/lib/asn1c/s1ap/S1AP_NumberofBroadcastRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_NumberofBroadcastRequest.h b/lib/asn1c/s1ap/S1AP_NumberofBroadcastRequest.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_NumberofBroadcastRequest.h rename to lib/asn1c/s1ap/S1AP_NumberofBroadcastRequest.h index 069fb4a02..8eabd6ba8 100644 --- a/lib/s1ap/asn1c/S1AP_NumberofBroadcastRequest.h +++ b/lib/asn1c/s1ap/S1AP_NumberofBroadcastRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OldBSS-ToNewBSS-Information.c b/lib/asn1c/s1ap/S1AP_OldBSS-ToNewBSS-Information.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_OldBSS-ToNewBSS-Information.c rename to lib/asn1c/s1ap/S1AP_OldBSS-ToNewBSS-Information.c index 78e2b53e9..21b1f31da 100644 --- a/lib/s1ap/asn1c/S1AP_OldBSS-ToNewBSS-Information.c +++ b/lib/asn1c/s1ap/S1AP_OldBSS-ToNewBSS-Information.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OldBSS-ToNewBSS-Information.h b/lib/asn1c/s1ap/S1AP_OldBSS-ToNewBSS-Information.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_OldBSS-ToNewBSS-Information.h rename to lib/asn1c/s1ap/S1AP_OldBSS-ToNewBSS-Information.h index 2b9ad53e1..8754d9ac3 100644 --- a/lib/s1ap/asn1c/S1AP_OldBSS-ToNewBSS-Information.h +++ b/lib/asn1c/s1ap/S1AP_OldBSS-ToNewBSS-Information.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadAction.c b/lib/asn1c/s1ap/S1AP_OverloadAction.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_OverloadAction.c rename to lib/asn1c/s1ap/S1AP_OverloadAction.c index ee7b08e56..2c09de616 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadAction.c +++ b/lib/asn1c/s1ap/S1AP_OverloadAction.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadAction.h b/lib/asn1c/s1ap/S1AP_OverloadAction.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_OverloadAction.h rename to lib/asn1c/s1ap/S1AP_OverloadAction.h index 0e3d9062b..5d7244e14 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadAction.h +++ b/lib/asn1c/s1ap/S1AP_OverloadAction.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadResponse.c b/lib/asn1c/s1ap/S1AP_OverloadResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_OverloadResponse.c rename to lib/asn1c/s1ap/S1AP_OverloadResponse.c index 650203b4e..e61127351 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadResponse.c +++ b/lib/asn1c/s1ap/S1AP_OverloadResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadResponse.h b/lib/asn1c/s1ap/S1AP_OverloadResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_OverloadResponse.h rename to lib/asn1c/s1ap/S1AP_OverloadResponse.h index c4592e89c..5f88c8dfd 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadResponse.h +++ b/lib/asn1c/s1ap/S1AP_OverloadResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadStart.c b/lib/asn1c/s1ap/S1AP_OverloadStart.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_OverloadStart.c rename to lib/asn1c/s1ap/S1AP_OverloadStart.c index 63881b58b..d90689092 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadStart.c +++ b/lib/asn1c/s1ap/S1AP_OverloadStart.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadStart.h b/lib/asn1c/s1ap/S1AP_OverloadStart.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_OverloadStart.h rename to lib/asn1c/s1ap/S1AP_OverloadStart.h index a08c90b6c..18b539bd8 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadStart.h +++ b/lib/asn1c/s1ap/S1AP_OverloadStart.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadStop.c b/lib/asn1c/s1ap/S1AP_OverloadStop.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_OverloadStop.c rename to lib/asn1c/s1ap/S1AP_OverloadStop.c index a556c1a4e..6ef547f3d 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadStop.c +++ b/lib/asn1c/s1ap/S1AP_OverloadStop.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_OverloadStop.h b/lib/asn1c/s1ap/S1AP_OverloadStop.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_OverloadStop.h rename to lib/asn1c/s1ap/S1AP_OverloadStop.h index b53c0210d..c4dd742c2 100644 --- a/lib/s1ap/asn1c/S1AP_OverloadStop.h +++ b/lib/asn1c/s1ap/S1AP_OverloadStop.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PDCP-SN.c b/lib/asn1c/s1ap/S1AP_PDCP-SN.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PDCP-SN.c rename to lib/asn1c/s1ap/S1AP_PDCP-SN.c index a47394d8d..15b8f13f0 100644 --- a/lib/s1ap/asn1c/S1AP_PDCP-SN.c +++ b/lib/asn1c/s1ap/S1AP_PDCP-SN.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PDCP-SN.h b/lib/asn1c/s1ap/S1AP_PDCP-SN.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PDCP-SN.h rename to lib/asn1c/s1ap/S1AP_PDCP-SN.h index 4adbf01ad..ac792e9da 100644 --- a/lib/s1ap/asn1c/S1AP_PDCP-SN.h +++ b/lib/asn1c/s1ap/S1AP_PDCP-SN.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PDCP-SNExtended.c b/lib/asn1c/s1ap/S1AP_PDCP-SNExtended.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PDCP-SNExtended.c rename to lib/asn1c/s1ap/S1AP_PDCP-SNExtended.c index 944422ee4..0d2b8e4f7 100644 --- a/lib/s1ap/asn1c/S1AP_PDCP-SNExtended.c +++ b/lib/asn1c/s1ap/S1AP_PDCP-SNExtended.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PDCP-SNExtended.h b/lib/asn1c/s1ap/S1AP_PDCP-SNExtended.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PDCP-SNExtended.h rename to lib/asn1c/s1ap/S1AP_PDCP-SNExtended.h index 99319c383..e198d91e4 100644 --- a/lib/s1ap/asn1c/S1AP_PDCP-SNExtended.h +++ b/lib/asn1c/s1ap/S1AP_PDCP-SNExtended.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PDCP-SNlength18.c b/lib/asn1c/s1ap/S1AP_PDCP-SNlength18.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PDCP-SNlength18.c rename to lib/asn1c/s1ap/S1AP_PDCP-SNlength18.c index 98db94af3..a7c4ffd6a 100644 --- a/lib/s1ap/asn1c/S1AP_PDCP-SNlength18.c +++ b/lib/asn1c/s1ap/S1AP_PDCP-SNlength18.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PDCP-SNlength18.h b/lib/asn1c/s1ap/S1AP_PDCP-SNlength18.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PDCP-SNlength18.h rename to lib/asn1c/s1ap/S1AP_PDCP-SNlength18.h index 78314ed7b..a3772623e 100644 --- a/lib/s1ap/asn1c/S1AP_PDCP-SNlength18.h +++ b/lib/asn1c/s1ap/S1AP_PDCP-SNlength18.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PLMNidentity.c b/lib/asn1c/s1ap/S1AP_PLMNidentity.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PLMNidentity.c rename to lib/asn1c/s1ap/S1AP_PLMNidentity.c index e47913fdb..916c8ec34 100644 --- a/lib/s1ap/asn1c/S1AP_PLMNidentity.c +++ b/lib/asn1c/s1ap/S1AP_PLMNidentity.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PLMNidentity.h b/lib/asn1c/s1ap/S1AP_PLMNidentity.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PLMNidentity.h rename to lib/asn1c/s1ap/S1AP_PLMNidentity.h index c6f672b44..ce2182559 100644 --- a/lib/s1ap/asn1c/S1AP_PLMNidentity.h +++ b/lib/asn1c/s1ap/S1AP_PLMNidentity.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PS-ServiceNotAvailable.c b/lib/asn1c/s1ap/S1AP_PS-ServiceNotAvailable.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PS-ServiceNotAvailable.c rename to lib/asn1c/s1ap/S1AP_PS-ServiceNotAvailable.c index 8ecbc0185..de174451a 100644 --- a/lib/s1ap/asn1c/S1AP_PS-ServiceNotAvailable.c +++ b/lib/asn1c/s1ap/S1AP_PS-ServiceNotAvailable.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PS-ServiceNotAvailable.h b/lib/asn1c/s1ap/S1AP_PS-ServiceNotAvailable.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PS-ServiceNotAvailable.h rename to lib/asn1c/s1ap/S1AP_PS-ServiceNotAvailable.h index 5439e91ed..3f02526fa 100644 --- a/lib/s1ap/asn1c/S1AP_PS-ServiceNotAvailable.h +++ b/lib/asn1c/s1ap/S1AP_PS-ServiceNotAvailable.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PWSFailureIndication.c b/lib/asn1c/s1ap/S1AP_PWSFailureIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PWSFailureIndication.c rename to lib/asn1c/s1ap/S1AP_PWSFailureIndication.c index 799f8833f..34f17e386 100644 --- a/lib/s1ap/asn1c/S1AP_PWSFailureIndication.c +++ b/lib/asn1c/s1ap/S1AP_PWSFailureIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PWSFailureIndication.h b/lib/asn1c/s1ap/S1AP_PWSFailureIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PWSFailureIndication.h rename to lib/asn1c/s1ap/S1AP_PWSFailureIndication.h index 171645a97..dca39d71b 100644 --- a/lib/s1ap/asn1c/S1AP_PWSFailureIndication.h +++ b/lib/asn1c/s1ap/S1AP_PWSFailureIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PWSRestartIndication.c b/lib/asn1c/s1ap/S1AP_PWSRestartIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PWSRestartIndication.c rename to lib/asn1c/s1ap/S1AP_PWSRestartIndication.c index 8a309cc76..893270e3f 100644 --- a/lib/s1ap/asn1c/S1AP_PWSRestartIndication.c +++ b/lib/asn1c/s1ap/S1AP_PWSRestartIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PWSRestartIndication.h b/lib/asn1c/s1ap/S1AP_PWSRestartIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PWSRestartIndication.h rename to lib/asn1c/s1ap/S1AP_PWSRestartIndication.h index 568df65ad..d18f0e17b 100644 --- a/lib/s1ap/asn1c/S1AP_PWSRestartIndication.h +++ b/lib/asn1c/s1ap/S1AP_PWSRestartIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PWSfailedECGIList.c b/lib/asn1c/s1ap/S1AP_PWSfailedECGIList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PWSfailedECGIList.c rename to lib/asn1c/s1ap/S1AP_PWSfailedECGIList.c index 5c5f4fe40..2fdd892bb 100644 --- a/lib/s1ap/asn1c/S1AP_PWSfailedECGIList.c +++ b/lib/asn1c/s1ap/S1AP_PWSfailedECGIList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PWSfailedECGIList.h b/lib/asn1c/s1ap/S1AP_PWSfailedECGIList.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_PWSfailedECGIList.h rename to lib/asn1c/s1ap/S1AP_PWSfailedECGIList.h index fc801ad39..09602f462 100644 --- a/lib/s1ap/asn1c/S1AP_PWSfailedECGIList.h +++ b/lib/asn1c/s1ap/S1AP_PWSfailedECGIList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Paging-eDRX-Cycle.c b/lib/asn1c/s1ap/S1AP_Paging-eDRX-Cycle.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Paging-eDRX-Cycle.c rename to lib/asn1c/s1ap/S1AP_Paging-eDRX-Cycle.c index b46dc1764..f607787a0 100644 --- a/lib/s1ap/asn1c/S1AP_Paging-eDRX-Cycle.c +++ b/lib/asn1c/s1ap/S1AP_Paging-eDRX-Cycle.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Paging-eDRX-Cycle.h b/lib/asn1c/s1ap/S1AP_Paging-eDRX-Cycle.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_Paging-eDRX-Cycle.h rename to lib/asn1c/s1ap/S1AP_Paging-eDRX-Cycle.h index 12b605ce1..5dbda8b3a 100644 --- a/lib/s1ap/asn1c/S1AP_Paging-eDRX-Cycle.h +++ b/lib/asn1c/s1ap/S1AP_Paging-eDRX-Cycle.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Paging-eDRXInformation.c b/lib/asn1c/s1ap/S1AP_Paging-eDRXInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_Paging-eDRXInformation.c rename to lib/asn1c/s1ap/S1AP_Paging-eDRXInformation.c index c98ca354b..16234218c 100644 --- a/lib/s1ap/asn1c/S1AP_Paging-eDRXInformation.c +++ b/lib/asn1c/s1ap/S1AP_Paging-eDRXInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Paging-eDRXInformation.h b/lib/asn1c/s1ap/S1AP_Paging-eDRXInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Paging-eDRXInformation.h rename to lib/asn1c/s1ap/S1AP_Paging-eDRXInformation.h index 6df33bd21..bc98a9fe0 100644 --- a/lib/s1ap/asn1c/S1AP_Paging-eDRXInformation.h +++ b/lib/asn1c/s1ap/S1AP_Paging-eDRXInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Paging.c b/lib/asn1c/s1ap/S1AP_Paging.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_Paging.c rename to lib/asn1c/s1ap/S1AP_Paging.c index e4d3098bb..93447e65a 100644 --- a/lib/s1ap/asn1c/S1AP_Paging.c +++ b/lib/asn1c/s1ap/S1AP_Paging.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Paging.h b/lib/asn1c/s1ap/S1AP_Paging.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_Paging.h rename to lib/asn1c/s1ap/S1AP_Paging.h index 38d515871..a69acc6c8 100644 --- a/lib/s1ap/asn1c/S1AP_Paging.h +++ b/lib/asn1c/s1ap/S1AP_Paging.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingAttemptCount.c b/lib/asn1c/s1ap/S1AP_PagingAttemptCount.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PagingAttemptCount.c rename to lib/asn1c/s1ap/S1AP_PagingAttemptCount.c index bf17b6e7a..c95fbce8f 100644 --- a/lib/s1ap/asn1c/S1AP_PagingAttemptCount.c +++ b/lib/asn1c/s1ap/S1AP_PagingAttemptCount.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingAttemptCount.h b/lib/asn1c/s1ap/S1AP_PagingAttemptCount.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PagingAttemptCount.h rename to lib/asn1c/s1ap/S1AP_PagingAttemptCount.h index 89a9e830e..516ba66ad 100644 --- a/lib/s1ap/asn1c/S1AP_PagingAttemptCount.h +++ b/lib/asn1c/s1ap/S1AP_PagingAttemptCount.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingAttemptInformation.c b/lib/asn1c/s1ap/S1AP_PagingAttemptInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_PagingAttemptInformation.c rename to lib/asn1c/s1ap/S1AP_PagingAttemptInformation.c index 5307ef0f4..c5fa2b211 100644 --- a/lib/s1ap/asn1c/S1AP_PagingAttemptInformation.c +++ b/lib/asn1c/s1ap/S1AP_PagingAttemptInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingAttemptInformation.h b/lib/asn1c/s1ap/S1AP_PagingAttemptInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PagingAttemptInformation.h rename to lib/asn1c/s1ap/S1AP_PagingAttemptInformation.h index 50e15456b..0727a9913 100644 --- a/lib/s1ap/asn1c/S1AP_PagingAttemptInformation.h +++ b/lib/asn1c/s1ap/S1AP_PagingAttemptInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingDRX.c b/lib/asn1c/s1ap/S1AP_PagingDRX.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PagingDRX.c rename to lib/asn1c/s1ap/S1AP_PagingDRX.c index 0821d5261..4d5129260 100644 --- a/lib/s1ap/asn1c/S1AP_PagingDRX.c +++ b/lib/asn1c/s1ap/S1AP_PagingDRX.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingDRX.h b/lib/asn1c/s1ap/S1AP_PagingDRX.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PagingDRX.h rename to lib/asn1c/s1ap/S1AP_PagingDRX.h index b61554774..0acbcd67b 100644 --- a/lib/s1ap/asn1c/S1AP_PagingDRX.h +++ b/lib/asn1c/s1ap/S1AP_PagingDRX.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingPriority.c b/lib/asn1c/s1ap/S1AP_PagingPriority.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PagingPriority.c rename to lib/asn1c/s1ap/S1AP_PagingPriority.c index c340a29b0..cb82fbbda 100644 --- a/lib/s1ap/asn1c/S1AP_PagingPriority.c +++ b/lib/asn1c/s1ap/S1AP_PagingPriority.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingPriority.h b/lib/asn1c/s1ap/S1AP_PagingPriority.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PagingPriority.h rename to lib/asn1c/s1ap/S1AP_PagingPriority.h index 2e8132bd7..1aa9c79af 100644 --- a/lib/s1ap/asn1c/S1AP_PagingPriority.h +++ b/lib/asn1c/s1ap/S1AP_PagingPriority.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingTimeWindow.c b/lib/asn1c/s1ap/S1AP_PagingTimeWindow.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PagingTimeWindow.c rename to lib/asn1c/s1ap/S1AP_PagingTimeWindow.c index 3820cd937..12f8d1cc8 100644 --- a/lib/s1ap/asn1c/S1AP_PagingTimeWindow.c +++ b/lib/asn1c/s1ap/S1AP_PagingTimeWindow.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PagingTimeWindow.h b/lib/asn1c/s1ap/S1AP_PagingTimeWindow.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_PagingTimeWindow.h rename to lib/asn1c/s1ap/S1AP_PagingTimeWindow.h index ee8e27706..5e4d26e25 100644 --- a/lib/s1ap/asn1c/S1AP_PagingTimeWindow.h +++ b/lib/asn1c/s1ap/S1AP_PagingTimeWindow.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PathSwitchRequest.c b/lib/asn1c/s1ap/S1AP_PathSwitchRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PathSwitchRequest.c rename to lib/asn1c/s1ap/S1AP_PathSwitchRequest.c index 07af5fcc8..0a17f038e 100644 --- a/lib/s1ap/asn1c/S1AP_PathSwitchRequest.c +++ b/lib/asn1c/s1ap/S1AP_PathSwitchRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PathSwitchRequest.h b/lib/asn1c/s1ap/S1AP_PathSwitchRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PathSwitchRequest.h rename to lib/asn1c/s1ap/S1AP_PathSwitchRequest.h index 9349c5e6a..dd340c79f 100644 --- a/lib/s1ap/asn1c/S1AP_PathSwitchRequest.h +++ b/lib/asn1c/s1ap/S1AP_PathSwitchRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PathSwitchRequestAcknowledge.c b/lib/asn1c/s1ap/S1AP_PathSwitchRequestAcknowledge.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PathSwitchRequestAcknowledge.c rename to lib/asn1c/s1ap/S1AP_PathSwitchRequestAcknowledge.c index 025f41ec7..e28cdcfb0 100644 --- a/lib/s1ap/asn1c/S1AP_PathSwitchRequestAcknowledge.c +++ b/lib/asn1c/s1ap/S1AP_PathSwitchRequestAcknowledge.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PathSwitchRequestAcknowledge.h b/lib/asn1c/s1ap/S1AP_PathSwitchRequestAcknowledge.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PathSwitchRequestAcknowledge.h rename to lib/asn1c/s1ap/S1AP_PathSwitchRequestAcknowledge.h index 0d094a62d..f97a34713 100644 --- a/lib/s1ap/asn1c/S1AP_PathSwitchRequestAcknowledge.h +++ b/lib/asn1c/s1ap/S1AP_PathSwitchRequestAcknowledge.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PathSwitchRequestFailure.c b/lib/asn1c/s1ap/S1AP_PathSwitchRequestFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PathSwitchRequestFailure.c rename to lib/asn1c/s1ap/S1AP_PathSwitchRequestFailure.c index e6c98827d..edacdc5e8 100644 --- a/lib/s1ap/asn1c/S1AP_PathSwitchRequestFailure.c +++ b/lib/asn1c/s1ap/S1AP_PathSwitchRequestFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PathSwitchRequestFailure.h b/lib/asn1c/s1ap/S1AP_PathSwitchRequestFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PathSwitchRequestFailure.h rename to lib/asn1c/s1ap/S1AP_PathSwitchRequestFailure.h index bdb1bddaf..19a0ad64a 100644 --- a/lib/s1ap/asn1c/S1AP_PathSwitchRequestFailure.h +++ b/lib/asn1c/s1ap/S1AP_PathSwitchRequestFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PedestrianUE.c b/lib/asn1c/s1ap/S1AP_PedestrianUE.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PedestrianUE.c rename to lib/asn1c/s1ap/S1AP_PedestrianUE.c index 15c90de90..eb4bdc657 100644 --- a/lib/s1ap/asn1c/S1AP_PedestrianUE.c +++ b/lib/asn1c/s1ap/S1AP_PedestrianUE.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PedestrianUE.h b/lib/asn1c/s1ap/S1AP_PedestrianUE.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PedestrianUE.h rename to lib/asn1c/s1ap/S1AP_PedestrianUE.h index 389d048e1..c6520d495 100644 --- a/lib/s1ap/asn1c/S1AP_PedestrianUE.h +++ b/lib/asn1c/s1ap/S1AP_PedestrianUE.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Port-Number.c b/lib/asn1c/s1ap/S1AP_Port-Number.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Port-Number.c rename to lib/asn1c/s1ap/S1AP_Port-Number.c index 9a1d97b71..df2da7c5d 100644 --- a/lib/s1ap/asn1c/S1AP_Port-Number.c +++ b/lib/asn1c/s1ap/S1AP_Port-Number.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Port-Number.h b/lib/asn1c/s1ap/S1AP_Port-Number.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Port-Number.h rename to lib/asn1c/s1ap/S1AP_Port-Number.h index d69d11b61..a961483fe 100644 --- a/lib/s1ap/asn1c/S1AP_Port-Number.h +++ b/lib/asn1c/s1ap/S1AP_Port-Number.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Pre-emptionCapability.c b/lib/asn1c/s1ap/S1AP_Pre-emptionCapability.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Pre-emptionCapability.c rename to lib/asn1c/s1ap/S1AP_Pre-emptionCapability.c index 0589813cc..cff4454b5 100644 --- a/lib/s1ap/asn1c/S1AP_Pre-emptionCapability.c +++ b/lib/asn1c/s1ap/S1AP_Pre-emptionCapability.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Pre-emptionCapability.h b/lib/asn1c/s1ap/S1AP_Pre-emptionCapability.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Pre-emptionCapability.h rename to lib/asn1c/s1ap/S1AP_Pre-emptionCapability.h index 2b67f7733..1399d8dc5 100644 --- a/lib/s1ap/asn1c/S1AP_Pre-emptionCapability.h +++ b/lib/asn1c/s1ap/S1AP_Pre-emptionCapability.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Pre-emptionVulnerability.c b/lib/asn1c/s1ap/S1AP_Pre-emptionVulnerability.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Pre-emptionVulnerability.c rename to lib/asn1c/s1ap/S1AP_Pre-emptionVulnerability.c index a60844d59..4e3cf4691 100644 --- a/lib/s1ap/asn1c/S1AP_Pre-emptionVulnerability.c +++ b/lib/asn1c/s1ap/S1AP_Pre-emptionVulnerability.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Pre-emptionVulnerability.h b/lib/asn1c/s1ap/S1AP_Pre-emptionVulnerability.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_Pre-emptionVulnerability.h rename to lib/asn1c/s1ap/S1AP_Pre-emptionVulnerability.h index 43e41a3fc..564439fea 100644 --- a/lib/s1ap/asn1c/S1AP_Pre-emptionVulnerability.h +++ b/lib/asn1c/s1ap/S1AP_Pre-emptionVulnerability.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Presence.c b/lib/asn1c/s1ap/S1AP_Presence.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Presence.c rename to lib/asn1c/s1ap/S1AP_Presence.c index 4a9caee0f..13040b4ab 100644 --- a/lib/s1ap/asn1c/S1AP_Presence.c +++ b/lib/asn1c/s1ap/S1AP_Presence.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Presence.h b/lib/asn1c/s1ap/S1AP_Presence.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Presence.h rename to lib/asn1c/s1ap/S1AP_Presence.h index 5a638e23a..d611ad741 100644 --- a/lib/s1ap/asn1c/S1AP_Presence.h +++ b/lib/asn1c/s1ap/S1AP_Presence.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PriorityLevel.c b/lib/asn1c/s1ap/S1AP_PriorityLevel.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PriorityLevel.c rename to lib/asn1c/s1ap/S1AP_PriorityLevel.c index 078f69010..2a9c299e5 100644 --- a/lib/s1ap/asn1c/S1AP_PriorityLevel.c +++ b/lib/asn1c/s1ap/S1AP_PriorityLevel.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PriorityLevel.h b/lib/asn1c/s1ap/S1AP_PriorityLevel.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PriorityLevel.h rename to lib/asn1c/s1ap/S1AP_PriorityLevel.h index 8933d2b7b..f36805c35 100644 --- a/lib/s1ap/asn1c/S1AP_PriorityLevel.h +++ b/lib/asn1c/s1ap/S1AP_PriorityLevel.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivacyIndicator.c b/lib/asn1c/s1ap/S1AP_PrivacyIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PrivacyIndicator.c rename to lib/asn1c/s1ap/S1AP_PrivacyIndicator.c index 5ea4f14d1..479ea702e 100644 --- a/lib/s1ap/asn1c/S1AP_PrivacyIndicator.c +++ b/lib/asn1c/s1ap/S1AP_PrivacyIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivacyIndicator.h b/lib/asn1c/s1ap/S1AP_PrivacyIndicator.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PrivacyIndicator.h rename to lib/asn1c/s1ap/S1AP_PrivacyIndicator.h index 96cab5afd..954b060f0 100644 --- a/lib/s1ap/asn1c/S1AP_PrivacyIndicator.h +++ b/lib/asn1c/s1ap/S1AP_PrivacyIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateIE-Container.c b/lib/asn1c/s1ap/S1AP_PrivateIE-Container.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_PrivateIE-Container.c rename to lib/asn1c/s1ap/S1AP_PrivateIE-Container.c index 8b2889e55..174804369 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateIE-Container.c +++ b/lib/asn1c/s1ap/S1AP_PrivateIE-Container.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateIE-Container.h b/lib/asn1c/s1ap/S1AP_PrivateIE-Container.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PrivateIE-Container.h rename to lib/asn1c/s1ap/S1AP_PrivateIE-Container.h index 173ecfdfd..021dfef24 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateIE-Container.h +++ b/lib/asn1c/s1ap/S1AP_PrivateIE-Container.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateIE-Field.c b/lib/asn1c/s1ap/S1AP_PrivateIE-Field.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_PrivateIE-Field.c rename to lib/asn1c/s1ap/S1AP_PrivateIE-Field.c index f76cc3373..8abf01003 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateIE-Field.c +++ b/lib/asn1c/s1ap/S1AP_PrivateIE-Field.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateIE-Field.h b/lib/asn1c/s1ap/S1AP_PrivateIE-Field.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PrivateIE-Field.h rename to lib/asn1c/s1ap/S1AP_PrivateIE-Field.h index ce16d1cc9..4dea4c143 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateIE-Field.h +++ b/lib/asn1c/s1ap/S1AP_PrivateIE-Field.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateIE-ID.c b/lib/asn1c/s1ap/S1AP_PrivateIE-ID.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_PrivateIE-ID.c rename to lib/asn1c/s1ap/S1AP_PrivateIE-ID.c index 26cbf5d22..04352fa6e 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateIE-ID.c +++ b/lib/asn1c/s1ap/S1AP_PrivateIE-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateIE-ID.h b/lib/asn1c/s1ap/S1AP_PrivateIE-ID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_PrivateIE-ID.h rename to lib/asn1c/s1ap/S1AP_PrivateIE-ID.h index 6edabc06e..02beeb061 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateIE-ID.h +++ b/lib/asn1c/s1ap/S1AP_PrivateIE-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateMessage.c b/lib/asn1c/s1ap/S1AP_PrivateMessage.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_PrivateMessage.c rename to lib/asn1c/s1ap/S1AP_PrivateMessage.c index a5a92281a..1b05ce937 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateMessage.c +++ b/lib/asn1c/s1ap/S1AP_PrivateMessage.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_PrivateMessage.h b/lib/asn1c/s1ap/S1AP_PrivateMessage.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_PrivateMessage.h rename to lib/asn1c/s1ap/S1AP_PrivateMessage.h index 77c4454ed..cb170f676 100644 --- a/lib/s1ap/asn1c/S1AP_PrivateMessage.h +++ b/lib/asn1c/s1ap/S1AP_PrivateMessage.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeAuthorized.c b/lib/asn1c/s1ap/S1AP_ProSeAuthorized.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ProSeAuthorized.c rename to lib/asn1c/s1ap/S1AP_ProSeAuthorized.c index 782d0876f..2b5c9c04b 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeAuthorized.c +++ b/lib/asn1c/s1ap/S1AP_ProSeAuthorized.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeAuthorized.h b/lib/asn1c/s1ap/S1AP_ProSeAuthorized.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ProSeAuthorized.h rename to lib/asn1c/s1ap/S1AP_ProSeAuthorized.h index afe2b034f..8b2b039d9 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeAuthorized.h +++ b/lib/asn1c/s1ap/S1AP_ProSeAuthorized.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeDirectCommunication.c b/lib/asn1c/s1ap/S1AP_ProSeDirectCommunication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProSeDirectCommunication.c rename to lib/asn1c/s1ap/S1AP_ProSeDirectCommunication.c index 9b05bc051..9b069c70a 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeDirectCommunication.c +++ b/lib/asn1c/s1ap/S1AP_ProSeDirectCommunication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeDirectCommunication.h b/lib/asn1c/s1ap/S1AP_ProSeDirectCommunication.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProSeDirectCommunication.h rename to lib/asn1c/s1ap/S1AP_ProSeDirectCommunication.h index f00d6d79d..0b4deda4a 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeDirectCommunication.h +++ b/lib/asn1c/s1ap/S1AP_ProSeDirectCommunication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeDirectDiscovery.c b/lib/asn1c/s1ap/S1AP_ProSeDirectDiscovery.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProSeDirectDiscovery.c rename to lib/asn1c/s1ap/S1AP_ProSeDirectDiscovery.c index 3670e89f6..8074d5337 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeDirectDiscovery.c +++ b/lib/asn1c/s1ap/S1AP_ProSeDirectDiscovery.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeDirectDiscovery.h b/lib/asn1c/s1ap/S1AP_ProSeDirectDiscovery.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ProSeDirectDiscovery.h rename to lib/asn1c/s1ap/S1AP_ProSeDirectDiscovery.h index 5248a4765..8506de5bd 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeDirectDiscovery.h +++ b/lib/asn1c/s1ap/S1AP_ProSeDirectDiscovery.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeUEtoNetworkRelaying.c b/lib/asn1c/s1ap/S1AP_ProSeUEtoNetworkRelaying.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProSeUEtoNetworkRelaying.c rename to lib/asn1c/s1ap/S1AP_ProSeUEtoNetworkRelaying.c index 144444fd0..08e154218 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeUEtoNetworkRelaying.c +++ b/lib/asn1c/s1ap/S1AP_ProSeUEtoNetworkRelaying.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProSeUEtoNetworkRelaying.h b/lib/asn1c/s1ap/S1AP_ProSeUEtoNetworkRelaying.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ProSeUEtoNetworkRelaying.h rename to lib/asn1c/s1ap/S1AP_ProSeUEtoNetworkRelaying.h index 788538921..a52e7f2b0 100644 --- a/lib/s1ap/asn1c/S1AP_ProSeUEtoNetworkRelaying.h +++ b/lib/asn1c/s1ap/S1AP_ProSeUEtoNetworkRelaying.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProcedureCode.c b/lib/asn1c/s1ap/S1AP_ProcedureCode.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProcedureCode.c rename to lib/asn1c/s1ap/S1AP_ProcedureCode.c index 2c86427fb..2d84f83bb 100644 --- a/lib/s1ap/asn1c/S1AP_ProcedureCode.c +++ b/lib/asn1c/s1ap/S1AP_ProcedureCode.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProcedureCode.h b/lib/asn1c/s1ap/S1AP_ProcedureCode.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProcedureCode.h rename to lib/asn1c/s1ap/S1AP_ProcedureCode.h index 44f0f7511..e9e8cbdb9 100644 --- a/lib/s1ap/asn1c/S1AP_ProcedureCode.h +++ b/lib/asn1c/s1ap/S1AP_ProcedureCode.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolError-IE-ContainerList.h b/lib/asn1c/s1ap/S1AP_ProtocolError-IE-ContainerList.h similarity index 89% rename from lib/s1ap/asn1c/S1AP_ProtocolError-IE-ContainerList.h rename to lib/asn1c/s1ap/S1AP_ProtocolError-IE-ContainerList.h index 14fbd3b03..b87e40360 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolError-IE-ContainerList.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolError-IE-ContainerList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolExtensionContainer.c b/lib/asn1c/s1ap/S1AP_ProtocolExtensionContainer.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolExtensionContainer.c rename to lib/asn1c/s1ap/S1AP_ProtocolExtensionContainer.c index c2e1520a7..8a9bfb43b 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolExtensionContainer.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolExtensionContainer.h b/lib/asn1c/s1ap/S1AP_ProtocolExtensionContainer.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolExtensionContainer.h rename to lib/asn1c/s1ap/S1AP_ProtocolExtensionContainer.h index 8c1858e8b..eda9f4601 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolExtensionContainer.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolExtensionField.c b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolExtensionField.c rename to lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c index 5183ec007..2408d5821 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolExtensionField.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolExtensionField.h b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolExtensionField.h rename to lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h index 2b21cda5d..77db8f712 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolExtensionField.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolExtensionID.c b/lib/asn1c/s1ap/S1AP_ProtocolExtensionID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProtocolExtensionID.c rename to lib/asn1c/s1ap/S1AP_ProtocolExtensionID.c index 3206b2d39..8c8fb5f2d 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolExtensionID.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolExtensionID.h b/lib/asn1c/s1ap/S1AP_ProtocolExtensionID.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ProtocolExtensionID.h rename to lib/asn1c/s1ap/S1AP_ProtocolExtensionID.h index 8e409aeb1..20ca01e15 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolExtensionID.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-Container.c b/lib/asn1c/s1ap/S1AP_ProtocolIE-Container.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-Container.c rename to lib/asn1c/s1ap/S1AP_ProtocolIE-Container.c index db9d05c3e..f3f9fd90a 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-Container.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-Container.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-Container.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-Container.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-Container.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-Container.h index cbc9e1f5b..bb65a2069 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-Container.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-Container.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerList.c b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerList.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerList.c rename to lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerList.c index e596bdf8f..5fbfccc40 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerList.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerList.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerList.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerList.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerList.h index 43a591b3c..78cfe8c09 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerList.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerPair.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerPair.h similarity index 89% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerPair.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerPair.h index fdbdc33f7..a723398ab 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerPair.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerPair.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerPairList.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerPairList.h similarity index 89% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerPairList.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerPairList.h index 2ecc93254..5ab35304b 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-ContainerPairList.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-ContainerPairList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-Field.c b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-Field.c rename to lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c index f65c4bba8..ff62fdd40 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-Field.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-Field.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-Field.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h index 8969d49ee..d99c89fef 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-Field.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-FieldPair.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-FieldPair.h similarity index 88% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-FieldPair.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-FieldPair.h index 0b4967c95..b20ebd431 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-FieldPair.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-FieldPair.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-ID.c b/lib/asn1c/s1ap/S1AP_ProtocolIE-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-ID.c rename to lib/asn1c/s1ap/S1AP_ProtocolIE-ID.c index 2e048000a..5f9fc017b 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-ID.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-ID.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-ID.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-ID.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-ID.h index 25b4aa300..b9ab5d4dc 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-ID.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-SingleContainer.c b/lib/asn1c/s1ap/S1AP_ProtocolIE-SingleContainer.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-SingleContainer.c rename to lib/asn1c/s1ap/S1AP_ProtocolIE-SingleContainer.c index 77ba42163..bc1ba659d 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-SingleContainer.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-SingleContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ProtocolIE-SingleContainer.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-SingleContainer.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_ProtocolIE-SingleContainer.h rename to lib/asn1c/s1ap/S1AP_ProtocolIE-SingleContainer.h index e983f2333..201cfa559 100644 --- a/lib/s1ap/asn1c/S1AP_ProtocolIE-SingleContainer.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-SingleContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-Containers" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_QCI.c b/lib/asn1c/s1ap/S1AP_QCI.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_QCI.c rename to lib/asn1c/s1ap/S1AP_QCI.c index cfab211ce..3803f333a 100644 --- a/lib/s1ap/asn1c/S1AP_QCI.c +++ b/lib/asn1c/s1ap/S1AP_QCI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_QCI.h b/lib/asn1c/s1ap/S1AP_QCI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_QCI.h rename to lib/asn1c/s1ap/S1AP_QCI.h index eb503eb0c..5b35ce0d8 100644 --- a/lib/s1ap/asn1c/S1AP_QCI.h +++ b/lib/asn1c/s1ap/S1AP_QCI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RAC.c b/lib/asn1c/s1ap/S1AP_RAC.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RAC.c rename to lib/asn1c/s1ap/S1AP_RAC.c index 3830bded5..745174656 100644 --- a/lib/s1ap/asn1c/S1AP_RAC.c +++ b/lib/asn1c/s1ap/S1AP_RAC.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RAC.h b/lib/asn1c/s1ap/S1AP_RAC.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RAC.h rename to lib/asn1c/s1ap/S1AP_RAC.h index 82672a8a4..5e3accc08 100644 --- a/lib/s1ap/asn1c/S1AP_RAC.h +++ b/lib/asn1c/s1ap/S1AP_RAC.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RAT-Type.c b/lib/asn1c/s1ap/S1AP_RAT-Type.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RAT-Type.c rename to lib/asn1c/s1ap/S1AP_RAT-Type.c index c079eb5b5..72772a710 100644 --- a/lib/s1ap/asn1c/S1AP_RAT-Type.c +++ b/lib/asn1c/s1ap/S1AP_RAT-Type.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RAT-Type.h b/lib/asn1c/s1ap/S1AP_RAT-Type.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RAT-Type.h rename to lib/asn1c/s1ap/S1AP_RAT-Type.h index fb5875a1e..76b8dc631 100644 --- a/lib/s1ap/asn1c/S1AP_RAT-Type.h +++ b/lib/asn1c/s1ap/S1AP_RAT-Type.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RIMInformation.c b/lib/asn1c/s1ap/S1AP_RIMInformation.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_RIMInformation.c rename to lib/asn1c/s1ap/S1AP_RIMInformation.c index 6b1cd9c47..4c99e9ec7 100644 --- a/lib/s1ap/asn1c/S1AP_RIMInformation.c +++ b/lib/asn1c/s1ap/S1AP_RIMInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RIMInformation.h b/lib/asn1c/s1ap/S1AP_RIMInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RIMInformation.h rename to lib/asn1c/s1ap/S1AP_RIMInformation.h index 040f0710f..38695eea4 100644 --- a/lib/s1ap/asn1c/S1AP_RIMInformation.h +++ b/lib/asn1c/s1ap/S1AP_RIMInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RIMRoutingAddress.c b/lib/asn1c/s1ap/S1AP_RIMRoutingAddress.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_RIMRoutingAddress.c rename to lib/asn1c/s1ap/S1AP_RIMRoutingAddress.c index 4f5025148..bbe917879 100644 --- a/lib/s1ap/asn1c/S1AP_RIMRoutingAddress.c +++ b/lib/asn1c/s1ap/S1AP_RIMRoutingAddress.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RIMRoutingAddress.h b/lib/asn1c/s1ap/S1AP_RIMRoutingAddress.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RIMRoutingAddress.h rename to lib/asn1c/s1ap/S1AP_RIMRoutingAddress.h index 33837f03d..9f0ad27b8 100644 --- a/lib/s1ap/asn1c/S1AP_RIMRoutingAddress.h +++ b/lib/asn1c/s1ap/S1AP_RIMRoutingAddress.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RIMTransfer.c b/lib/asn1c/s1ap/S1AP_RIMTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RIMTransfer.c rename to lib/asn1c/s1ap/S1AP_RIMTransfer.c index 9bb6216c2..7e0b4fbda 100644 --- a/lib/s1ap/asn1c/S1AP_RIMTransfer.c +++ b/lib/asn1c/s1ap/S1AP_RIMTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RIMTransfer.h b/lib/asn1c/s1ap/S1AP_RIMTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RIMTransfer.h rename to lib/asn1c/s1ap/S1AP_RIMTransfer.h index 5b0c5ec98..6078a42be 100644 --- a/lib/s1ap/asn1c/S1AP_RIMTransfer.h +++ b/lib/asn1c/s1ap/S1AP_RIMTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RLFReportInformation.c b/lib/asn1c/s1ap/S1AP_RLFReportInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_RLFReportInformation.c rename to lib/asn1c/s1ap/S1AP_RLFReportInformation.c index 7a58740e3..d139e5da8 100644 --- a/lib/s1ap/asn1c/S1AP_RLFReportInformation.c +++ b/lib/asn1c/s1ap/S1AP_RLFReportInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RLFReportInformation.h b/lib/asn1c/s1ap/S1AP_RLFReportInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RLFReportInformation.h rename to lib/asn1c/s1ap/S1AP_RLFReportInformation.h index e70deacc5..d91a96590 100644 --- a/lib/s1ap/asn1c/S1AP_RLFReportInformation.h +++ b/lib/asn1c/s1ap/S1AP_RLFReportInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RNC-ID.c b/lib/asn1c/s1ap/S1AP_RNC-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RNC-ID.c rename to lib/asn1c/s1ap/S1AP_RNC-ID.c index cdf9e1ec1..b1264c8f9 100644 --- a/lib/s1ap/asn1c/S1AP_RNC-ID.c +++ b/lib/asn1c/s1ap/S1AP_RNC-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RNC-ID.h b/lib/asn1c/s1ap/S1AP_RNC-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RNC-ID.h rename to lib/asn1c/s1ap/S1AP_RNC-ID.h index b0121a7e5..f32fe4b91 100644 --- a/lib/s1ap/asn1c/S1AP_RNC-ID.h +++ b/lib/asn1c/s1ap/S1AP_RNC-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RRC-Container.c b/lib/asn1c/s1ap/S1AP_RRC-Container.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_RRC-Container.c rename to lib/asn1c/s1ap/S1AP_RRC-Container.c index c051f57b2..d636594d9 100644 --- a/lib/s1ap/asn1c/S1AP_RRC-Container.c +++ b/lib/asn1c/s1ap/S1AP_RRC-Container.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RRC-Container.h b/lib/asn1c/s1ap/S1AP_RRC-Container.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RRC-Container.h rename to lib/asn1c/s1ap/S1AP_RRC-Container.h index 552f57155..364bbc482 100644 --- a/lib/s1ap/asn1c/S1AP_RRC-Container.h +++ b/lib/asn1c/s1ap/S1AP_RRC-Container.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RRC-Establishment-Cause.c b/lib/asn1c/s1ap/S1AP_RRC-Establishment-Cause.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_RRC-Establishment-Cause.c rename to lib/asn1c/s1ap/S1AP_RRC-Establishment-Cause.c index 5db0146fe..b5640671e 100644 --- a/lib/s1ap/asn1c/S1AP_RRC-Establishment-Cause.c +++ b/lib/asn1c/s1ap/S1AP_RRC-Establishment-Cause.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RRC-Establishment-Cause.h b/lib/asn1c/s1ap/S1AP_RRC-Establishment-Cause.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_RRC-Establishment-Cause.h rename to lib/asn1c/s1ap/S1AP_RRC-Establishment-Cause.h index eadfd8571..b2e4cb3e3 100644 --- a/lib/s1ap/asn1c/S1AP_RRC-Establishment-Cause.h +++ b/lib/asn1c/s1ap/S1AP_RRC-Establishment-Cause.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c rename to lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c index 8e291df39..653ec5927 100644 --- a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c +++ b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h rename to lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h index 46cab775d..7684ffd30 100644 --- a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h +++ b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsExtended.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c rename to lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c index d3721a556..5a5749b90 100644 --- a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c +++ b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h rename to lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h index c1a4943ca..ed9d5944d 100644 --- a/lib/s1ap/asn1c/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h +++ b/lib/asn1c/s1ap/S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReceiveStatusofULPDCPSDUs.c b/lib/asn1c/s1ap/S1AP_ReceiveStatusofULPDCPSDUs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReceiveStatusofULPDCPSDUs.c rename to lib/asn1c/s1ap/S1AP_ReceiveStatusofULPDCPSDUs.c index c4f6cdfa8..08ab01655 100644 --- a/lib/s1ap/asn1c/S1AP_ReceiveStatusofULPDCPSDUs.c +++ b/lib/asn1c/s1ap/S1AP_ReceiveStatusofULPDCPSDUs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReceiveStatusofULPDCPSDUs.h b/lib/asn1c/s1ap/S1AP_ReceiveStatusofULPDCPSDUs.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ReceiveStatusofULPDCPSDUs.h rename to lib/asn1c/s1ap/S1AP_ReceiveStatusofULPDCPSDUs.h index f3ecb3107..177d343d9 100644 --- a/lib/s1ap/asn1c/S1AP_ReceiveStatusofULPDCPSDUs.h +++ b/lib/asn1c/s1ap/S1AP_ReceiveStatusofULPDCPSDUs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedCellItem.c b/lib/asn1c/s1ap/S1AP_RecommendedCellItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_RecommendedCellItem.c rename to lib/asn1c/s1ap/S1AP_RecommendedCellItem.c index 20642bdd1..0e05122b3 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedCellItem.c +++ b/lib/asn1c/s1ap/S1AP_RecommendedCellItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedCellItem.h b/lib/asn1c/s1ap/S1AP_RecommendedCellItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RecommendedCellItem.h rename to lib/asn1c/s1ap/S1AP_RecommendedCellItem.h index 0a1cc1ceb..5e65af309 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedCellItem.h +++ b/lib/asn1c/s1ap/S1AP_RecommendedCellItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedCellList.c b/lib/asn1c/s1ap/S1AP_RecommendedCellList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RecommendedCellList.c rename to lib/asn1c/s1ap/S1AP_RecommendedCellList.c index c0fc33d18..45b685ac2 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedCellList.c +++ b/lib/asn1c/s1ap/S1AP_RecommendedCellList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedCellList.h b/lib/asn1c/s1ap/S1AP_RecommendedCellList.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RecommendedCellList.h rename to lib/asn1c/s1ap/S1AP_RecommendedCellList.h index 676fd4253..03a85e274 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedCellList.h +++ b/lib/asn1c/s1ap/S1AP_RecommendedCellList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedCellsForPaging.c b/lib/asn1c/s1ap/S1AP_RecommendedCellsForPaging.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RecommendedCellsForPaging.c rename to lib/asn1c/s1ap/S1AP_RecommendedCellsForPaging.c index a2d52c4b6..ff6f3d0a6 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedCellsForPaging.c +++ b/lib/asn1c/s1ap/S1AP_RecommendedCellsForPaging.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedCellsForPaging.h b/lib/asn1c/s1ap/S1AP_RecommendedCellsForPaging.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RecommendedCellsForPaging.h rename to lib/asn1c/s1ap/S1AP_RecommendedCellsForPaging.h index 24e70ecb7..c7001b4b8 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedCellsForPaging.h +++ b/lib/asn1c/s1ap/S1AP_RecommendedCellsForPaging.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedENBItem.c b/lib/asn1c/s1ap/S1AP_RecommendedENBItem.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RecommendedENBItem.c rename to lib/asn1c/s1ap/S1AP_RecommendedENBItem.c index c645e3edb..1e7572103 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedENBItem.c +++ b/lib/asn1c/s1ap/S1AP_RecommendedENBItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedENBItem.h b/lib/asn1c/s1ap/S1AP_RecommendedENBItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RecommendedENBItem.h rename to lib/asn1c/s1ap/S1AP_RecommendedENBItem.h index 84be57680..8a97502d5 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedENBItem.h +++ b/lib/asn1c/s1ap/S1AP_RecommendedENBItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedENBList.c b/lib/asn1c/s1ap/S1AP_RecommendedENBList.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RecommendedENBList.c rename to lib/asn1c/s1ap/S1AP_RecommendedENBList.c index b5203c7b6..05f75628a 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedENBList.c +++ b/lib/asn1c/s1ap/S1AP_RecommendedENBList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedENBList.h b/lib/asn1c/s1ap/S1AP_RecommendedENBList.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RecommendedENBList.h rename to lib/asn1c/s1ap/S1AP_RecommendedENBList.h index cf5e7b897..98b0d9710 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedENBList.h +++ b/lib/asn1c/s1ap/S1AP_RecommendedENBList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedENBsForPaging.c b/lib/asn1c/s1ap/S1AP_RecommendedENBsForPaging.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RecommendedENBsForPaging.c rename to lib/asn1c/s1ap/S1AP_RecommendedENBsForPaging.c index 4d19ee7ae..e2ff3a177 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedENBsForPaging.c +++ b/lib/asn1c/s1ap/S1AP_RecommendedENBsForPaging.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RecommendedENBsForPaging.h b/lib/asn1c/s1ap/S1AP_RecommendedENBsForPaging.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RecommendedENBsForPaging.h rename to lib/asn1c/s1ap/S1AP_RecommendedENBsForPaging.h index 7d400facf..ee6d02a2d 100644 --- a/lib/s1ap/asn1c/S1AP_RecommendedENBsForPaging.h +++ b/lib/asn1c/s1ap/S1AP_RecommendedENBsForPaging.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RelativeMMECapacity.c b/lib/asn1c/s1ap/S1AP_RelativeMMECapacity.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RelativeMMECapacity.c rename to lib/asn1c/s1ap/S1AP_RelativeMMECapacity.c index fbf8aec62..f5e118876 100644 --- a/lib/s1ap/asn1c/S1AP_RelativeMMECapacity.c +++ b/lib/asn1c/s1ap/S1AP_RelativeMMECapacity.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RelativeMMECapacity.h b/lib/asn1c/s1ap/S1AP_RelativeMMECapacity.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RelativeMMECapacity.h rename to lib/asn1c/s1ap/S1AP_RelativeMMECapacity.h index 9d0e0dbe8..b5af33d6d 100644 --- a/lib/s1ap/asn1c/S1AP_RelativeMMECapacity.h +++ b/lib/asn1c/s1ap/S1AP_RelativeMMECapacity.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RelayNode-Indicator.c b/lib/asn1c/s1ap/S1AP_RelayNode-Indicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RelayNode-Indicator.c rename to lib/asn1c/s1ap/S1AP_RelayNode-Indicator.c index 01b6bbfc9..720d1408b 100644 --- a/lib/s1ap/asn1c/S1AP_RelayNode-Indicator.c +++ b/lib/asn1c/s1ap/S1AP_RelayNode-Indicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RelayNode-Indicator.h b/lib/asn1c/s1ap/S1AP_RelayNode-Indicator.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RelayNode-Indicator.h rename to lib/asn1c/s1ap/S1AP_RelayNode-Indicator.h index 1ff683f8d..a7c10415a 100644 --- a/lib/s1ap/asn1c/S1AP_RelayNode-Indicator.h +++ b/lib/asn1c/s1ap/S1AP_RelayNode-Indicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RepetitionPeriod.c b/lib/asn1c/s1ap/S1AP_RepetitionPeriod.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RepetitionPeriod.c rename to lib/asn1c/s1ap/S1AP_RepetitionPeriod.c index f01e1415d..c8aacda5d 100644 --- a/lib/s1ap/asn1c/S1AP_RepetitionPeriod.c +++ b/lib/asn1c/s1ap/S1AP_RepetitionPeriod.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RepetitionPeriod.h b/lib/asn1c/s1ap/S1AP_RepetitionPeriod.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_RepetitionPeriod.h rename to lib/asn1c/s1ap/S1AP_RepetitionPeriod.h index ed557ce90..03fdaebc9 100644 --- a/lib/s1ap/asn1c/S1AP_RepetitionPeriod.h +++ b/lib/asn1c/s1ap/S1AP_RepetitionPeriod.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReportAmountMDT.c b/lib/asn1c/s1ap/S1AP_ReportAmountMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReportAmountMDT.c rename to lib/asn1c/s1ap/S1AP_ReportAmountMDT.c index c34cefb5b..0c8cbc7c1 100644 --- a/lib/s1ap/asn1c/S1AP_ReportAmountMDT.c +++ b/lib/asn1c/s1ap/S1AP_ReportAmountMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReportAmountMDT.h b/lib/asn1c/s1ap/S1AP_ReportAmountMDT.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ReportAmountMDT.h rename to lib/asn1c/s1ap/S1AP_ReportAmountMDT.h index a27130e7c..063af3c01 100644 --- a/lib/s1ap/asn1c/S1AP_ReportAmountMDT.h +++ b/lib/asn1c/s1ap/S1AP_ReportAmountMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReportArea.c b/lib/asn1c/s1ap/S1AP_ReportArea.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReportArea.c rename to lib/asn1c/s1ap/S1AP_ReportArea.c index 372cfff19..50ede42b2 100644 --- a/lib/s1ap/asn1c/S1AP_ReportArea.c +++ b/lib/asn1c/s1ap/S1AP_ReportArea.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReportArea.h b/lib/asn1c/s1ap/S1AP_ReportArea.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ReportArea.h rename to lib/asn1c/s1ap/S1AP_ReportArea.h index fdf909020..f96845e4b 100644 --- a/lib/s1ap/asn1c/S1AP_ReportArea.h +++ b/lib/asn1c/s1ap/S1AP_ReportArea.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReportIntervalMDT.c b/lib/asn1c/s1ap/S1AP_ReportIntervalMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReportIntervalMDT.c rename to lib/asn1c/s1ap/S1AP_ReportIntervalMDT.c index b01be8774..4d8868222 100644 --- a/lib/s1ap/asn1c/S1AP_ReportIntervalMDT.c +++ b/lib/asn1c/s1ap/S1AP_ReportIntervalMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ReportIntervalMDT.h b/lib/asn1c/s1ap/S1AP_ReportIntervalMDT.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_ReportIntervalMDT.h rename to lib/asn1c/s1ap/S1AP_ReportIntervalMDT.h index 5184e0409..13e7bbf0c 100644 --- a/lib/s1ap/asn1c/S1AP_ReportIntervalMDT.h +++ b/lib/asn1c/s1ap/S1AP_ReportIntervalMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RequestType.c b/lib/asn1c/s1ap/S1AP_RequestType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RequestType.c rename to lib/asn1c/s1ap/S1AP_RequestType.c index 55aa10f4f..6504c0bfd 100644 --- a/lib/s1ap/asn1c/S1AP_RequestType.c +++ b/lib/asn1c/s1ap/S1AP_RequestType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RequestType.h b/lib/asn1c/s1ap/S1AP_RequestType.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RequestType.h rename to lib/asn1c/s1ap/S1AP_RequestType.h index 60d1782eb..2d6c792a9 100644 --- a/lib/s1ap/asn1c/S1AP_RequestType.h +++ b/lib/asn1c/s1ap/S1AP_RequestType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RerouteNASRequest.c b/lib/asn1c/s1ap/S1AP_RerouteNASRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RerouteNASRequest.c rename to lib/asn1c/s1ap/S1AP_RerouteNASRequest.c index 61766c035..3d7045be6 100644 --- a/lib/s1ap/asn1c/S1AP_RerouteNASRequest.c +++ b/lib/asn1c/s1ap/S1AP_RerouteNASRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RerouteNASRequest.h b/lib/asn1c/s1ap/S1AP_RerouteNASRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RerouteNASRequest.h rename to lib/asn1c/s1ap/S1AP_RerouteNASRequest.h index a474a2528..ddcc28146 100644 --- a/lib/s1ap/asn1c/S1AP_RerouteNASRequest.h +++ b/lib/asn1c/s1ap/S1AP_RerouteNASRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Reset.c b/lib/asn1c/s1ap/S1AP_Reset.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_Reset.c rename to lib/asn1c/s1ap/S1AP_Reset.c index d7123f405..aeeb806b4 100644 --- a/lib/s1ap/asn1c/S1AP_Reset.c +++ b/lib/asn1c/s1ap/S1AP_Reset.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Reset.h b/lib/asn1c/s1ap/S1AP_Reset.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_Reset.h rename to lib/asn1c/s1ap/S1AP_Reset.h index 862ce0fed..3f4643b6f 100644 --- a/lib/s1ap/asn1c/S1AP_Reset.h +++ b/lib/asn1c/s1ap/S1AP_Reset.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ResetAcknowledge.c b/lib/asn1c/s1ap/S1AP_ResetAcknowledge.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ResetAcknowledge.c rename to lib/asn1c/s1ap/S1AP_ResetAcknowledge.c index b2be8ab93..01cc1a137 100644 --- a/lib/s1ap/asn1c/S1AP_ResetAcknowledge.c +++ b/lib/asn1c/s1ap/S1AP_ResetAcknowledge.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ResetAcknowledge.h b/lib/asn1c/s1ap/S1AP_ResetAcknowledge.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ResetAcknowledge.h rename to lib/asn1c/s1ap/S1AP_ResetAcknowledge.h index e96edc1cd..18dea46e5 100644 --- a/lib/s1ap/asn1c/S1AP_ResetAcknowledge.h +++ b/lib/asn1c/s1ap/S1AP_ResetAcknowledge.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ResetAll.c b/lib/asn1c/s1ap/S1AP_ResetAll.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ResetAll.c rename to lib/asn1c/s1ap/S1AP_ResetAll.c index 7892b4fd4..735c9d138 100644 --- a/lib/s1ap/asn1c/S1AP_ResetAll.c +++ b/lib/asn1c/s1ap/S1AP_ResetAll.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ResetAll.h b/lib/asn1c/s1ap/S1AP_ResetAll.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ResetAll.h rename to lib/asn1c/s1ap/S1AP_ResetAll.h index 28448a353..2bb56cc0f 100644 --- a/lib/s1ap/asn1c/S1AP_ResetAll.h +++ b/lib/asn1c/s1ap/S1AP_ResetAll.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ResetType.c b/lib/asn1c/s1ap/S1AP_ResetType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ResetType.c rename to lib/asn1c/s1ap/S1AP_ResetType.c index c81346fe4..f487b0160 100644 --- a/lib/s1ap/asn1c/S1AP_ResetType.c +++ b/lib/asn1c/s1ap/S1AP_ResetType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ResetType.h b/lib/asn1c/s1ap/S1AP_ResetType.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ResetType.h rename to lib/asn1c/s1ap/S1AP_ResetType.h index a3ea1b3ee..adc3d99a6 100644 --- a/lib/s1ap/asn1c/S1AP_ResetType.h +++ b/lib/asn1c/s1ap/S1AP_ResetType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RetrieveUEInformation.c b/lib/asn1c/s1ap/S1AP_RetrieveUEInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_RetrieveUEInformation.c rename to lib/asn1c/s1ap/S1AP_RetrieveUEInformation.c index ed730cb58..67e301fc8 100644 --- a/lib/s1ap/asn1c/S1AP_RetrieveUEInformation.c +++ b/lib/asn1c/s1ap/S1AP_RetrieveUEInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_RetrieveUEInformation.h b/lib/asn1c/s1ap/S1AP_RetrieveUEInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_RetrieveUEInformation.h rename to lib/asn1c/s1ap/S1AP_RetrieveUEInformation.h index 5d2f3b152..e74f4e9a7 100644 --- a/lib/s1ap/asn1c/S1AP_RetrieveUEInformation.h +++ b/lib/asn1c/s1ap/S1AP_RetrieveUEInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Routing-ID.c b/lib/asn1c/s1ap/S1AP_Routing-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Routing-ID.c rename to lib/asn1c/s1ap/S1AP_Routing-ID.c index 5a2baa667..57ae5d106 100644 --- a/lib/s1ap/asn1c/S1AP_Routing-ID.c +++ b/lib/asn1c/s1ap/S1AP_Routing-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Routing-ID.h b/lib/asn1c/s1ap/S1AP_Routing-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_Routing-ID.h rename to lib/asn1c/s1ap/S1AP_Routing-ID.h index c44fb9cab..1323c9219 100644 --- a/lib/s1ap/asn1c/S1AP_Routing-ID.h +++ b/lib/asn1c/s1ap/S1AP_Routing-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S-TMSI.c b/lib/asn1c/s1ap/S1AP_S-TMSI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_S-TMSI.c rename to lib/asn1c/s1ap/S1AP_S-TMSI.c index f900bde97..b7c2cadbe 100644 --- a/lib/s1ap/asn1c/S1AP_S-TMSI.c +++ b/lib/asn1c/s1ap/S1AP_S-TMSI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S-TMSI.h b/lib/asn1c/s1ap/S1AP_S-TMSI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_S-TMSI.h rename to lib/asn1c/s1ap/S1AP_S-TMSI.h index 4ccad810d..609bab9dd 100644 --- a/lib/s1ap/asn1c/S1AP_S-TMSI.h +++ b/lib/asn1c/s1ap/S1AP_S-TMSI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1AP-PDU.c b/lib/asn1c/s1ap/S1AP_S1AP-PDU.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_S1AP-PDU.c rename to lib/asn1c/s1ap/S1AP_S1AP-PDU.c index 062859100..625124409 100644 --- a/lib/s1ap/asn1c/S1AP_S1AP-PDU.c +++ b/lib/asn1c/s1ap/S1AP_S1AP-PDU.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1AP-PDU.h b/lib/asn1c/s1ap/S1AP_S1AP-PDU.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_S1AP-PDU.h rename to lib/asn1c/s1ap/S1AP_S1AP-PDU.h index 92091594a..b742f84f2 100644 --- a/lib/s1ap/asn1c/S1AP_S1AP-PDU.h +++ b/lib/asn1c/s1ap/S1AP_S1AP-PDU.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1SetupFailure.c b/lib/asn1c/s1ap/S1AP_S1SetupFailure.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_S1SetupFailure.c rename to lib/asn1c/s1ap/S1AP_S1SetupFailure.c index 7aed7d07d..23231b9f4 100644 --- a/lib/s1ap/asn1c/S1AP_S1SetupFailure.c +++ b/lib/asn1c/s1ap/S1AP_S1SetupFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1SetupFailure.h b/lib/asn1c/s1ap/S1AP_S1SetupFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_S1SetupFailure.h rename to lib/asn1c/s1ap/S1AP_S1SetupFailure.h index afda23f86..7f5c1c1db 100644 --- a/lib/s1ap/asn1c/S1AP_S1SetupFailure.h +++ b/lib/asn1c/s1ap/S1AP_S1SetupFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1SetupRequest.c b/lib/asn1c/s1ap/S1AP_S1SetupRequest.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_S1SetupRequest.c rename to lib/asn1c/s1ap/S1AP_S1SetupRequest.c index 9261b5a48..7659171a9 100644 --- a/lib/s1ap/asn1c/S1AP_S1SetupRequest.c +++ b/lib/asn1c/s1ap/S1AP_S1SetupRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1SetupRequest.h b/lib/asn1c/s1ap/S1AP_S1SetupRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_S1SetupRequest.h rename to lib/asn1c/s1ap/S1AP_S1SetupRequest.h index 83913580d..c0990975d 100644 --- a/lib/s1ap/asn1c/S1AP_S1SetupRequest.h +++ b/lib/asn1c/s1ap/S1AP_S1SetupRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1SetupResponse.c b/lib/asn1c/s1ap/S1AP_S1SetupResponse.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_S1SetupResponse.c rename to lib/asn1c/s1ap/S1AP_S1SetupResponse.c index c49076521..10dc1a4d5 100644 --- a/lib/s1ap/asn1c/S1AP_S1SetupResponse.c +++ b/lib/asn1c/s1ap/S1AP_S1SetupResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_S1SetupResponse.h b/lib/asn1c/s1ap/S1AP_S1SetupResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_S1SetupResponse.h rename to lib/asn1c/s1ap/S1AP_S1SetupResponse.h index 4ae7a9e13..3f537a223 100644 --- a/lib/s1ap/asn1c/S1AP_S1SetupResponse.h +++ b/lib/asn1c/s1ap/S1AP_S1SetupResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONConfigurationTransfer.c b/lib/asn1c/s1ap/S1AP_SONConfigurationTransfer.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_SONConfigurationTransfer.c rename to lib/asn1c/s1ap/S1AP_SONConfigurationTransfer.c index 573904782..0141ee191 100644 --- a/lib/s1ap/asn1c/S1AP_SONConfigurationTransfer.c +++ b/lib/asn1c/s1ap/S1AP_SONConfigurationTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONConfigurationTransfer.h b/lib/asn1c/s1ap/S1AP_SONConfigurationTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_SONConfigurationTransfer.h rename to lib/asn1c/s1ap/S1AP_SONConfigurationTransfer.h index 3acd85354..360c33c0d 100644 --- a/lib/s1ap/asn1c/S1AP_SONConfigurationTransfer.h +++ b/lib/asn1c/s1ap/S1AP_SONConfigurationTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformation-Extension.c b/lib/asn1c/s1ap/S1AP_SONInformation-Extension.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_SONInformation-Extension.c rename to lib/asn1c/s1ap/S1AP_SONInformation-Extension.c index fc1eb266d..00fd8aa42 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformation-Extension.c +++ b/lib/asn1c/s1ap/S1AP_SONInformation-Extension.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformation-Extension.h b/lib/asn1c/s1ap/S1AP_SONInformation-Extension.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SONInformation-Extension.h rename to lib/asn1c/s1ap/S1AP_SONInformation-Extension.h index fe6cde42c..8a0cf5ba6 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformation-Extension.h +++ b/lib/asn1c/s1ap/S1AP_SONInformation-Extension.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformation.c b/lib/asn1c/s1ap/S1AP_SONInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_SONInformation.c rename to lib/asn1c/s1ap/S1AP_SONInformation.c index c5febe497..76f6df46d 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformation.c +++ b/lib/asn1c/s1ap/S1AP_SONInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformation.h b/lib/asn1c/s1ap/S1AP_SONInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SONInformation.h rename to lib/asn1c/s1ap/S1AP_SONInformation.h index 6e459fde3..86acd1133 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformation.h +++ b/lib/asn1c/s1ap/S1AP_SONInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformationReply.c b/lib/asn1c/s1ap/S1AP_SONInformationReply.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SONInformationReply.c rename to lib/asn1c/s1ap/S1AP_SONInformationReply.c index 61e47ddfb..e2153ec9d 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformationReply.c +++ b/lib/asn1c/s1ap/S1AP_SONInformationReply.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformationReply.h b/lib/asn1c/s1ap/S1AP_SONInformationReply.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_SONInformationReply.h rename to lib/asn1c/s1ap/S1AP_SONInformationReply.h index 45bc7a38e..aa8e444bf 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformationReply.h +++ b/lib/asn1c/s1ap/S1AP_SONInformationReply.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformationReport.c b/lib/asn1c/s1ap/S1AP_SONInformationReport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SONInformationReport.c rename to lib/asn1c/s1ap/S1AP_SONInformationReport.c index c949e576c..db0ae13f1 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformationReport.c +++ b/lib/asn1c/s1ap/S1AP_SONInformationReport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformationReport.h b/lib/asn1c/s1ap/S1AP_SONInformationReport.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SONInformationReport.h rename to lib/asn1c/s1ap/S1AP_SONInformationReport.h index f7c77e6c0..bf9e8d0fa 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformationReport.h +++ b/lib/asn1c/s1ap/S1AP_SONInformationReport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformationRequest.c b/lib/asn1c/s1ap/S1AP_SONInformationRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SONInformationRequest.c rename to lib/asn1c/s1ap/S1AP_SONInformationRequest.c index 70fbe7676..0360435dc 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformationRequest.c +++ b/lib/asn1c/s1ap/S1AP_SONInformationRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SONInformationRequest.h b/lib/asn1c/s1ap/S1AP_SONInformationRequest.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_SONInformationRequest.h rename to lib/asn1c/s1ap/S1AP_SONInformationRequest.h index 4fee541cc..fb2ca9e37 100644 --- a/lib/s1ap/asn1c/S1AP_SONInformationRequest.h +++ b/lib/asn1c/s1ap/S1AP_SONInformationRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SRVCCHOIndication.c b/lib/asn1c/s1ap/S1AP_SRVCCHOIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SRVCCHOIndication.c rename to lib/asn1c/s1ap/S1AP_SRVCCHOIndication.c index 35e881e13..c3913ea7b 100644 --- a/lib/s1ap/asn1c/S1AP_SRVCCHOIndication.c +++ b/lib/asn1c/s1ap/S1AP_SRVCCHOIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SRVCCHOIndication.h b/lib/asn1c/s1ap/S1AP_SRVCCHOIndication.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SRVCCHOIndication.h rename to lib/asn1c/s1ap/S1AP_SRVCCHOIndication.h index 3264e9377..d873edc7e 100644 --- a/lib/s1ap/asn1c/S1AP_SRVCCHOIndication.h +++ b/lib/asn1c/s1ap/S1AP_SRVCCHOIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SRVCCOperationNotPossible.c b/lib/asn1c/s1ap/S1AP_SRVCCOperationNotPossible.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SRVCCOperationNotPossible.c rename to lib/asn1c/s1ap/S1AP_SRVCCOperationNotPossible.c index 87816fb8b..956afcb7c 100644 --- a/lib/s1ap/asn1c/S1AP_SRVCCOperationNotPossible.c +++ b/lib/asn1c/s1ap/S1AP_SRVCCOperationNotPossible.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SRVCCOperationNotPossible.h b/lib/asn1c/s1ap/S1AP_SRVCCOperationNotPossible.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SRVCCOperationNotPossible.h rename to lib/asn1c/s1ap/S1AP_SRVCCOperationNotPossible.h index 6cea75e57..d3acb52e7 100644 --- a/lib/s1ap/asn1c/S1AP_SRVCCOperationNotPossible.h +++ b/lib/asn1c/s1ap/S1AP_SRVCCOperationNotPossible.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SRVCCOperationPossible.c b/lib/asn1c/s1ap/S1AP_SRVCCOperationPossible.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SRVCCOperationPossible.c rename to lib/asn1c/s1ap/S1AP_SRVCCOperationPossible.c index d25e6e791..8e9906aa1 100644 --- a/lib/s1ap/asn1c/S1AP_SRVCCOperationPossible.c +++ b/lib/asn1c/s1ap/S1AP_SRVCCOperationPossible.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SRVCCOperationPossible.h b/lib/asn1c/s1ap/S1AP_SRVCCOperationPossible.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SRVCCOperationPossible.h rename to lib/asn1c/s1ap/S1AP_SRVCCOperationPossible.h index 15fa332b7..4df5e6602 100644 --- a/lib/s1ap/asn1c/S1AP_SRVCCOperationPossible.h +++ b/lib/asn1c/s1ap/S1AP_SRVCCOperationPossible.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SecurityContext.c b/lib/asn1c/s1ap/S1AP_SecurityContext.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_SecurityContext.c rename to lib/asn1c/s1ap/S1AP_SecurityContext.c index 23ddda628..ba03c608e 100644 --- a/lib/s1ap/asn1c/S1AP_SecurityContext.c +++ b/lib/asn1c/s1ap/S1AP_SecurityContext.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SecurityContext.h b/lib/asn1c/s1ap/S1AP_SecurityContext.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_SecurityContext.h rename to lib/asn1c/s1ap/S1AP_SecurityContext.h index 4d9ae6066..87bf7cc94 100644 --- a/lib/s1ap/asn1c/S1AP_SecurityContext.h +++ b/lib/asn1c/s1ap/S1AP_SecurityContext.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SecurityKey.c b/lib/asn1c/s1ap/S1AP_SecurityKey.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SecurityKey.c rename to lib/asn1c/s1ap/S1AP_SecurityKey.c index ec088b1b7..ffca784cb 100644 --- a/lib/s1ap/asn1c/S1AP_SecurityKey.c +++ b/lib/asn1c/s1ap/S1AP_SecurityKey.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SecurityKey.h b/lib/asn1c/s1ap/S1AP_SecurityKey.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SecurityKey.h rename to lib/asn1c/s1ap/S1AP_SecurityKey.h index 19d113cc7..941a601fe 100644 --- a/lib/s1ap/asn1c/S1AP_SecurityKey.h +++ b/lib/asn1c/s1ap/S1AP_SecurityKey.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SerialNumber.c b/lib/asn1c/s1ap/S1AP_SerialNumber.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SerialNumber.c rename to lib/asn1c/s1ap/S1AP_SerialNumber.c index 4d7fcde48..e6526c636 100644 --- a/lib/s1ap/asn1c/S1AP_SerialNumber.c +++ b/lib/asn1c/s1ap/S1AP_SerialNumber.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SerialNumber.h b/lib/asn1c/s1ap/S1AP_SerialNumber.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_SerialNumber.h rename to lib/asn1c/s1ap/S1AP_SerialNumber.h index e21c399ed..58ef04d92 100644 --- a/lib/s1ap/asn1c/S1AP_SerialNumber.h +++ b/lib/asn1c/s1ap/S1AP_SerialNumber.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedDCNs.c b/lib/asn1c/s1ap/S1AP_ServedDCNs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ServedDCNs.c rename to lib/asn1c/s1ap/S1AP_ServedDCNs.c index e6a39755b..2f335b82c 100644 --- a/lib/s1ap/asn1c/S1AP_ServedDCNs.c +++ b/lib/asn1c/s1ap/S1AP_ServedDCNs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedDCNs.h b/lib/asn1c/s1ap/S1AP_ServedDCNs.h similarity index 93% rename from lib/s1ap/asn1c/S1AP_ServedDCNs.h rename to lib/asn1c/s1ap/S1AP_ServedDCNs.h index 377db5e19..1d42f7541 100644 --- a/lib/s1ap/asn1c/S1AP_ServedDCNs.h +++ b/lib/asn1c/s1ap/S1AP_ServedDCNs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedDCNsItem.c b/lib/asn1c/s1ap/S1AP_ServedDCNsItem.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ServedDCNsItem.c rename to lib/asn1c/s1ap/S1AP_ServedDCNsItem.c index 264444a44..46adda51f 100644 --- a/lib/s1ap/asn1c/S1AP_ServedDCNsItem.c +++ b/lib/asn1c/s1ap/S1AP_ServedDCNsItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedDCNsItem.h b/lib/asn1c/s1ap/S1AP_ServedDCNsItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ServedDCNsItem.h rename to lib/asn1c/s1ap/S1AP_ServedDCNsItem.h index e40a37b92..a21b195a9 100644 --- a/lib/s1ap/asn1c/S1AP_ServedDCNsItem.h +++ b/lib/asn1c/s1ap/S1AP_ServedDCNsItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedGUMMEIs.c b/lib/asn1c/s1ap/S1AP_ServedGUMMEIs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ServedGUMMEIs.c rename to lib/asn1c/s1ap/S1AP_ServedGUMMEIs.c index 8c738e490..37abe2fa0 100644 --- a/lib/s1ap/asn1c/S1AP_ServedGUMMEIs.c +++ b/lib/asn1c/s1ap/S1AP_ServedGUMMEIs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedGUMMEIs.h b/lib/asn1c/s1ap/S1AP_ServedGUMMEIs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ServedGUMMEIs.h rename to lib/asn1c/s1ap/S1AP_ServedGUMMEIs.h index 02c9ee348..b99ea28a7 100644 --- a/lib/s1ap/asn1c/S1AP_ServedGUMMEIs.h +++ b/lib/asn1c/s1ap/S1AP_ServedGUMMEIs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedGUMMEIsItem.c b/lib/asn1c/s1ap/S1AP_ServedGUMMEIsItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_ServedGUMMEIsItem.c rename to lib/asn1c/s1ap/S1AP_ServedGUMMEIsItem.c index 223c562fd..1d48823c9 100644 --- a/lib/s1ap/asn1c/S1AP_ServedGUMMEIsItem.c +++ b/lib/asn1c/s1ap/S1AP_ServedGUMMEIsItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedGUMMEIsItem.h b/lib/asn1c/s1ap/S1AP_ServedGUMMEIsItem.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_ServedGUMMEIsItem.h rename to lib/asn1c/s1ap/S1AP_ServedGUMMEIsItem.h index d88bd8e3d..9c555c7b0 100644 --- a/lib/s1ap/asn1c/S1AP_ServedGUMMEIsItem.h +++ b/lib/asn1c/s1ap/S1AP_ServedGUMMEIsItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedGroupIDs.c b/lib/asn1c/s1ap/S1AP_ServedGroupIDs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_ServedGroupIDs.c rename to lib/asn1c/s1ap/S1AP_ServedGroupIDs.c index 910afc16c..bfec04cd7 100644 --- a/lib/s1ap/asn1c/S1AP_ServedGroupIDs.c +++ b/lib/asn1c/s1ap/S1AP_ServedGroupIDs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedGroupIDs.h b/lib/asn1c/s1ap/S1AP_ServedGroupIDs.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_ServedGroupIDs.h rename to lib/asn1c/s1ap/S1AP_ServedGroupIDs.h index 4c1b8d1f6..79818067e 100644 --- a/lib/s1ap/asn1c/S1AP_ServedGroupIDs.h +++ b/lib/asn1c/s1ap/S1AP_ServedGroupIDs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedMMECs.c b/lib/asn1c/s1ap/S1AP_ServedMMECs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ServedMMECs.c rename to lib/asn1c/s1ap/S1AP_ServedMMECs.c index e3622fde0..d242b3fee 100644 --- a/lib/s1ap/asn1c/S1AP_ServedMMECs.c +++ b/lib/asn1c/s1ap/S1AP_ServedMMECs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedMMECs.h b/lib/asn1c/s1ap/S1AP_ServedMMECs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ServedMMECs.h rename to lib/asn1c/s1ap/S1AP_ServedMMECs.h index 6d34bca1e..74d052602 100644 --- a/lib/s1ap/asn1c/S1AP_ServedMMECs.h +++ b/lib/asn1c/s1ap/S1AP_ServedMMECs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedPLMNs.c b/lib/asn1c/s1ap/S1AP_ServedPLMNs.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_ServedPLMNs.c rename to lib/asn1c/s1ap/S1AP_ServedPLMNs.c index 355d4249c..0ea77e575 100644 --- a/lib/s1ap/asn1c/S1AP_ServedPLMNs.c +++ b/lib/asn1c/s1ap/S1AP_ServedPLMNs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_ServedPLMNs.h b/lib/asn1c/s1ap/S1AP_ServedPLMNs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_ServedPLMNs.h rename to lib/asn1c/s1ap/S1AP_ServedPLMNs.h index 421ee566c..c53923386 100644 --- a/lib/s1ap/asn1c/S1AP_ServedPLMNs.h +++ b/lib/asn1c/s1ap/S1AP_ServedPLMNs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Source-ToTarget-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_Source-ToTarget-TransparentContainer.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_Source-ToTarget-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_Source-ToTarget-TransparentContainer.c index e053ebfc2..e133bfd41 100644 --- a/lib/s1ap/asn1c/S1AP_Source-ToTarget-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_Source-ToTarget-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Source-ToTarget-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_Source-ToTarget-TransparentContainer.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Source-ToTarget-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_Source-ToTarget-TransparentContainer.h index f7438d3c5..e92f31e10 100644 --- a/lib/s1ap/asn1c/S1AP_Source-ToTarget-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_Source-ToTarget-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c index c78a06304..780380da1 100644 --- a/lib/s1ap/asn1c/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h index 5e05f5a22..cf8ed6f9e 100644 --- a/lib/s1ap/asn1c/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceOfUEActivityBehaviourInformation.c b/lib/asn1c/s1ap/S1AP_SourceOfUEActivityBehaviourInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SourceOfUEActivityBehaviourInformation.c rename to lib/asn1c/s1ap/S1AP_SourceOfUEActivityBehaviourInformation.c index d8ef485d4..2b7ba89a6 100644 --- a/lib/s1ap/asn1c/S1AP_SourceOfUEActivityBehaviourInformation.c +++ b/lib/asn1c/s1ap/S1AP_SourceOfUEActivityBehaviourInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceOfUEActivityBehaviourInformation.h b/lib/asn1c/s1ap/S1AP_SourceOfUEActivityBehaviourInformation.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_SourceOfUEActivityBehaviourInformation.h rename to lib/asn1c/s1ap/S1AP_SourceOfUEActivityBehaviourInformation.h index a6ca4ec21..cca9e3c2d 100644 --- a/lib/s1ap/asn1c/S1AP_SourceOfUEActivityBehaviourInformation.h +++ b/lib/asn1c/s1ap/S1AP_SourceOfUEActivityBehaviourInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c index ad332f0fc..2fc6e22bd 100644 --- a/lib/s1ap/asn1c/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h index f0d4b3043..1fbab0065 100644 --- a/lib/s1ap/asn1c/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceeNB-ID.c b/lib/asn1c/s1ap/S1AP_SourceeNB-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SourceeNB-ID.c rename to lib/asn1c/s1ap/S1AP_SourceeNB-ID.c index 738d82b60..412cf77cf 100644 --- a/lib/s1ap/asn1c/S1AP_SourceeNB-ID.c +++ b/lib/asn1c/s1ap/S1AP_SourceeNB-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceeNB-ID.h b/lib/asn1c/s1ap/S1AP_SourceeNB-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_SourceeNB-ID.h rename to lib/asn1c/s1ap/S1AP_SourceeNB-ID.h index 1b6e728ec..aca16b915 100644 --- a/lib/s1ap/asn1c/S1AP_SourceeNB-ID.h +++ b/lib/asn1c/s1ap/S1AP_SourceeNB-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c index 1a18bbacf..434a581fd 100644 --- a/lib/s1ap/asn1c/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h index d33c831f6..fd7906a81 100644 --- a/lib/s1ap/asn1c/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_StratumLevel.c b/lib/asn1c/s1ap/S1AP_StratumLevel.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_StratumLevel.c rename to lib/asn1c/s1ap/S1AP_StratumLevel.c index 69ec4d049..b93f02922 100644 --- a/lib/s1ap/asn1c/S1AP_StratumLevel.c +++ b/lib/asn1c/s1ap/S1AP_StratumLevel.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_StratumLevel.h b/lib/asn1c/s1ap/S1AP_StratumLevel.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_StratumLevel.h rename to lib/asn1c/s1ap/S1AP_StratumLevel.h index 833165dde..bf84f6164 100644 --- a/lib/s1ap/asn1c/S1AP_StratumLevel.h +++ b/lib/asn1c/s1ap/S1AP_StratumLevel.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SubscriberProfileIDforRFP.c b/lib/asn1c/s1ap/S1AP_SubscriberProfileIDforRFP.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SubscriberProfileIDforRFP.c rename to lib/asn1c/s1ap/S1AP_SubscriberProfileIDforRFP.c index 57fa408de..2331037ff 100644 --- a/lib/s1ap/asn1c/S1AP_SubscriberProfileIDforRFP.c +++ b/lib/asn1c/s1ap/S1AP_SubscriberProfileIDforRFP.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SubscriberProfileIDforRFP.h b/lib/asn1c/s1ap/S1AP_SubscriberProfileIDforRFP.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SubscriberProfileIDforRFP.h rename to lib/asn1c/s1ap/S1AP_SubscriberProfileIDforRFP.h index 8d509886d..b0de7a805 100644 --- a/lib/s1ap/asn1c/S1AP_SubscriberProfileIDforRFP.h +++ b/lib/asn1c/s1ap/S1AP_SubscriberProfileIDforRFP.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SuccessfulOutcome.c b/lib/asn1c/s1ap/S1AP_SuccessfulOutcome.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_SuccessfulOutcome.c rename to lib/asn1c/s1ap/S1AP_SuccessfulOutcome.c index 58e423713..0f397fca2 100644 --- a/lib/s1ap/asn1c/S1AP_SuccessfulOutcome.c +++ b/lib/asn1c/s1ap/S1AP_SuccessfulOutcome.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SuccessfulOutcome.h b/lib/asn1c/s1ap/S1AP_SuccessfulOutcome.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_SuccessfulOutcome.h rename to lib/asn1c/s1ap/S1AP_SuccessfulOutcome.h index 2b1510dae..1f49a1749 100644 --- a/lib/s1ap/asn1c/S1AP_SuccessfulOutcome.h +++ b/lib/asn1c/s1ap/S1AP_SuccessfulOutcome.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SupportedTAs-Item.c b/lib/asn1c/s1ap/S1AP_SupportedTAs-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SupportedTAs-Item.c rename to lib/asn1c/s1ap/S1AP_SupportedTAs-Item.c index 1ba6daaf3..42589ac0f 100644 --- a/lib/s1ap/asn1c/S1AP_SupportedTAs-Item.c +++ b/lib/asn1c/s1ap/S1AP_SupportedTAs-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SupportedTAs-Item.h b/lib/asn1c/s1ap/S1AP_SupportedTAs-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_SupportedTAs-Item.h rename to lib/asn1c/s1ap/S1AP_SupportedTAs-Item.h index 3edb1480e..6bd8d5466 100644 --- a/lib/s1ap/asn1c/S1AP_SupportedTAs-Item.h +++ b/lib/asn1c/s1ap/S1AP_SupportedTAs-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SupportedTAs.c b/lib/asn1c/s1ap/S1AP_SupportedTAs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SupportedTAs.c rename to lib/asn1c/s1ap/S1AP_SupportedTAs.c index 28b92fd69..8a866dbd2 100644 --- a/lib/s1ap/asn1c/S1AP_SupportedTAs.c +++ b/lib/asn1c/s1ap/S1AP_SupportedTAs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SupportedTAs.h b/lib/asn1c/s1ap/S1AP_SupportedTAs.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_SupportedTAs.h rename to lib/asn1c/s1ap/S1AP_SupportedTAs.h index 6fc37c772..cde71b6ac 100644 --- a/lib/s1ap/asn1c/S1AP_SupportedTAs.h +++ b/lib/asn1c/s1ap/S1AP_SupportedTAs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SynchronisationInformation.c b/lib/asn1c/s1ap/S1AP_SynchronisationInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_SynchronisationInformation.c rename to lib/asn1c/s1ap/S1AP_SynchronisationInformation.c index 35bab8430..6ebcf0eb3 100644 --- a/lib/s1ap/asn1c/S1AP_SynchronisationInformation.c +++ b/lib/asn1c/s1ap/S1AP_SynchronisationInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SynchronisationInformation.h b/lib/asn1c/s1ap/S1AP_SynchronisationInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SynchronisationInformation.h rename to lib/asn1c/s1ap/S1AP_SynchronisationInformation.h index f713d8454..0851bc70f 100644 --- a/lib/s1ap/asn1c/S1AP_SynchronisationInformation.h +++ b/lib/asn1c/s1ap/S1AP_SynchronisationInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SynchronisationStatus.c b/lib/asn1c/s1ap/S1AP_SynchronisationStatus.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_SynchronisationStatus.c rename to lib/asn1c/s1ap/S1AP_SynchronisationStatus.c index f7e2c4d5f..3bf9b186b 100644 --- a/lib/s1ap/asn1c/S1AP_SynchronisationStatus.c +++ b/lib/asn1c/s1ap/S1AP_SynchronisationStatus.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_SynchronisationStatus.h b/lib/asn1c/s1ap/S1AP_SynchronisationStatus.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_SynchronisationStatus.h rename to lib/asn1c/s1ap/S1AP_SynchronisationStatus.h index 871dc7e3b..8301d08f3 100644 --- a/lib/s1ap/asn1c/S1AP_SynchronisationStatus.h +++ b/lib/asn1c/s1ap/S1AP_SynchronisationStatus.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TABasedMDT.c b/lib/asn1c/s1ap/S1AP_TABasedMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TABasedMDT.c rename to lib/asn1c/s1ap/S1AP_TABasedMDT.c index 9c6b441bb..e9b5b3645 100644 --- a/lib/s1ap/asn1c/S1AP_TABasedMDT.c +++ b/lib/asn1c/s1ap/S1AP_TABasedMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TABasedMDT.h b/lib/asn1c/s1ap/S1AP_TABasedMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TABasedMDT.h rename to lib/asn1c/s1ap/S1AP_TABasedMDT.h index 50d648a56..b0ba2ec2b 100644 --- a/lib/s1ap/asn1c/S1AP_TABasedMDT.h +++ b/lib/asn1c/s1ap/S1AP_TABasedMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAC.c b/lib/asn1c/s1ap/S1AP_TAC.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAC.c rename to lib/asn1c/s1ap/S1AP_TAC.c index 945b16475..fa4942a35 100644 --- a/lib/s1ap/asn1c/S1AP_TAC.c +++ b/lib/asn1c/s1ap/S1AP_TAC.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAC.h b/lib/asn1c/s1ap/S1AP_TAC.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAC.h rename to lib/asn1c/s1ap/S1AP_TAC.h index 66b43a174..8214032b2 100644 --- a/lib/s1ap/asn1c/S1AP_TAC.h +++ b/lib/asn1c/s1ap/S1AP_TAC.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Broadcast-Item.c b/lib/asn1c/s1ap/S1AP_TAI-Broadcast-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAI-Broadcast-Item.c rename to lib/asn1c/s1ap/S1AP_TAI-Broadcast-Item.c index e5f500cb0..2f19af689 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Broadcast-Item.c +++ b/lib/asn1c/s1ap/S1AP_TAI-Broadcast-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Broadcast-Item.h b/lib/asn1c/s1ap/S1AP_TAI-Broadcast-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAI-Broadcast-Item.h rename to lib/asn1c/s1ap/S1AP_TAI-Broadcast-Item.h index 6b8c9fcf0..6854357d7 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Broadcast-Item.h +++ b/lib/asn1c/s1ap/S1AP_TAI-Broadcast-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Broadcast.c b/lib/asn1c/s1ap/S1AP_TAI-Broadcast.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAI-Broadcast.c rename to lib/asn1c/s1ap/S1AP_TAI-Broadcast.c index 301b84dec..4b0cd447f 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Broadcast.c +++ b/lib/asn1c/s1ap/S1AP_TAI-Broadcast.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Broadcast.h b/lib/asn1c/s1ap/S1AP_TAI-Broadcast.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAI-Broadcast.h rename to lib/asn1c/s1ap/S1AP_TAI-Broadcast.h index c0e2e85fe..6cd049b4b 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Broadcast.h +++ b/lib/asn1c/s1ap/S1AP_TAI-Broadcast.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Cancelled-Item.c b/lib/asn1c/s1ap/S1AP_TAI-Cancelled-Item.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAI-Cancelled-Item.c rename to lib/asn1c/s1ap/S1AP_TAI-Cancelled-Item.c index 4b27244ce..bf12d8513 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Cancelled-Item.c +++ b/lib/asn1c/s1ap/S1AP_TAI-Cancelled-Item.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Cancelled-Item.h b/lib/asn1c/s1ap/S1AP_TAI-Cancelled-Item.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAI-Cancelled-Item.h rename to lib/asn1c/s1ap/S1AP_TAI-Cancelled-Item.h index 657b175f9..5b59e37b5 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Cancelled-Item.h +++ b/lib/asn1c/s1ap/S1AP_TAI-Cancelled-Item.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Cancelled.c b/lib/asn1c/s1ap/S1AP_TAI-Cancelled.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAI-Cancelled.c rename to lib/asn1c/s1ap/S1AP_TAI-Cancelled.c index a773f7428..9acaab011 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Cancelled.c +++ b/lib/asn1c/s1ap/S1AP_TAI-Cancelled.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI-Cancelled.h b/lib/asn1c/s1ap/S1AP_TAI-Cancelled.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAI-Cancelled.h rename to lib/asn1c/s1ap/S1AP_TAI-Cancelled.h index 6f5c3d6af..9f6cee22e 100644 --- a/lib/s1ap/asn1c/S1AP_TAI-Cancelled.h +++ b/lib/asn1c/s1ap/S1AP_TAI-Cancelled.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI.c b/lib/asn1c/s1ap/S1AP_TAI.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAI.c rename to lib/asn1c/s1ap/S1AP_TAI.c index db8055d03..583391096 100644 --- a/lib/s1ap/asn1c/S1AP_TAI.c +++ b/lib/asn1c/s1ap/S1AP_TAI.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAI.h b/lib/asn1c/s1ap/S1AP_TAI.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAI.h rename to lib/asn1c/s1ap/S1AP_TAI.h index b4e57b73a..de505dbb8 100644 --- a/lib/s1ap/asn1c/S1AP_TAI.h +++ b/lib/asn1c/s1ap/S1AP_TAI.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIBasedMDT.c b/lib/asn1c/s1ap/S1AP_TAIBasedMDT.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAIBasedMDT.c rename to lib/asn1c/s1ap/S1AP_TAIBasedMDT.c index e7fed1e82..032247566 100644 --- a/lib/s1ap/asn1c/S1AP_TAIBasedMDT.c +++ b/lib/asn1c/s1ap/S1AP_TAIBasedMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIBasedMDT.h b/lib/asn1c/s1ap/S1AP_TAIBasedMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAIBasedMDT.h rename to lib/asn1c/s1ap/S1AP_TAIBasedMDT.h index daeef2e90..7aa3bc5f0 100644 --- a/lib/s1ap/asn1c/S1AP_TAIBasedMDT.h +++ b/lib/asn1c/s1ap/S1AP_TAIBasedMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIItem.c b/lib/asn1c/s1ap/S1AP_TAIItem.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAIItem.c rename to lib/asn1c/s1ap/S1AP_TAIItem.c index 76aad0305..0052f0e9c 100644 --- a/lib/s1ap/asn1c/S1AP_TAIItem.c +++ b/lib/asn1c/s1ap/S1AP_TAIItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIItem.h b/lib/asn1c/s1ap/S1AP_TAIItem.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_TAIItem.h rename to lib/asn1c/s1ap/S1AP_TAIItem.h index b4160edd5..d1dd4c2d8 100644 --- a/lib/s1ap/asn1c/S1AP_TAIItem.h +++ b/lib/asn1c/s1ap/S1AP_TAIItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIList.c b/lib/asn1c/s1ap/S1AP_TAIList.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_TAIList.c rename to lib/asn1c/s1ap/S1AP_TAIList.c index 77fd49052..8775aa2ba 100644 --- a/lib/s1ap/asn1c/S1AP_TAIList.c +++ b/lib/asn1c/s1ap/S1AP_TAIList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIList.h b/lib/asn1c/s1ap/S1AP_TAIList.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_TAIList.h rename to lib/asn1c/s1ap/S1AP_TAIList.h index 73c0bbb14..9385d2aed 100644 --- a/lib/s1ap/asn1c/S1AP_TAIList.h +++ b/lib/asn1c/s1ap/S1AP_TAIList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIListForRestart.c b/lib/asn1c/s1ap/S1AP_TAIListForRestart.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAIListForRestart.c rename to lib/asn1c/s1ap/S1AP_TAIListForRestart.c index a345b3d72..816fc2ce0 100644 --- a/lib/s1ap/asn1c/S1AP_TAIListForRestart.c +++ b/lib/asn1c/s1ap/S1AP_TAIListForRestart.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIListForRestart.h b/lib/asn1c/s1ap/S1AP_TAIListForRestart.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_TAIListForRestart.h rename to lib/asn1c/s1ap/S1AP_TAIListForRestart.h index c810f2ac2..58e55f722 100644 --- a/lib/s1ap/asn1c/S1AP_TAIListForRestart.h +++ b/lib/asn1c/s1ap/S1AP_TAIListForRestart.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIListforMDT.c b/lib/asn1c/s1ap/S1AP_TAIListforMDT.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_TAIListforMDT.c rename to lib/asn1c/s1ap/S1AP_TAIListforMDT.c index 18df9aa15..a209f29cc 100644 --- a/lib/s1ap/asn1c/S1AP_TAIListforMDT.c +++ b/lib/asn1c/s1ap/S1AP_TAIListforMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIListforMDT.h b/lib/asn1c/s1ap/S1AP_TAIListforMDT.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAIListforMDT.h rename to lib/asn1c/s1ap/S1AP_TAIListforMDT.h index fcf21cf4e..d09dd8b33 100644 --- a/lib/s1ap/asn1c/S1AP_TAIListforMDT.h +++ b/lib/asn1c/s1ap/S1AP_TAIListforMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIListforWarning.c b/lib/asn1c/s1ap/S1AP_TAIListforWarning.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TAIListforWarning.c rename to lib/asn1c/s1ap/S1AP_TAIListforWarning.c index cf0358446..08c6d0232 100644 --- a/lib/s1ap/asn1c/S1AP_TAIListforWarning.c +++ b/lib/asn1c/s1ap/S1AP_TAIListforWarning.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAIListforWarning.h b/lib/asn1c/s1ap/S1AP_TAIListforWarning.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TAIListforWarning.h rename to lib/asn1c/s1ap/S1AP_TAIListforWarning.h index 0384fb112..80c3a67cc 100644 --- a/lib/s1ap/asn1c/S1AP_TAIListforWarning.h +++ b/lib/asn1c/s1ap/S1AP_TAIListforWarning.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAListforMDT.c b/lib/asn1c/s1ap/S1AP_TAListforMDT.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_TAListforMDT.c rename to lib/asn1c/s1ap/S1AP_TAListforMDT.c index 59e3fccc2..123cfb55a 100644 --- a/lib/s1ap/asn1c/S1AP_TAListforMDT.c +++ b/lib/asn1c/s1ap/S1AP_TAListforMDT.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TAListforMDT.h b/lib/asn1c/s1ap/S1AP_TAListforMDT.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_TAListforMDT.h rename to lib/asn1c/s1ap/S1AP_TAListforMDT.h index 45075d823..0756365de 100644 --- a/lib/s1ap/asn1c/S1AP_TAListforMDT.h +++ b/lib/asn1c/s1ap/S1AP_TAListforMDT.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TBCD-STRING.c b/lib/asn1c/s1ap/S1AP_TBCD-STRING.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TBCD-STRING.c rename to lib/asn1c/s1ap/S1AP_TBCD-STRING.c index 9b575b072..f8d75258a 100644 --- a/lib/s1ap/asn1c/S1AP_TBCD-STRING.c +++ b/lib/asn1c/s1ap/S1AP_TBCD-STRING.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TBCD-STRING.h b/lib/asn1c/s1ap/S1AP_TBCD-STRING.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TBCD-STRING.h rename to lib/asn1c/s1ap/S1AP_TBCD-STRING.h index 73e478828..44032b9c3 100644 --- a/lib/s1ap/asn1c/S1AP_TBCD-STRING.h +++ b/lib/asn1c/s1ap/S1AP_TBCD-STRING.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Target-ToSource-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_Target-ToSource-TransparentContainer.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_Target-ToSource-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_Target-ToSource-TransparentContainer.c index 20654d2a1..bd079044c 100644 --- a/lib/s1ap/asn1c/S1AP_Target-ToSource-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_Target-ToSource-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Target-ToSource-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_Target-ToSource-TransparentContainer.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Target-ToSource-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_Target-ToSource-TransparentContainer.h index e1764fd7d..f1073cd79 100644 --- a/lib/s1ap/asn1c/S1AP_Target-ToSource-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_Target-ToSource-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c index d9792c2dc..23a23a67d 100644 --- a/lib/s1ap/asn1c/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h index 6d85b4071..760feafe4 100644 --- a/lib/s1ap/asn1c/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetID.c b/lib/asn1c/s1ap/S1AP_TargetID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TargetID.c rename to lib/asn1c/s1ap/S1AP_TargetID.c index 9dfe924dd..661c00231 100644 --- a/lib/s1ap/asn1c/S1AP_TargetID.c +++ b/lib/asn1c/s1ap/S1AP_TargetID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetID.h b/lib/asn1c/s1ap/S1AP_TargetID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TargetID.h rename to lib/asn1c/s1ap/S1AP_TargetID.h index fb14f6e1f..bfb9cdef9 100644 --- a/lib/s1ap/asn1c/S1AP_TargetID.h +++ b/lib/asn1c/s1ap/S1AP_TargetID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetRNC-ID.c b/lib/asn1c/s1ap/S1AP_TargetRNC-ID.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_TargetRNC-ID.c rename to lib/asn1c/s1ap/S1AP_TargetRNC-ID.c index 2ada5d046..9a1d0a2ef 100644 --- a/lib/s1ap/asn1c/S1AP_TargetRNC-ID.c +++ b/lib/asn1c/s1ap/S1AP_TargetRNC-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetRNC-ID.h b/lib/asn1c/s1ap/S1AP_TargetRNC-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TargetRNC-ID.h rename to lib/asn1c/s1ap/S1AP_TargetRNC-ID.h index 3457b912b..d04204ddf 100644 --- a/lib/s1ap/asn1c/S1AP_TargetRNC-ID.h +++ b/lib/asn1c/s1ap/S1AP_TargetRNC-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c index 9c8159ab1..eab7fa056 100644 --- a/lib/s1ap/asn1c/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h index d2a83a82e..f0524279f 100644 --- a/lib/s1ap/asn1c/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargeteNB-ID.c b/lib/asn1c/s1ap/S1AP_TargeteNB-ID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TargeteNB-ID.c rename to lib/asn1c/s1ap/S1AP_TargeteNB-ID.c index 06e189ac7..a32425882 100644 --- a/lib/s1ap/asn1c/S1AP_TargeteNB-ID.c +++ b/lib/asn1c/s1ap/S1AP_TargeteNB-ID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargeteNB-ID.h b/lib/asn1c/s1ap/S1AP_TargeteNB-ID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TargeteNB-ID.h rename to lib/asn1c/s1ap/S1AP_TargeteNB-ID.h index c60627a3a..b25911c40 100644 --- a/lib/s1ap/asn1c/S1AP_TargeteNB-ID.h +++ b/lib/asn1c/s1ap/S1AP_TargeteNB-ID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c b/lib/asn1c/s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c rename to lib/asn1c/s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c index ba9251268..c3e254fc8 100644 --- a/lib/s1ap/asn1c/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c +++ b/lib/asn1c/s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h b/lib/asn1c/s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h rename to lib/asn1c/s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h index bc26049e8..ad33d76ac 100644 --- a/lib/s1ap/asn1c/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h +++ b/lib/asn1c/s1ap/S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Threshold-RSRP.c b/lib/asn1c/s1ap/S1AP_Threshold-RSRP.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Threshold-RSRP.c rename to lib/asn1c/s1ap/S1AP_Threshold-RSRP.c index 6c618c069..a9d34ba1a 100644 --- a/lib/s1ap/asn1c/S1AP_Threshold-RSRP.c +++ b/lib/asn1c/s1ap/S1AP_Threshold-RSRP.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Threshold-RSRP.h b/lib/asn1c/s1ap/S1AP_Threshold-RSRP.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Threshold-RSRP.h rename to lib/asn1c/s1ap/S1AP_Threshold-RSRP.h index 66ea01ac9..995c15d28 100644 --- a/lib/s1ap/asn1c/S1AP_Threshold-RSRP.h +++ b/lib/asn1c/s1ap/S1AP_Threshold-RSRP.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Threshold-RSRQ.c b/lib/asn1c/s1ap/S1AP_Threshold-RSRQ.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Threshold-RSRQ.c rename to lib/asn1c/s1ap/S1AP_Threshold-RSRQ.c index 4dd19e889..2075a6eeb 100644 --- a/lib/s1ap/asn1c/S1AP_Threshold-RSRQ.c +++ b/lib/asn1c/s1ap/S1AP_Threshold-RSRQ.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Threshold-RSRQ.h b/lib/asn1c/s1ap/S1AP_Threshold-RSRQ.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Threshold-RSRQ.h rename to lib/asn1c/s1ap/S1AP_Threshold-RSRQ.h index 31664a067..2d7c6397a 100644 --- a/lib/s1ap/asn1c/S1AP_Threshold-RSRQ.h +++ b/lib/asn1c/s1ap/S1AP_Threshold-RSRQ.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c rename to lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c index a54eac23f..868680e97 100644 --- a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c +++ b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h rename to lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h index 006b94802..50d1f0838 100644 --- a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h +++ b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell-EnhancedGranularity.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell.c b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell.c rename to lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell.c index aa61eaddb..1f5b0d4b3 100644 --- a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell.c +++ b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell.h b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell.h rename to lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell.h index a4dd2a0eb..0a68f6129 100644 --- a/lib/s1ap/asn1c/S1AP_Time-UE-StayedInCell.h +++ b/lib/asn1c/s1ap/S1AP_Time-UE-StayedInCell.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TimeSynchronisationInfo.c b/lib/asn1c/s1ap/S1AP_TimeSynchronisationInfo.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_TimeSynchronisationInfo.c rename to lib/asn1c/s1ap/S1AP_TimeSynchronisationInfo.c index 4eb30f932..8aaf84bfa 100644 --- a/lib/s1ap/asn1c/S1AP_TimeSynchronisationInfo.c +++ b/lib/asn1c/s1ap/S1AP_TimeSynchronisationInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TimeSynchronisationInfo.h b/lib/asn1c/s1ap/S1AP_TimeSynchronisationInfo.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TimeSynchronisationInfo.h rename to lib/asn1c/s1ap/S1AP_TimeSynchronisationInfo.h index 613594653..edd36d632 100644 --- a/lib/s1ap/asn1c/S1AP_TimeSynchronisationInfo.h +++ b/lib/asn1c/s1ap/S1AP_TimeSynchronisationInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TimeToWait.c b/lib/asn1c/s1ap/S1AP_TimeToWait.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TimeToWait.c rename to lib/asn1c/s1ap/S1AP_TimeToWait.c index 69f578843..1445c1f2a 100644 --- a/lib/s1ap/asn1c/S1AP_TimeToWait.c +++ b/lib/asn1c/s1ap/S1AP_TimeToWait.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TimeToWait.h b/lib/asn1c/s1ap/S1AP_TimeToWait.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TimeToWait.h rename to lib/asn1c/s1ap/S1AP_TimeToWait.h index 2583b47d1..8f121cd49 100644 --- a/lib/s1ap/asn1c/S1AP_TimeToWait.h +++ b/lib/asn1c/s1ap/S1AP_TimeToWait.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceActivation.c b/lib/asn1c/s1ap/S1AP_TraceActivation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_TraceActivation.c rename to lib/asn1c/s1ap/S1AP_TraceActivation.c index c801b554d..cdffa43cc 100644 --- a/lib/s1ap/asn1c/S1AP_TraceActivation.c +++ b/lib/asn1c/s1ap/S1AP_TraceActivation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceActivation.h b/lib/asn1c/s1ap/S1AP_TraceActivation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TraceActivation.h rename to lib/asn1c/s1ap/S1AP_TraceActivation.h index e4c786d23..a3479b479 100644 --- a/lib/s1ap/asn1c/S1AP_TraceActivation.h +++ b/lib/asn1c/s1ap/S1AP_TraceActivation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceDepth.c b/lib/asn1c/s1ap/S1AP_TraceDepth.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TraceDepth.c rename to lib/asn1c/s1ap/S1AP_TraceDepth.c index e1785324a..4929c3981 100644 --- a/lib/s1ap/asn1c/S1AP_TraceDepth.c +++ b/lib/asn1c/s1ap/S1AP_TraceDepth.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceDepth.h b/lib/asn1c/s1ap/S1AP_TraceDepth.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TraceDepth.h rename to lib/asn1c/s1ap/S1AP_TraceDepth.h index 03fcff4a1..74dfeab11 100644 --- a/lib/s1ap/asn1c/S1AP_TraceDepth.h +++ b/lib/asn1c/s1ap/S1AP_TraceDepth.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceFailureIndication.c b/lib/asn1c/s1ap/S1AP_TraceFailureIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TraceFailureIndication.c rename to lib/asn1c/s1ap/S1AP_TraceFailureIndication.c index edd0e2b5b..4cd6e5f37 100644 --- a/lib/s1ap/asn1c/S1AP_TraceFailureIndication.c +++ b/lib/asn1c/s1ap/S1AP_TraceFailureIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceFailureIndication.h b/lib/asn1c/s1ap/S1AP_TraceFailureIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TraceFailureIndication.h rename to lib/asn1c/s1ap/S1AP_TraceFailureIndication.h index 53fb2aa22..925557713 100644 --- a/lib/s1ap/asn1c/S1AP_TraceFailureIndication.h +++ b/lib/asn1c/s1ap/S1AP_TraceFailureIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceStart.c b/lib/asn1c/s1ap/S1AP_TraceStart.c similarity index 96% rename from lib/s1ap/asn1c/S1AP_TraceStart.c rename to lib/asn1c/s1ap/S1AP_TraceStart.c index 1a53ff112..50c422354 100644 --- a/lib/s1ap/asn1c/S1AP_TraceStart.c +++ b/lib/asn1c/s1ap/S1AP_TraceStart.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TraceStart.h b/lib/asn1c/s1ap/S1AP_TraceStart.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_TraceStart.h rename to lib/asn1c/s1ap/S1AP_TraceStart.h index 5918cfead..db2cb2956 100644 --- a/lib/s1ap/asn1c/S1AP_TraceStart.h +++ b/lib/asn1c/s1ap/S1AP_TraceStart.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TrafficLoadReductionIndication.c b/lib/asn1c/s1ap/S1AP_TrafficLoadReductionIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TrafficLoadReductionIndication.c rename to lib/asn1c/s1ap/S1AP_TrafficLoadReductionIndication.c index 367d4b6ce..70ad46296 100644 --- a/lib/s1ap/asn1c/S1AP_TrafficLoadReductionIndication.c +++ b/lib/asn1c/s1ap/S1AP_TrafficLoadReductionIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TrafficLoadReductionIndication.h b/lib/asn1c/s1ap/S1AP_TrafficLoadReductionIndication.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TrafficLoadReductionIndication.h rename to lib/asn1c/s1ap/S1AP_TrafficLoadReductionIndication.h index a1e644ce4..045089bf3 100644 --- a/lib/s1ap/asn1c/S1AP_TrafficLoadReductionIndication.h +++ b/lib/asn1c/s1ap/S1AP_TrafficLoadReductionIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TransportInformation.c b/lib/asn1c/s1ap/S1AP_TransportInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TransportInformation.c rename to lib/asn1c/s1ap/S1AP_TransportInformation.c index 087b971b2..0d6f12328 100644 --- a/lib/s1ap/asn1c/S1AP_TransportInformation.c +++ b/lib/asn1c/s1ap/S1AP_TransportInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TransportInformation.h b/lib/asn1c/s1ap/S1AP_TransportInformation.h similarity index 94% rename from lib/s1ap/asn1c/S1AP_TransportInformation.h rename to lib/asn1c/s1ap/S1AP_TransportInformation.h index a97dc177a..f2243c3a8 100644 --- a/lib/s1ap/asn1c/S1AP_TransportInformation.h +++ b/lib/asn1c/s1ap/S1AP_TransportInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TransportLayerAddress.c b/lib/asn1c/s1ap/S1AP_TransportLayerAddress.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TransportLayerAddress.c rename to lib/asn1c/s1ap/S1AP_TransportLayerAddress.c index fe4abaea6..c9f3b30d0 100644 --- a/lib/s1ap/asn1c/S1AP_TransportLayerAddress.c +++ b/lib/asn1c/s1ap/S1AP_TransportLayerAddress.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TransportLayerAddress.h b/lib/asn1c/s1ap/S1AP_TransportLayerAddress.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TransportLayerAddress.h rename to lib/asn1c/s1ap/S1AP_TransportLayerAddress.h index 0a140ec2d..25845dbb3 100644 --- a/lib/s1ap/asn1c/S1AP_TransportLayerAddress.h +++ b/lib/asn1c/s1ap/S1AP_TransportLayerAddress.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TriggeringMessage.c b/lib/asn1c/s1ap/S1AP_TriggeringMessage.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TriggeringMessage.c rename to lib/asn1c/s1ap/S1AP_TriggeringMessage.c index 70161698d..c43011d02 100644 --- a/lib/s1ap/asn1c/S1AP_TriggeringMessage.c +++ b/lib/asn1c/s1ap/S1AP_TriggeringMessage.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TriggeringMessage.h b/lib/asn1c/s1ap/S1AP_TriggeringMessage.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TriggeringMessage.h rename to lib/asn1c/s1ap/S1AP_TriggeringMessage.h index 2760e1546..391fc8cfe 100644 --- a/lib/s1ap/asn1c/S1AP_TriggeringMessage.h +++ b/lib/asn1c/s1ap/S1AP_TriggeringMessage.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-CommonDataTypes" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TunnelInformation.c b/lib/asn1c/s1ap/S1AP_TunnelInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_TunnelInformation.c rename to lib/asn1c/s1ap/S1AP_TunnelInformation.c index 62998e389..1e29b7774 100644 --- a/lib/s1ap/asn1c/S1AP_TunnelInformation.c +++ b/lib/asn1c/s1ap/S1AP_TunnelInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TunnelInformation.h b/lib/asn1c/s1ap/S1AP_TunnelInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_TunnelInformation.h rename to lib/asn1c/s1ap/S1AP_TunnelInformation.h index 8957b14d8..32aa3ed2a 100644 --- a/lib/s1ap/asn1c/S1AP_TunnelInformation.h +++ b/lib/asn1c/s1ap/S1AP_TunnelInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TypeOfError.c b/lib/asn1c/s1ap/S1AP_TypeOfError.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_TypeOfError.c rename to lib/asn1c/s1ap/S1AP_TypeOfError.c index 33391984c..31ed5f201 100644 --- a/lib/s1ap/asn1c/S1AP_TypeOfError.c +++ b/lib/asn1c/s1ap/S1AP_TypeOfError.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_TypeOfError.h b/lib/asn1c/s1ap/S1AP_TypeOfError.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_TypeOfError.h rename to lib/asn1c/s1ap/S1AP_TypeOfError.h index 0a124930f..5df4adc6f 100644 --- a/lib/s1ap/asn1c/S1AP_TypeOfError.h +++ b/lib/asn1c/s1ap/S1AP_TypeOfError.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-HistoryInformation.c b/lib/asn1c/s1ap/S1AP_UE-HistoryInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-HistoryInformation.c rename to lib/asn1c/s1ap/S1AP_UE-HistoryInformation.c index 3724ea8a6..11942a524 100644 --- a/lib/s1ap/asn1c/S1AP_UE-HistoryInformation.c +++ b/lib/asn1c/s1ap/S1AP_UE-HistoryInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-HistoryInformation.h b/lib/asn1c/s1ap/S1AP_UE-HistoryInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-HistoryInformation.h rename to lib/asn1c/s1ap/S1AP_UE-HistoryInformation.h index 6a05bd106..b16e5b1af 100644 --- a/lib/s1ap/asn1c/S1AP_UE-HistoryInformation.h +++ b/lib/asn1c/s1ap/S1AP_UE-HistoryInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-HistoryInformationFromTheUE.c b/lib/asn1c/s1ap/S1AP_UE-HistoryInformationFromTheUE.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-HistoryInformationFromTheUE.c rename to lib/asn1c/s1ap/S1AP_UE-HistoryInformationFromTheUE.c index 9cfb363b1..7d20bd968 100644 --- a/lib/s1ap/asn1c/S1AP_UE-HistoryInformationFromTheUE.c +++ b/lib/asn1c/s1ap/S1AP_UE-HistoryInformationFromTheUE.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-HistoryInformationFromTheUE.h b/lib/asn1c/s1ap/S1AP_UE-HistoryInformationFromTheUE.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UE-HistoryInformationFromTheUE.h rename to lib/asn1c/s1ap/S1AP_UE-HistoryInformationFromTheUE.h index 0a31b2de2..15ea26d74 100644 --- a/lib/s1ap/asn1c/S1AP_UE-HistoryInformationFromTheUE.h +++ b/lib/asn1c/s1ap/S1AP_UE-HistoryInformationFromTheUE.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container-for-extended-bands.c b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container-for-extended-bands.c rename to lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.c index 88c41a9bc..ec9faf5bb 100644 --- a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container-for-extended-bands.c +++ b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container-for-extended-bands.h b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container-for-extended-bands.h rename to lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.h index b0c407ff8..34b6fc718 100644 --- a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container-for-extended-bands.h +++ b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container-for-extended-bands.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container.c b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container.c rename to lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container.c index df2d56494..ad01476b4 100644 --- a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container.c +++ b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container.h b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container.h rename to lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container.h index 75164e9b1..c36649aa4 100644 --- a/lib/s1ap/asn1c/S1AP_UE-RLF-Report-Container.h +++ b/lib/asn1c/s1ap/S1AP_UE-RLF-Report-Container.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-RetentionInformation.c b/lib/asn1c/s1ap/S1AP_UE-RetentionInformation.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-RetentionInformation.c rename to lib/asn1c/s1ap/S1AP_UE-RetentionInformation.c index e77a8182d..749d713b4 100644 --- a/lib/s1ap/asn1c/S1AP_UE-RetentionInformation.c +++ b/lib/asn1c/s1ap/S1AP_UE-RetentionInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-RetentionInformation.h b/lib/asn1c/s1ap/S1AP_UE-RetentionInformation.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UE-RetentionInformation.h rename to lib/asn1c/s1ap/S1AP_UE-RetentionInformation.h index ed96b0c58..4f9a8e779 100644 --- a/lib/s1ap/asn1c/S1AP_UE-RetentionInformation.h +++ b/lib/asn1c/s1ap/S1AP_UE-RetentionInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-S1AP-ID-pair.c b/lib/asn1c/s1ap/S1AP_UE-S1AP-ID-pair.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-S1AP-ID-pair.c rename to lib/asn1c/s1ap/S1AP_UE-S1AP-ID-pair.c index 3573f5da2..7a68794dd 100644 --- a/lib/s1ap/asn1c/S1AP_UE-S1AP-ID-pair.c +++ b/lib/asn1c/s1ap/S1AP_UE-S1AP-ID-pair.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-S1AP-ID-pair.h b/lib/asn1c/s1ap/S1AP_UE-S1AP-ID-pair.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-S1AP-ID-pair.h rename to lib/asn1c/s1ap/S1AP_UE-S1AP-ID-pair.h index 04c9ce7a4..b81e890dd 100644 --- a/lib/s1ap/asn1c/S1AP_UE-S1AP-ID-pair.h +++ b/lib/asn1c/s1ap/S1AP_UE-S1AP-ID-pair.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-S1AP-IDs.c b/lib/asn1c/s1ap/S1AP_UE-S1AP-IDs.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-S1AP-IDs.c rename to lib/asn1c/s1ap/S1AP_UE-S1AP-IDs.c index 65e224c97..4f1f913b5 100644 --- a/lib/s1ap/asn1c/S1AP_UE-S1AP-IDs.c +++ b/lib/asn1c/s1ap/S1AP_UE-S1AP-IDs.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-S1AP-IDs.h b/lib/asn1c/s1ap/S1AP_UE-S1AP-IDs.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-S1AP-IDs.h rename to lib/asn1c/s1ap/S1AP_UE-S1AP-IDs.h index 851f35123..e33a74129 100644 --- a/lib/s1ap/asn1c/S1AP_UE-S1AP-IDs.h +++ b/lib/asn1c/s1ap/S1AP_UE-S1AP-IDs.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-Usage-Type.c b/lib/asn1c/s1ap/S1AP_UE-Usage-Type.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-Usage-Type.c rename to lib/asn1c/s1ap/S1AP_UE-Usage-Type.c index 34e2c0a52..d6be79ec7 100644 --- a/lib/s1ap/asn1c/S1AP_UE-Usage-Type.c +++ b/lib/asn1c/s1ap/S1AP_UE-Usage-Type.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-Usage-Type.h b/lib/asn1c/s1ap/S1AP_UE-Usage-Type.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-Usage-Type.h rename to lib/asn1c/s1ap/S1AP_UE-Usage-Type.h index 02ae1b18d..efd65f282 100644 --- a/lib/s1ap/asn1c/S1AP_UE-Usage-Type.h +++ b/lib/asn1c/s1ap/S1AP_UE-Usage-Type.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionItem.c b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionItem.c rename to lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.c index 446c815ba..e71e8dc46 100644 --- a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionItem.c +++ b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionItem.h b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionItem.h rename to lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.h index 73ca324c4..3bdea7ce8 100644 --- a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionItem.h +++ b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionItem.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListRes.c b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListRes.c rename to lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.c index 267bfea69..d95664231 100644 --- a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListRes.c +++ b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListRes.h b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListRes.h rename to lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.h index aaae1c890..ea15ad987 100644 --- a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListRes.h +++ b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListRes.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c rename to lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c index 44513cc93..5ab68ae57 100644 --- a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c +++ b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h rename to lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h index 01039e27d..51c76f39a 100644 --- a/lib/s1ap/asn1c/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h +++ b/lib/asn1c/s1ap/S1AP_UE-associatedLogicalS1-ConnectionListResAck.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEAggregateMaximumBitrate.c b/lib/asn1c/s1ap/S1AP_UEAggregateMaximumBitrate.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_UEAggregateMaximumBitrate.c rename to lib/asn1c/s1ap/S1AP_UEAggregateMaximumBitrate.c index 7e5012182..7d1c67412 100644 --- a/lib/s1ap/asn1c/S1AP_UEAggregateMaximumBitrate.c +++ b/lib/asn1c/s1ap/S1AP_UEAggregateMaximumBitrate.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEAggregateMaximumBitrate.h b/lib/asn1c/s1ap/S1AP_UEAggregateMaximumBitrate.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEAggregateMaximumBitrate.h rename to lib/asn1c/s1ap/S1AP_UEAggregateMaximumBitrate.h index 37c51039f..610908b12 100644 --- a/lib/s1ap/asn1c/S1AP_UEAggregateMaximumBitrate.h +++ b/lib/asn1c/s1ap/S1AP_UEAggregateMaximumBitrate.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UECapabilityInfoIndication.c b/lib/asn1c/s1ap/S1AP_UECapabilityInfoIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UECapabilityInfoIndication.c rename to lib/asn1c/s1ap/S1AP_UECapabilityInfoIndication.c index c04d7fe8c..04f8acf4c 100644 --- a/lib/s1ap/asn1c/S1AP_UECapabilityInfoIndication.c +++ b/lib/asn1c/s1ap/S1AP_UECapabilityInfoIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UECapabilityInfoIndication.h b/lib/asn1c/s1ap/S1AP_UECapabilityInfoIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UECapabilityInfoIndication.h rename to lib/asn1c/s1ap/S1AP_UECapabilityInfoIndication.h index 54876ebe5..99d765dfc 100644 --- a/lib/s1ap/asn1c/S1AP_UECapabilityInfoIndication.h +++ b/lib/asn1c/s1ap/S1AP_UECapabilityInfoIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationConfirm.c b/lib/asn1c/s1ap/S1AP_UEContextModificationConfirm.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextModificationConfirm.c rename to lib/asn1c/s1ap/S1AP_UEContextModificationConfirm.c index 8386b5adb..a522adda8 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationConfirm.c +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationConfirm.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationConfirm.h b/lib/asn1c/s1ap/S1AP_UEContextModificationConfirm.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextModificationConfirm.h rename to lib/asn1c/s1ap/S1AP_UEContextModificationConfirm.h index b637f20db..68b909276 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationConfirm.h +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationConfirm.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationFailure.c b/lib/asn1c/s1ap/S1AP_UEContextModificationFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextModificationFailure.c rename to lib/asn1c/s1ap/S1AP_UEContextModificationFailure.c index abdb353fc..7febf4ea8 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationFailure.c +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationFailure.h b/lib/asn1c/s1ap/S1AP_UEContextModificationFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextModificationFailure.h rename to lib/asn1c/s1ap/S1AP_UEContextModificationFailure.h index 62fbed056..df4bec45b 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationFailure.h +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationIndication.c b/lib/asn1c/s1ap/S1AP_UEContextModificationIndication.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextModificationIndication.c rename to lib/asn1c/s1ap/S1AP_UEContextModificationIndication.c index 66793b663..ff2f1aec4 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationIndication.c +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationIndication.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationIndication.h b/lib/asn1c/s1ap/S1AP_UEContextModificationIndication.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextModificationIndication.h rename to lib/asn1c/s1ap/S1AP_UEContextModificationIndication.h index 8a4985dea..342bd25e2 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationIndication.h +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationIndication.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationRequest.c b/lib/asn1c/s1ap/S1AP_UEContextModificationRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextModificationRequest.c rename to lib/asn1c/s1ap/S1AP_UEContextModificationRequest.c index f1968f3ff..ae41fd0dd 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationRequest.c +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationRequest.h b/lib/asn1c/s1ap/S1AP_UEContextModificationRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextModificationRequest.h rename to lib/asn1c/s1ap/S1AP_UEContextModificationRequest.h index 46eb2087a..56dd60ca5 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationRequest.h +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationResponse.c b/lib/asn1c/s1ap/S1AP_UEContextModificationResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextModificationResponse.c rename to lib/asn1c/s1ap/S1AP_UEContextModificationResponse.c index 2d28056c0..9b2f2b3c7 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationResponse.c +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextModificationResponse.h b/lib/asn1c/s1ap/S1AP_UEContextModificationResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextModificationResponse.h rename to lib/asn1c/s1ap/S1AP_UEContextModificationResponse.h index 6d176c72b..34f13b8d2 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextModificationResponse.h +++ b/lib/asn1c/s1ap/S1AP_UEContextModificationResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextReleaseCommand.c b/lib/asn1c/s1ap/S1AP_UEContextReleaseCommand.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextReleaseCommand.c rename to lib/asn1c/s1ap/S1AP_UEContextReleaseCommand.c index 57b4a5a09..f6607a204 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextReleaseCommand.c +++ b/lib/asn1c/s1ap/S1AP_UEContextReleaseCommand.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextReleaseCommand.h b/lib/asn1c/s1ap/S1AP_UEContextReleaseCommand.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextReleaseCommand.h rename to lib/asn1c/s1ap/S1AP_UEContextReleaseCommand.h index bd53a5943..34297e94a 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextReleaseCommand.h +++ b/lib/asn1c/s1ap/S1AP_UEContextReleaseCommand.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextReleaseComplete.c b/lib/asn1c/s1ap/S1AP_UEContextReleaseComplete.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextReleaseComplete.c rename to lib/asn1c/s1ap/S1AP_UEContextReleaseComplete.c index 01eb58ac2..bb80ab23b 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextReleaseComplete.c +++ b/lib/asn1c/s1ap/S1AP_UEContextReleaseComplete.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextReleaseComplete.h b/lib/asn1c/s1ap/S1AP_UEContextReleaseComplete.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextReleaseComplete.h rename to lib/asn1c/s1ap/S1AP_UEContextReleaseComplete.h index e4f8ca0c2..2e0a69a6c 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextReleaseComplete.h +++ b/lib/asn1c/s1ap/S1AP_UEContextReleaseComplete.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextReleaseRequest.c b/lib/asn1c/s1ap/S1AP_UEContextReleaseRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextReleaseRequest.c rename to lib/asn1c/s1ap/S1AP_UEContextReleaseRequest.c index 93cf27d7c..55f42adc3 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextReleaseRequest.c +++ b/lib/asn1c/s1ap/S1AP_UEContextReleaseRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextReleaseRequest.h b/lib/asn1c/s1ap/S1AP_UEContextReleaseRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextReleaseRequest.h rename to lib/asn1c/s1ap/S1AP_UEContextReleaseRequest.h index ff7a2ae62..93502b10b 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextReleaseRequest.h +++ b/lib/asn1c/s1ap/S1AP_UEContextReleaseRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextResumeFailure.c b/lib/asn1c/s1ap/S1AP_UEContextResumeFailure.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextResumeFailure.c rename to lib/asn1c/s1ap/S1AP_UEContextResumeFailure.c index 3b470ab92..68c29bf55 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextResumeFailure.c +++ b/lib/asn1c/s1ap/S1AP_UEContextResumeFailure.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextResumeFailure.h b/lib/asn1c/s1ap/S1AP_UEContextResumeFailure.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextResumeFailure.h rename to lib/asn1c/s1ap/S1AP_UEContextResumeFailure.h index 569deb823..cbf15aeb1 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextResumeFailure.h +++ b/lib/asn1c/s1ap/S1AP_UEContextResumeFailure.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextResumeRequest.c b/lib/asn1c/s1ap/S1AP_UEContextResumeRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextResumeRequest.c rename to lib/asn1c/s1ap/S1AP_UEContextResumeRequest.c index e49ff28c1..689bdeadc 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextResumeRequest.c +++ b/lib/asn1c/s1ap/S1AP_UEContextResumeRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextResumeRequest.h b/lib/asn1c/s1ap/S1AP_UEContextResumeRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextResumeRequest.h rename to lib/asn1c/s1ap/S1AP_UEContextResumeRequest.h index 295747da0..07cef7033 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextResumeRequest.h +++ b/lib/asn1c/s1ap/S1AP_UEContextResumeRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextResumeResponse.c b/lib/asn1c/s1ap/S1AP_UEContextResumeResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextResumeResponse.c rename to lib/asn1c/s1ap/S1AP_UEContextResumeResponse.c index 1744a5dac..127560076 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextResumeResponse.c +++ b/lib/asn1c/s1ap/S1AP_UEContextResumeResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextResumeResponse.h b/lib/asn1c/s1ap/S1AP_UEContextResumeResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextResumeResponse.h rename to lib/asn1c/s1ap/S1AP_UEContextResumeResponse.h index d682011c1..b47036f05 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextResumeResponse.h +++ b/lib/asn1c/s1ap/S1AP_UEContextResumeResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextSuspendRequest.c b/lib/asn1c/s1ap/S1AP_UEContextSuspendRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextSuspendRequest.c rename to lib/asn1c/s1ap/S1AP_UEContextSuspendRequest.c index f9f892c0a..a0032410e 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextSuspendRequest.c +++ b/lib/asn1c/s1ap/S1AP_UEContextSuspendRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextSuspendRequest.h b/lib/asn1c/s1ap/S1AP_UEContextSuspendRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextSuspendRequest.h rename to lib/asn1c/s1ap/S1AP_UEContextSuspendRequest.h index 95ba1f281..306dc2a33 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextSuspendRequest.h +++ b/lib/asn1c/s1ap/S1AP_UEContextSuspendRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextSuspendResponse.c b/lib/asn1c/s1ap/S1AP_UEContextSuspendResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEContextSuspendResponse.c rename to lib/asn1c/s1ap/S1AP_UEContextSuspendResponse.c index 4b21a6549..5e4ec3c3b 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextSuspendResponse.c +++ b/lib/asn1c/s1ap/S1AP_UEContextSuspendResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEContextSuspendResponse.h b/lib/asn1c/s1ap/S1AP_UEContextSuspendResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEContextSuspendResponse.h rename to lib/asn1c/s1ap/S1AP_UEContextSuspendResponse.h index 2a1c7f628..d6dad9dd7 100644 --- a/lib/s1ap/asn1c/S1AP_UEContextSuspendResponse.h +++ b/lib/asn1c/s1ap/S1AP_UEContextSuspendResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEIdentityIndexValue.c b/lib/asn1c/s1ap/S1AP_UEIdentityIndexValue.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEIdentityIndexValue.c rename to lib/asn1c/s1ap/S1AP_UEIdentityIndexValue.c index 4231d74ba..4de062fae 100644 --- a/lib/s1ap/asn1c/S1AP_UEIdentityIndexValue.c +++ b/lib/asn1c/s1ap/S1AP_UEIdentityIndexValue.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEIdentityIndexValue.h b/lib/asn1c/s1ap/S1AP_UEIdentityIndexValue.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UEIdentityIndexValue.h rename to lib/asn1c/s1ap/S1AP_UEIdentityIndexValue.h index 99ee72fda..66fcb1d21 100644 --- a/lib/s1ap/asn1c/S1AP_UEIdentityIndexValue.h +++ b/lib/asn1c/s1ap/S1AP_UEIdentityIndexValue.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEInformationTransfer.c b/lib/asn1c/s1ap/S1AP_UEInformationTransfer.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEInformationTransfer.c rename to lib/asn1c/s1ap/S1AP_UEInformationTransfer.c index 5277e70e8..b77abb122 100644 --- a/lib/s1ap/asn1c/S1AP_UEInformationTransfer.c +++ b/lib/asn1c/s1ap/S1AP_UEInformationTransfer.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEInformationTransfer.h b/lib/asn1c/s1ap/S1AP_UEInformationTransfer.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEInformationTransfer.h rename to lib/asn1c/s1ap/S1AP_UEInformationTransfer.h index 259a1c01c..02b4874fd 100644 --- a/lib/s1ap/asn1c/S1AP_UEInformationTransfer.h +++ b/lib/asn1c/s1ap/S1AP_UEInformationTransfer.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEPagingID.c b/lib/asn1c/s1ap/S1AP_UEPagingID.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEPagingID.c rename to lib/asn1c/s1ap/S1AP_UEPagingID.c index 752efbbb8..3937a61d2 100644 --- a/lib/s1ap/asn1c/S1AP_UEPagingID.c +++ b/lib/asn1c/s1ap/S1AP_UEPagingID.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEPagingID.h b/lib/asn1c/s1ap/S1AP_UEPagingID.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UEPagingID.h rename to lib/asn1c/s1ap/S1AP_UEPagingID.h index 24e76e1a8..89bcdf754 100644 --- a/lib/s1ap/asn1c/S1AP_UEPagingID.h +++ b/lib/asn1c/s1ap/S1AP_UEPagingID.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapability.c b/lib/asn1c/s1ap/S1AP_UERadioCapability.c similarity index 94% rename from lib/s1ap/asn1c/S1AP_UERadioCapability.c rename to lib/asn1c/s1ap/S1AP_UERadioCapability.c index f0af843f8..15345be7f 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapability.c +++ b/lib/asn1c/s1ap/S1AP_UERadioCapability.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapability.h b/lib/asn1c/s1ap/S1AP_UERadioCapability.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UERadioCapability.h rename to lib/asn1c/s1ap/S1AP_UERadioCapability.h index 6256b76ff..e9febc7c6 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapability.h +++ b/lib/asn1c/s1ap/S1AP_UERadioCapability.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapabilityForPaging.c b/lib/asn1c/s1ap/S1AP_UERadioCapabilityForPaging.c similarity index 95% rename from lib/s1ap/asn1c/S1AP_UERadioCapabilityForPaging.c rename to lib/asn1c/s1ap/S1AP_UERadioCapabilityForPaging.c index 46fba3ceb..ed2303499 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapabilityForPaging.c +++ b/lib/asn1c/s1ap/S1AP_UERadioCapabilityForPaging.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapabilityForPaging.h b/lib/asn1c/s1ap/S1AP_UERadioCapabilityForPaging.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UERadioCapabilityForPaging.h rename to lib/asn1c/s1ap/S1AP_UERadioCapabilityForPaging.h index 0aa8fc44c..c8e557c55 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapabilityForPaging.h +++ b/lib/asn1c/s1ap/S1AP_UERadioCapabilityForPaging.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchRequest.c b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchRequest.c rename to lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchRequest.c index a76c00746..1d30a25e0 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchRequest.c +++ b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchRequest.h b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchRequest.h rename to lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchRequest.h index f5f1f2b42..3de9e9fa4 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchRequest.h +++ b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchResponse.c b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchResponse.c rename to lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchResponse.c index 9599ba578..49e6ebda4 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchResponse.c +++ b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchResponse.h b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchResponse.h rename to lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchResponse.h index e83484fdc..bf8caced8 100644 --- a/lib/s1ap/asn1c/S1AP_UERadioCapabilityMatchResponse.h +++ b/lib/asn1c/s1ap/S1AP_UERadioCapabilityMatchResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UESecurityCapabilities.c b/lib/asn1c/s1ap/S1AP_UESecurityCapabilities.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_UESecurityCapabilities.c rename to lib/asn1c/s1ap/S1AP_UESecurityCapabilities.c index f313f328c..178d1153e 100644 --- a/lib/s1ap/asn1c/S1AP_UESecurityCapabilities.c +++ b/lib/asn1c/s1ap/S1AP_UESecurityCapabilities.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UESecurityCapabilities.h b/lib/asn1c/s1ap/S1AP_UESecurityCapabilities.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UESecurityCapabilities.h rename to lib/asn1c/s1ap/S1AP_UESecurityCapabilities.h index 093d63098..95a9c8fc3 100644 --- a/lib/s1ap/asn1c/S1AP_UESecurityCapabilities.h +++ b/lib/asn1c/s1ap/S1AP_UESecurityCapabilities.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UESidelinkAggregateMaximumBitrate.c b/lib/asn1c/s1ap/S1AP_UESidelinkAggregateMaximumBitrate.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_UESidelinkAggregateMaximumBitrate.c rename to lib/asn1c/s1ap/S1AP_UESidelinkAggregateMaximumBitrate.c index 2f9cdbef8..934d97ebf 100644 --- a/lib/s1ap/asn1c/S1AP_UESidelinkAggregateMaximumBitrate.c +++ b/lib/asn1c/s1ap/S1AP_UESidelinkAggregateMaximumBitrate.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UESidelinkAggregateMaximumBitrate.h b/lib/asn1c/s1ap/S1AP_UESidelinkAggregateMaximumBitrate.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UESidelinkAggregateMaximumBitrate.h rename to lib/asn1c/s1ap/S1AP_UESidelinkAggregateMaximumBitrate.h index 75b8f97ce..de222ebe5 100644 --- a/lib/s1ap/asn1c/S1AP_UESidelinkAggregateMaximumBitrate.h +++ b/lib/asn1c/s1ap/S1AP_UESidelinkAggregateMaximumBitrate.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEUserPlaneCIoTSupportIndicator.c b/lib/asn1c/s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEUserPlaneCIoTSupportIndicator.c rename to lib/asn1c/s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.c index 98842c3f1..2f3fec892 100644 --- a/lib/s1ap/asn1c/S1AP_UEUserPlaneCIoTSupportIndicator.c +++ b/lib/asn1c/s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UEUserPlaneCIoTSupportIndicator.h b/lib/asn1c/s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_UEUserPlaneCIoTSupportIndicator.h rename to lib/asn1c/s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.h index a5c091190..b093782ab 100644 --- a/lib/s1ap/asn1c/S1AP_UEUserPlaneCIoTSupportIndicator.h +++ b/lib/asn1c/s1ap/S1AP_UEUserPlaneCIoTSupportIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UL-CP-SecurityInformation.c b/lib/asn1c/s1ap/S1AP_UL-CP-SecurityInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_UL-CP-SecurityInformation.c rename to lib/asn1c/s1ap/S1AP_UL-CP-SecurityInformation.c index 809043e56..24317b63a 100644 --- a/lib/s1ap/asn1c/S1AP_UL-CP-SecurityInformation.c +++ b/lib/asn1c/s1ap/S1AP_UL-CP-SecurityInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UL-CP-SecurityInformation.h b/lib/asn1c/s1ap/S1AP_UL-CP-SecurityInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UL-CP-SecurityInformation.h rename to lib/asn1c/s1ap/S1AP_UL-CP-SecurityInformation.h index c735d8784..8fd80002f 100644 --- a/lib/s1ap/asn1c/S1AP_UL-CP-SecurityInformation.h +++ b/lib/asn1c/s1ap/S1AP_UL-CP-SecurityInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UL-NAS-Count.c b/lib/asn1c/s1ap/S1AP_UL-NAS-Count.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UL-NAS-Count.c rename to lib/asn1c/s1ap/S1AP_UL-NAS-Count.c index aa7de3017..afea2e04f 100644 --- a/lib/s1ap/asn1c/S1AP_UL-NAS-Count.c +++ b/lib/asn1c/s1ap/S1AP_UL-NAS-Count.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UL-NAS-Count.h b/lib/asn1c/s1ap/S1AP_UL-NAS-Count.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_UL-NAS-Count.h rename to lib/asn1c/s1ap/S1AP_UL-NAS-Count.h index 75e438e09..88a5fbd65 100644 --- a/lib/s1ap/asn1c/S1AP_UL-NAS-Count.h +++ b/lib/asn1c/s1ap/S1AP_UL-NAS-Count.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UL-NAS-MAC.c b/lib/asn1c/s1ap/S1AP_UL-NAS-MAC.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UL-NAS-MAC.c rename to lib/asn1c/s1ap/S1AP_UL-NAS-MAC.c index 848b7adca..26c739720 100644 --- a/lib/s1ap/asn1c/S1AP_UL-NAS-MAC.c +++ b/lib/asn1c/s1ap/S1AP_UL-NAS-MAC.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UL-NAS-MAC.h b/lib/asn1c/s1ap/S1AP_UL-NAS-MAC.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UL-NAS-MAC.h rename to lib/asn1c/s1ap/S1AP_UL-NAS-MAC.h index c1b033f08..0c129379b 100644 --- a/lib/s1ap/asn1c/S1AP_UL-NAS-MAC.h +++ b/lib/asn1c/s1ap/S1AP_UL-NAS-MAC.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UnsuccessfulOutcome.c b/lib/asn1c/s1ap/S1AP_UnsuccessfulOutcome.c similarity index 99% rename from lib/s1ap/asn1c/S1AP_UnsuccessfulOutcome.c rename to lib/asn1c/s1ap/S1AP_UnsuccessfulOutcome.c index 0dd240670..cbc69480e 100644 --- a/lib/s1ap/asn1c/S1AP_UnsuccessfulOutcome.c +++ b/lib/asn1c/s1ap/S1AP_UnsuccessfulOutcome.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UnsuccessfulOutcome.h b/lib/asn1c/s1ap/S1AP_UnsuccessfulOutcome.h similarity index 99% rename from lib/s1ap/asn1c/S1AP_UnsuccessfulOutcome.h rename to lib/asn1c/s1ap/S1AP_UnsuccessfulOutcome.h index 1a5240bbd..35a65a0e5 100644 --- a/lib/s1ap/asn1c/S1AP_UnsuccessfulOutcome.h +++ b/lib/asn1c/s1ap/S1AP_UnsuccessfulOutcome.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Descriptions" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkNASTransport.c b/lib/asn1c/s1ap/S1AP_UplinkNASTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UplinkNASTransport.c rename to lib/asn1c/s1ap/S1AP_UplinkNASTransport.c index 40630c5d8..e09ada999 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkNASTransport.c +++ b/lib/asn1c/s1ap/S1AP_UplinkNASTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkNASTransport.h b/lib/asn1c/s1ap/S1AP_UplinkNASTransport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UplinkNASTransport.h rename to lib/asn1c/s1ap/S1AP_UplinkNASTransport.h index 980d53c15..92184010b 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkNASTransport.h +++ b/lib/asn1c/s1ap/S1AP_UplinkNASTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkNonUEAssociatedLPPaTransport.c b/lib/asn1c/s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UplinkNonUEAssociatedLPPaTransport.c rename to lib/asn1c/s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.c index 8dda16ba6..74f792d36 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkNonUEAssociatedLPPaTransport.c +++ b/lib/asn1c/s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkNonUEAssociatedLPPaTransport.h b/lib/asn1c/s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UplinkNonUEAssociatedLPPaTransport.h rename to lib/asn1c/s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.h index b3e6da263..591b874ec 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkNonUEAssociatedLPPaTransport.h +++ b/lib/asn1c/s1ap/S1AP_UplinkNonUEAssociatedLPPaTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkS1cdma2000tunnelling.c b/lib/asn1c/s1ap/S1AP_UplinkS1cdma2000tunnelling.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UplinkS1cdma2000tunnelling.c rename to lib/asn1c/s1ap/S1AP_UplinkS1cdma2000tunnelling.c index 81111f8e9..f3e007b97 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkS1cdma2000tunnelling.c +++ b/lib/asn1c/s1ap/S1AP_UplinkS1cdma2000tunnelling.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkS1cdma2000tunnelling.h b/lib/asn1c/s1ap/S1AP_UplinkS1cdma2000tunnelling.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UplinkS1cdma2000tunnelling.h rename to lib/asn1c/s1ap/S1AP_UplinkS1cdma2000tunnelling.h index a81aa6b9c..3faa1aa68 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkS1cdma2000tunnelling.h +++ b/lib/asn1c/s1ap/S1AP_UplinkS1cdma2000tunnelling.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkUEAssociatedLPPaTransport.c b/lib/asn1c/s1ap/S1AP_UplinkUEAssociatedLPPaTransport.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_UplinkUEAssociatedLPPaTransport.c rename to lib/asn1c/s1ap/S1AP_UplinkUEAssociatedLPPaTransport.c index 2e464a50f..ae81b151c 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkUEAssociatedLPPaTransport.c +++ b/lib/asn1c/s1ap/S1AP_UplinkUEAssociatedLPPaTransport.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UplinkUEAssociatedLPPaTransport.h b/lib/asn1c/s1ap/S1AP_UplinkUEAssociatedLPPaTransport.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UplinkUEAssociatedLPPaTransport.h rename to lib/asn1c/s1ap/S1AP_UplinkUEAssociatedLPPaTransport.h index 2c6696efb..a54c6201c 100644 --- a/lib/s1ap/asn1c/S1AP_UplinkUEAssociatedLPPaTransport.h +++ b/lib/asn1c/s1ap/S1AP_UplinkUEAssociatedLPPaTransport.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UserLocationInformation.c b/lib/asn1c/s1ap/S1AP_UserLocationInformation.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_UserLocationInformation.c rename to lib/asn1c/s1ap/S1AP_UserLocationInformation.c index 0d0d2365d..d00c1f9d5 100644 --- a/lib/s1ap/asn1c/S1AP_UserLocationInformation.c +++ b/lib/asn1c/s1ap/S1AP_UserLocationInformation.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_UserLocationInformation.h b/lib/asn1c/s1ap/S1AP_UserLocationInformation.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_UserLocationInformation.h rename to lib/asn1c/s1ap/S1AP_UserLocationInformation.h index 14929e4e1..987861d4a 100644 --- a/lib/s1ap/asn1c/S1AP_UserLocationInformation.h +++ b/lib/asn1c/s1ap/S1AP_UserLocationInformation.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_V2XServicesAuthorized.c b/lib/asn1c/s1ap/S1AP_V2XServicesAuthorized.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_V2XServicesAuthorized.c rename to lib/asn1c/s1ap/S1AP_V2XServicesAuthorized.c index ae858ab6a..b51d150fb 100644 --- a/lib/s1ap/asn1c/S1AP_V2XServicesAuthorized.c +++ b/lib/asn1c/s1ap/S1AP_V2XServicesAuthorized.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_V2XServicesAuthorized.h b/lib/asn1c/s1ap/S1AP_V2XServicesAuthorized.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_V2XServicesAuthorized.h rename to lib/asn1c/s1ap/S1AP_V2XServicesAuthorized.h index 643434ae9..3657386a8 100644 --- a/lib/s1ap/asn1c/S1AP_V2XServicesAuthorized.h +++ b/lib/asn1c/s1ap/S1AP_V2XServicesAuthorized.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_VehicleUE.c b/lib/asn1c/s1ap/S1AP_VehicleUE.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_VehicleUE.c rename to lib/asn1c/s1ap/S1AP_VehicleUE.c index 25166db75..8f5d7bd9b 100644 --- a/lib/s1ap/asn1c/S1AP_VehicleUE.c +++ b/lib/asn1c/s1ap/S1AP_VehicleUE.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_VehicleUE.h b/lib/asn1c/s1ap/S1AP_VehicleUE.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_VehicleUE.h rename to lib/asn1c/s1ap/S1AP_VehicleUE.h index 445661ec6..ddd5f3137 100644 --- a/lib/s1ap/asn1c/S1AP_VehicleUE.h +++ b/lib/asn1c/s1ap/S1AP_VehicleUE.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_VoiceSupportMatchIndicator.c b/lib/asn1c/s1ap/S1AP_VoiceSupportMatchIndicator.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_VoiceSupportMatchIndicator.c rename to lib/asn1c/s1ap/S1AP_VoiceSupportMatchIndicator.c index d2119a90e..1e63b9ca2 100644 --- a/lib/s1ap/asn1c/S1AP_VoiceSupportMatchIndicator.c +++ b/lib/asn1c/s1ap/S1AP_VoiceSupportMatchIndicator.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_VoiceSupportMatchIndicator.h b/lib/asn1c/s1ap/S1AP_VoiceSupportMatchIndicator.h similarity index 97% rename from lib/s1ap/asn1c/S1AP_VoiceSupportMatchIndicator.h rename to lib/asn1c/s1ap/S1AP_VoiceSupportMatchIndicator.h index b6959f521..a5894e3be 100644 --- a/lib/s1ap/asn1c/S1AP_VoiceSupportMatchIndicator.h +++ b/lib/asn1c/s1ap/S1AP_VoiceSupportMatchIndicator.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningAreaList.c b/lib/asn1c/s1ap/S1AP_WarningAreaList.c similarity index 98% rename from lib/s1ap/asn1c/S1AP_WarningAreaList.c rename to lib/asn1c/s1ap/S1AP_WarningAreaList.c index 05ee33b71..87df31c52 100644 --- a/lib/s1ap/asn1c/S1AP_WarningAreaList.c +++ b/lib/asn1c/s1ap/S1AP_WarningAreaList.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningAreaList.h b/lib/asn1c/s1ap/S1AP_WarningAreaList.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_WarningAreaList.h rename to lib/asn1c/s1ap/S1AP_WarningAreaList.h index 4a5c2abe1..f91688eb6 100644 --- a/lib/s1ap/asn1c/S1AP_WarningAreaList.h +++ b/lib/asn1c/s1ap/S1AP_WarningAreaList.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningMessageContents.c b/lib/asn1c/s1ap/S1AP_WarningMessageContents.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_WarningMessageContents.c rename to lib/asn1c/s1ap/S1AP_WarningMessageContents.c index 12994e5d3..5261a4913 100644 --- a/lib/s1ap/asn1c/S1AP_WarningMessageContents.c +++ b/lib/asn1c/s1ap/S1AP_WarningMessageContents.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningMessageContents.h b/lib/asn1c/s1ap/S1AP_WarningMessageContents.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_WarningMessageContents.h rename to lib/asn1c/s1ap/S1AP_WarningMessageContents.h index 44a4d2cc9..600eaf1b8 100644 --- a/lib/s1ap/asn1c/S1AP_WarningMessageContents.h +++ b/lib/asn1c/s1ap/S1AP_WarningMessageContents.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningSecurityInfo.c b/lib/asn1c/s1ap/S1AP_WarningSecurityInfo.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_WarningSecurityInfo.c rename to lib/asn1c/s1ap/S1AP_WarningSecurityInfo.c index 578be7ab6..48a7075c6 100644 --- a/lib/s1ap/asn1c/S1AP_WarningSecurityInfo.c +++ b/lib/asn1c/s1ap/S1AP_WarningSecurityInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningSecurityInfo.h b/lib/asn1c/s1ap/S1AP_WarningSecurityInfo.h similarity index 96% rename from lib/s1ap/asn1c/S1AP_WarningSecurityInfo.h rename to lib/asn1c/s1ap/S1AP_WarningSecurityInfo.h index 9b044c1d3..166a41c9f 100644 --- a/lib/s1ap/asn1c/S1AP_WarningSecurityInfo.h +++ b/lib/asn1c/s1ap/S1AP_WarningSecurityInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningType.c b/lib/asn1c/s1ap/S1AP_WarningType.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_WarningType.c rename to lib/asn1c/s1ap/S1AP_WarningType.c index 2e15a16f9..b26a3a1fd 100644 --- a/lib/s1ap/asn1c/S1AP_WarningType.c +++ b/lib/asn1c/s1ap/S1AP_WarningType.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WarningType.h b/lib/asn1c/s1ap/S1AP_WarningType.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_WarningType.h rename to lib/asn1c/s1ap/S1AP_WarningType.h index 79248f716..e80634ccb 100644 --- a/lib/s1ap/asn1c/S1AP_WarningType.h +++ b/lib/asn1c/s1ap/S1AP_WarningType.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningRequest.c b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningRequest.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_WriteReplaceWarningRequest.c rename to lib/asn1c/s1ap/S1AP_WriteReplaceWarningRequest.c index c7668ad20..85c337190 100644 --- a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningRequest.c +++ b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningRequest.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningRequest.h b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningRequest.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_WriteReplaceWarningRequest.h rename to lib/asn1c/s1ap/S1AP_WriteReplaceWarningRequest.h index 1c1cd8121..412b0451c 100644 --- a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningRequest.h +++ b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningRequest.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningResponse.c b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningResponse.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_WriteReplaceWarningResponse.c rename to lib/asn1c/s1ap/S1AP_WriteReplaceWarningResponse.c index b2a21b590..953ad6fbd 100644 --- a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningResponse.c +++ b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningResponse.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningResponse.h b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningResponse.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_WriteReplaceWarningResponse.h rename to lib/asn1c/s1ap/S1AP_WriteReplaceWarningResponse.h index 4469e4e47..3bf34e7fe 100644 --- a/lib/s1ap/asn1c/S1AP_WriteReplaceWarningResponse.h +++ b/lib/asn1c/s1ap/S1AP_WriteReplaceWarningResponse.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_X2TNLConfigurationInfo.c b/lib/asn1c/s1ap/S1AP_X2TNLConfigurationInfo.c similarity index 97% rename from lib/s1ap/asn1c/S1AP_X2TNLConfigurationInfo.c rename to lib/asn1c/s1ap/S1AP_X2TNLConfigurationInfo.c index 9d929f884..d95c3f851 100644 --- a/lib/s1ap/asn1c/S1AP_X2TNLConfigurationInfo.c +++ b/lib/asn1c/s1ap/S1AP_X2TNLConfigurationInfo.c @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_X2TNLConfigurationInfo.h b/lib/asn1c/s1ap/S1AP_X2TNLConfigurationInfo.h similarity index 95% rename from lib/s1ap/asn1c/S1AP_X2TNLConfigurationInfo.h rename to lib/asn1c/s1ap/S1AP_X2TNLConfigurationInfo.h index c37bd905a..20fcf3cd3 100644 --- a/lib/s1ap/asn1c/S1AP_X2TNLConfigurationInfo.h +++ b/lib/asn1c/s1ap/S1AP_X2TNLConfigurationInfo.h @@ -1,7 +1,7 @@ /* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" - * found in "../support/r14.4.0/36413-e40.asn" + * found in "../support/s1ap-r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ diff --git a/lib/s1ap/asn1c/S1AP_asn_constant.h b/lib/asn1c/s1ap/S1AP_asn_constant.h similarity index 100% rename from lib/s1ap/asn1c/S1AP_asn_constant.h rename to lib/asn1c/s1ap/S1AP_asn_constant.h diff --git a/lib/s1ap/s1ap_asn1c.h b/lib/asn1c/s1ap_asn1c.h similarity index 99% rename from lib/s1ap/s1ap_asn1c.h rename to lib/asn1c/s1ap_asn1c.h index 355d31ee5..8d60ff6a3 100644 --- a/lib/s1ap/s1ap_asn1c.h +++ b/lib/asn1c/s1ap_asn1c.h @@ -1,9 +1,7 @@ #ifndef __S1AP_ASN1C_H__ #define __S1AP_ASN1C_H__ -#if HAVE_CONFIG_H -#include "config.h" -#endif +#include "base/base.h" #include "S1AP_Additional-GUTI.h" #include "S1AP_AdditionalCSFallbackIndicator.h" diff --git a/lib/asn1c/s1ap_decoder.c b/lib/asn1c/s1ap_decoder.c new file mode 100644 index 000000000..d692dc829 --- /dev/null +++ b/lib/asn1c/s1ap_decoder.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "s1ap_message.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_s1ap_domain + +int s1ap_decode_pdu(s1ap_message_t *message, ogs_pkbuf_t *pkbuf) +{ + asn_dec_rval_t dec_ret = {0}; + + ogs_assert(message); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); + + memset((void *)message, 0, sizeof(s1ap_message_t)); + dec_ret = aper_decode(NULL, &asn_DEF_S1AP_S1AP_PDU, (void **)&message, + pkbuf->data, pkbuf->len, 0, 0); + + if (dec_ret.code != RC_OK) + { + ogs_error("Failed to decode S1AP-PDU[%d]", dec_ret.code); + return OGS_ERROR; + } + + if (ogs_log_get_domain_level(OGS_LOG_DOMAIN) >= OGS_LOG_TRACE) + asn_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, message); + + return OGS_OK; +} diff --git a/lib/asn1c/s1ap_encoder.c b/lib/asn1c/s1ap_encoder.c new file mode 100644 index 000000000..12984724f --- /dev/null +++ b/lib/asn1c/s1ap_encoder.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "s1ap_message.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_s1ap_domain + +int s1ap_encode_pdu(ogs_pkbuf_t **pkbuf, s1ap_message_t *message) +{ + asn_enc_rval_t enc_ret = {0}; + + ogs_assert(message); + + if (ogs_log_get_domain_level(OGS_LOG_DOMAIN) >= OGS_LOG_TRACE) + asn_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, message); + + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN); + + enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_S1AP_PDU, NULL, + message, (*pkbuf)->data, MAX_SDU_LEN); + if (enc_ret.encoded < 0) + { + ogs_error("Failed to encode S1AP-PDU[%d]", (int)enc_ret.encoded); + ogs_pkbuf_free(*pkbuf); + return OGS_ERROR; + } + + ogs_pkbuf_trim(*pkbuf, (enc_ret.encoded >> 3)); + + return OGS_OK; +} diff --git a/lib/asn1c/s1ap_free.c b/lib/asn1c/s1ap_free.c new file mode 100644 index 000000000..81d841e1e --- /dev/null +++ b/lib/asn1c/s1ap_free.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "s1ap_message.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_s1ap_domain + +int s1ap_free_pdu(s1ap_message_t *message) +{ + ogs_assert(message); + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, message); + + return OGS_OK; +} diff --git a/lib/asn1c/s1ap_message.h b/lib/asn1c/s1ap_message.h new file mode 100644 index 000000000..5b82df5ee --- /dev/null +++ b/lib/asn1c/s1ap_message.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _S1AP_MESSAGE_H__ +#define _S1AP_MESSAGE_H__ + +#include "ogs-core.h" +#include "base/types.h" +#include "base/context.h" +#include "s1ap_asn1c.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Octets */ +#define S1AP_CLEAR_DATA(__dATA) \ + do { \ + ogs_assert((__dATA)); \ + if ((__dATA)->buf) \ + { \ + ogs_free((__dATA)->buf); \ + (__dATA)->buf = NULL; \ + (__dATA)->size = 0; \ + } \ + } while(0) +#define S1AP_STORE_DATA(__dST, __sRC) \ + do { \ + ogs_assert((__sRC)); \ + ogs_assert((__sRC)->buf); \ + ogs_assert((__dST)); \ + S1AP_CLEAR_DATA(__dST); \ + (__dST)->size = (__sRC)->size; \ + (__dST)->buf = ogs_calloc((__dST)->size, sizeof(uint8_t)); \ + memcpy((__dST)->buf, (__sRC)->buf, (__dST)->size); \ + } while(0) + +typedef struct S1AP_S1AP_PDU s1ap_message_t; + +int s1ap_decode_pdu(s1ap_message_t *message, ogs_pkbuf_t *pkbuf); +int s1ap_encode_pdu(ogs_pkbuf_t **pkbuf, s1ap_message_t *message); +int s1ap_free_pdu(s1ap_message_t *message); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + diff --git a/lib/s1ap/support/README.md b/lib/asn1c/support/README.md similarity index 70% rename from lib/s1ap/support/README.md rename to lib/asn1c/support/README.md index 76e936d6f..f64d7d7f4 100644 --- a/lib/s1ap/support/README.md +++ b/lib/asn1c/support/README.md @@ -1,9 +1,9 @@ Modify 36413-e40.txt to 36413-e40.asn =========================================== -user@host ~/Documents/git/nextepc/lib/s1ap/support/r14.4.0$ \ +user@host ~/Documents/git/nextgnb/lib/asn1c/support/s1ap-r14.4.0$ \ diff 36413-e40.txt 36413-e40.asn -Use brchiu git's fork for asn1c +Use velichkov git's fork for asn1c =========================================== user@host ~/Documents/git$ \ git clone https://github.com/velichkov/asn1c.git asn1c.velichkov @@ -14,30 +14,30 @@ user@host Documents/git/asn1c$ \ ASN.1 encoder/decoder =========================================== -user@host ~/Documents/git/nextepc/lib/s1ap/asn1c$ \ +user@host ~/Documents/git/nextgnb/lib/asn1c/s1ap$ \ ASN1C_PREFIX=S1AP_ ../../../../asn1c.velichkov/asn1c/asn1c -pdu=all \ -fcompound-names -findirect-choice -fno-include-deps \ - ../support/r14.4.0/36413-e40.asn + ../support/s1ap-r14.4.0/36413-e40.asn Update Files =========================================== -user@host ~/Documents/git/nextepc/lib/s1ap/s1ap/asn1c$ \ +user@host ~/Documents/git/nextgnb/lib/s1ap/s1ap/asn1c$ \ diff Makefile.am Makefile.am.libasncodec -user@host ~/Documents/git/nextepc/lib/s1ap/asn1c$ \ +user@host ~/Documents/git/nextgnb/lib/s1ap/asn1c$ \ git diff asn_internal.h Remove unnecessary files =========================================== -user@host ~/Documents/git/nextepc/lib/s1ap/s1ap/asn1c$ \ +user@host ~/Documents/git/nextgnb/lib/s1ap/s1ap/asn1c$ \ rm -f S1AP_E-RAB-IE-ContainerPairList.c \ S1AP_ProtocolError-IE-ContainerList.c \ S1AP_ProtocolIE-ContainerPair.c S1AP_ProtocolIE-FieldPair.c \ S1AP_ProtocolIE-ContainerPairList.c -user@host ~/Documents/git/nextepc/lib/s1ap/asn1c$ \ +user@host ~/Documents/git/nextgnb/lib/s1ap/asn1c$ \ rm -f Makefile.am.asn1convert Makefile.am.libasncodec -user@host ~/Documents/git/nextepc/lib/s1ap/asn1c$ \ +user@host ~/Documents/git/nextgnb/lib/s1ap/asn1c$ \ rm -f converter-example.mk converter-example.c pdu_collection.c diff --git a/lib/s1ap/support/r14.4.0/36413-e40.asn b/lib/asn1c/support/s1ap-r14.4.0/36413-e40.asn similarity index 100% rename from lib/s1ap/support/r14.4.0/36413-e40.asn rename to lib/asn1c/support/s1ap-r14.4.0/36413-e40.asn diff --git a/lib/s1ap/support/r14.4.0/36413-e40.txt b/lib/asn1c/support/s1ap-r14.4.0/36413-e40.txt similarity index 100% rename from lib/s1ap/support/r14.4.0/36413-e40.txt rename to lib/asn1c/support/s1ap-r14.4.0/36413-e40.txt diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am new file mode 100644 index 000000000..623ab81f2 --- /dev/null +++ b/lib/base/Makefile.am @@ -0,0 +1,25 @@ +## Process this file with automake to produce Makefile.in + +pkglib_LTLIBRARIES = libbase.la + +libbase_la_SOURCES = \ + base.h \ + types.h types.c \ + context.h context.c \ + $(NULL) + +libbase_la_DEPENDENCIES = \ + @OGSCORE_LIBS@ \ + $(NULL) + +libbase_la_LIBADD = \ + @OGSCORE_LIBS@ \ + $(NULL) + +AM_CPPFLAGS = \ + @OGSCORE_CFLAGS@ \ + $(NULL) + +AM_CFLAGS = \ + -Wall -Werror \ + $(NULL) diff --git a/lib/base/base.h b/lib/base/base.h new file mode 100644 index 000000000..29f23f684 --- /dev/null +++ b/lib/base/base.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NEXTEPC_BASE_H +#define NEXTEPC_BASE_H + +#include "ogs-core.h" + +#ifdef HAVE_CONFIG_H +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_URL +#undef PACKAGE_VERSION +#undef VERSION +#include "nextepc-config.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NEXTEPC_BASE_H */ diff --git a/lib/base/context.c b/lib/base/context.c new file mode 100644 index 000000000..40e79bc38 --- /dev/null +++ b/lib/base/context.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "context.h" + +int __base_s1ap_domain; +int __base_nas_domain; +int __base_gtp_domain; +int __base_fd_domain; + +static base_context_t self = { + .gtp.node.pool = 512, + .gtp.xact.pool = 512, +}; + +void base_initialize(void) +{ + ogs_log_install_domain(&__base_s1ap_domain, "s1ap", ogs_core()->log.level); + ogs_log_install_domain(&__base_nas_domain, "nas", ogs_core()->log.level); + ogs_log_install_domain(&__base_gtp_domain, "gtp", ogs_core()->log.level); + ogs_log_install_domain(&__base_fd_domain, "fd", ogs_core()->log.level); +} + +void base_finalize(void) +{ +} + +base_context_t *base_self(void) +{ + return &self; +} diff --git a/lib/base/context.h b/lib/base/context.h new file mode 100644 index 000000000..118767eb7 --- /dev/null +++ b/lib/base/context.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __BASE_CONTEXT__ +#define __BASE_CONTEXT__ + +#include "base.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern int __base_s1ap_domain; +extern int __base_nas_domain; +extern int __base_gtp_domain; +extern int __base_fd_domain; + +typedef struct base_context_s { + struct { + struct { + int pool; + } node; + struct { + int pool; + } xact; + } gtp; +} base_context_t; + +void base_initialize(void); +void base_finalize(void); +base_context_t *base_self(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __BASE_CONTEXT_H__ */ diff --git a/lib/core/src/3gpp_types.c b/lib/base/types.c similarity index 57% rename from lib/core/src/3gpp_types.c rename to lib/base/types.c index 61874ba47..1f86f83b1 100644 --- a/lib/core/src/3gpp_types.c +++ b/lib/base/types.c @@ -1,31 +1,53 @@ -#define TRACE_MODULE _types +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "core_debug.h" -#include "core_lib.h" -#include "core_pkbuf.h" - -#include "3gpp_types.h" +#include "types.h" #define PLMN_ID_DIGIT1(x) (((x) / 100) % 10) #define PLMN_ID_DIGIT2(x) (((x) / 10) % 10) #define PLMN_ID_DIGIT3(x) ((x) % 10) -c_uint16_t plmn_id_mcc(plmn_id_t *plmn_id) +uint32_t plmn_id_hexdump(plmn_id_t *plmn_id) +{ + uint32_t hex; + ogs_assert(plmn_id); + memcpy(&hex, plmn_id, sizeof *plmn_id); + hex = ntohl(hex) >> 8; + return hex; +} + +uint16_t plmn_id_mcc(plmn_id_t *plmn_id) { return plmn_id->mcc1 * 100 + plmn_id->mcc2 * 10 + plmn_id->mcc3; } -c_uint16_t plmn_id_mnc(plmn_id_t *plmn_id) +uint16_t plmn_id_mnc(plmn_id_t *plmn_id) { return plmn_id->mnc1 == 0xf ? plmn_id->mnc2 * 10 + plmn_id->mnc3 : plmn_id->mnc1 * 100 + plmn_id->mnc2 * 10 + plmn_id->mnc3; } -c_uint16_t plmn_id_mnc_len(plmn_id_t *plmn_id) +uint16_t plmn_id_mnc_len(plmn_id_t *plmn_id) { return plmn_id->mnc1 == 0xf ? 2 : 3; } void *plmn_id_build(plmn_id_t *plmn_id, - c_uint16_t mcc, c_uint16_t mnc, c_uint16_t mnc_len) + uint16_t mcc, uint16_t mnc, uint16_t mnc_len) { plmn_id->mcc1 = PLMN_ID_DIGIT1(mcc); plmn_id->mcc2 = PLMN_ID_DIGIT2(mcc); @@ -42,7 +64,7 @@ void *plmn_id_build(plmn_id_t *plmn_id, return plmn_id; } -c_int16_t apn_build(c_int8_t *dst, c_int8_t *src, c_int16_t length) +int apn_build(char *dst, char *src, int length) { int i = 0, j = 0; @@ -63,10 +85,10 @@ c_int16_t apn_build(c_int8_t *dst, c_int8_t *src, c_int16_t length) return length+1; } -c_int16_t apn_parse(c_int8_t *dst, c_int8_t *src, c_int16_t length) +int apn_parse(char *dst, char *src, int length) { int i = 0, j = 0; - c_uint8_t len = 0; + uint8_t len = 0; do { @@ -87,15 +109,15 @@ c_int16_t apn_parse(c_int8_t *dst, c_int8_t *src, c_int16_t length) /* 8.13 Protocol Configuration Options (PCO) * 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 */ -c_int16_t pco_parse(pco_t *pco, void *data, int data_len) +int pco_parse(pco_t *pco, void *data, int data_len) { pco_t *source = (pco_t *)data; - c_int16_t size = 0; + int size = 0; int i = 0; - d_assert(pco, return -1, "Null param"); - d_assert(data, return -1, "Null param"); - d_assert(data_len, return -1, "Null param"); + ogs_assert(pco); + ogs_assert(data); + ogs_assert(data_len); memset(pco, 0, sizeof(pco_t)); @@ -106,14 +128,12 @@ c_int16_t pco_parse(pco_t *pco, void *data, int data_len) while(size < data_len && i < MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID) { pco_id_t *id = &pco->ids[i]; - d_assert(size + sizeof(id->id) <= data_len, - return -1, "decode error"); + ogs_assert(size + sizeof(id->id) <= data_len); memcpy(&id->id, data + size, sizeof(id->id)); id->id = ntohs(id->id); size += sizeof(id->id); - d_assert(size + sizeof(id->len) <= data_len, - return -1, "decode error"); + ogs_assert(size + sizeof(id->len) <= data_len); memcpy(&id->len, data + size, sizeof(id->len)); size += sizeof(id->len); @@ -123,45 +143,41 @@ c_int16_t pco_parse(pco_t *pco, void *data, int data_len) i++; } pco->num_of_id = i; - d_assert(size == data_len, return -1, - "decode error(%d != %d)", size, data_len); + ogs_assert(size == data_len); return size; } -c_int16_t pco_build(void *data, int data_len, pco_t *pco) +int pco_build(void *data, int data_len, pco_t *pco) { pco_t target; - c_int16_t size = 0; + int size = 0; int i = 0; - d_assert(pco, return -1, "Null param"); - d_assert(data, return -1, "Null param"); - d_assert(data_len, return -1, "Null param"); + ogs_assert(pco); + ogs_assert(data); + ogs_assert(data_len); memcpy(&target, pco, sizeof(pco_t)); - d_assert(size + 1 <= data_len, return -1, "encode error"); + ogs_assert(size + 1 <= data_len); memcpy(data + size, &target, 1); size += 1; - d_assert(target.num_of_id <= MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID, - return -1, "encode error"); + ogs_assert(target.num_of_id <= MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID); for (i = 0; i < target.num_of_id; i++) { pco_id_t *id = &target.ids[i]; - d_assert(size + sizeof(id->id) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(id->id) <= data_len); id->id = htons(id->id); memcpy(data + size, &id->id, sizeof(id->id)); size += sizeof(id->id); - d_assert(size + sizeof(id->len) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(id->len) <= data_len); memcpy(data + size, &id->len, sizeof(id->len)); size += sizeof(id->len); - d_assert(size + id->len <= data_len, return -1, "encode error"); + ogs_assert(size + id->len <= data_len); memcpy(data + size, id->data, id->len); size += id->len; } diff --git a/lib/core/include/3gpp_types.h b/lib/base/types.h similarity index 73% rename from lib/core/include/3gpp_types.h rename to lib/base/types.h index e79330170..b18074364 100644 --- a/lib/core/include/3gpp_types.h +++ b/lib/base/types.h @@ -1,7 +1,26 @@ -#ifndef __TYPES_H__ -#define __TYPES_H__ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "core_list.h" +#ifndef __BASE_TYPES__ +#define __BASE_TYPES__ + +#include "ogs-core.h" #ifdef __cplusplus extern "C" { @@ -50,6 +69,7 @@ extern "C" { #define MAX_APN_LEN 100 #define MAX_PCO_LEN 251 +#define MAX_FILEPATH_LEN 256 #define NEXT_ID(__id, __min, __max) \ ((__id) = ((__id) == (__max) ? (__min) : ((__id) + 1))) @@ -63,31 +83,33 @@ extern "C" { /********************************** * PLMN_ID Structure */ typedef struct _plmn_id_t { -ED2(c_uint8_t mcc2:4;, - c_uint8_t mcc1:4;) -ED2(c_uint8_t mnc1:4;, - c_uint8_t mcc3:4;) -ED2(c_uint8_t mnc3:4;, - c_uint8_t mnc2:4;) +ED2(uint8_t mcc2:4;, + uint8_t mcc1:4;) +ED2(uint8_t mnc1:4;, + uint8_t mcc3:4;) +ED2(uint8_t mnc3:4;, + uint8_t mnc2:4;) } __attribute__ ((packed)) plmn_id_t; -CORE_DECLARE(c_uint16_t) plmn_id_mcc(plmn_id_t *plmn_id); -CORE_DECLARE(c_uint16_t) plmn_id_mnc(plmn_id_t *plmn_id); -CORE_DECLARE(c_uint16_t) plmn_id_mnc_len(plmn_id_t *plmn_id); +uint32_t plmn_id_hexdump(plmn_id_t *plmn_id); -CORE_DECLARE(void *) plmn_id_build(plmn_id_t *plmn_id, - c_uint16_t mcc, c_uint16_t mnc, c_uint16_t mnc_len); +uint16_t plmn_id_mcc(plmn_id_t *plmn_id); +uint16_t plmn_id_mnc(plmn_id_t *plmn_id); +uint16_t plmn_id_mnc_len(plmn_id_t *plmn_id); + +void *plmn_id_build(plmn_id_t *plmn_id, + uint16_t mcc, uint16_t mnc, uint16_t mnc_len); #define MAX_NUM_OF_TAI 16 typedef struct _tai_t { plmn_id_t plmn_id; - c_uint16_t tac; + uint16_t tac; } __attribute__ ((packed)) tai_t; typedef struct _e_cgi_t { plmn_id_t plmn_id; - c_uint32_t cell_id; /* 28 bit */ + uint32_t cell_id; /* 28 bit */ } __attribute__ ((packed)) e_cgi_t; /************************************************** @@ -99,17 +121,17 @@ typedef struct _e_cgi_t { #define IPV4V6_LEN 20 typedef struct _ip_t { union { - c_uint32_t addr; - c_uint8_t addr6[IPV6_LEN]; + uint32_t addr; + uint8_t addr6[IPV6_LEN]; struct { - c_uint32_t addr; - c_uint8_t addr6[IPV6_LEN]; + uint32_t addr; + uint8_t addr6[IPV6_LEN]; } both; }; - c_uint32_t len; -ED3(c_uint8_t ipv4:1;, - c_uint8_t ipv6:1;, - c_uint8_t reserved:6;) + uint32_t len; +ED3(uint8_t ipv4:1;, + uint8_t ipv6:1;, + uint8_t reserved:6;) } ip_t; /************************************************** @@ -123,38 +145,38 @@ typedef struct _paa_t { #define GTP_PDN_TYPE_IPV6 2 #define GTP_PDN_TYPE_IPV4V6 3 #define GTP_PDN_TYPE_NON_IP 4 -ED2(c_uint8_t spare:5;, - c_uint8_t pdn_type:3;) +ED2(uint8_t spare:5;, + uint8_t pdn_type:3;) union { /* GTP_PDN_TYPE_IPV4 */ - c_uint32_t addr; + uint32_t addr; /* GTP_PDN_TYPE_IPV6 */ struct { /* the IPv6 Prefix Length */ - c_uint8_t len; + uint8_t len; /* IPv6 Prefix and Interface Identifier */ - c_uint8_t addr6[IPV6_LEN]; + uint8_t addr6[IPV6_LEN]; }; /* GTP_PDN_TYPE_BOTH */ struct { struct { /* the IPv6 Prefix Length */ - c_uint8_t len; + uint8_t len; /* IPv6 Prefix and Interface Identifier */ - c_uint8_t addr6[IPV6_LEN]; + uint8_t addr6[IPV6_LEN]; }; - c_uint32_t addr; + uint32_t addr; } __attribute__ ((packed)) both; }; } __attribute__ ((packed)) paa_t; -#define MAX_BIT_RATE C_UINT64_C(10000000000) +#define MAX_BIT_RATE 10000000000UL typedef struct _bitrate_t { - c_uint64_t downlink; /* bits per seconds */ - c_uint64_t uplink; /* bits per seconds */ + uint64_t downlink; /* bits per seconds */ + uint64_t uplink; /* bits per seconds */ } bitrate_t; /********************************** @@ -173,21 +195,21 @@ typedef struct _qos_t { #define PDN_QCI_66 66 #define PDN_QCI_69 69 #define PDN_QCI_70 70 - c_uint8_t qci; + uint8_t qci; struct { /* Values 1 to 8 should only be assigned for services that are * authorized to receive prioritized treatment within an operator domain. * Values 9 to 15 may be assigned to resources that are authorized * by the home network and thus applicable when a UE is roaming. */ - c_uint8_t priority_level; + uint8_t priority_level; #define PDN_PRE_EMPTION_CAPABILITY_ENABLED 0 #define PDN_PRE_EMPTION_CAPABILITY_DISABLED 1 - c_uint8_t pre_emption_capability; + uint8_t pre_emption_capability; #define PDN_PRE_EMPTION_VULNERABILITY_ENABLED 0 #define PDN_PRE_EMPTION_VULNERABILITY_DISABLED 1 - c_uint8_t pre_emption_vulnerability; + uint8_t pre_emption_vulnerability; } arp; bitrate_t mbr; /* Maxmimum Bit Rate (MBR) */ @@ -199,18 +221,18 @@ typedef struct _qos_t { #define FLOW_DOWNLINK_ONLY 1 #define FLOW_UPLINK_ONLY 2 typedef struct _flow_t { - c_uint8_t direction; - c_int8_t *description; + uint8_t direction; + char *description; } flow_t; #define FLOW_FREE(__fLOW) \ do { \ if ((__fLOW)->description) \ { \ - CORE_FREE((__fLOW)->description); \ + ogs_free((__fLOW)->description); \ } \ else \ - d_assert(0,, "Null param"); \ + ogs_assert_if_reached(); \ } while(0) /********************************** @@ -218,10 +240,10 @@ typedef struct _flow_t { typedef struct _pcc_rule_t { #define PCC_RULE_TYPE_INSTALL 1 #define PCC_RULE_TYPE_REMOVE 2 - c_uint8_t type; + uint8_t type; #define MAX_PCC_RULE_NAME_LEN 256 - c_int8_t *name; + char *name; flow_t flow[MAX_NUM_OF_FLOW]; int num_of_flow; @@ -231,8 +253,8 @@ typedef struct _pcc_rule_t { #define FLOW_STATUS_ENABLED 2 #define FLOW_STATUS_DISABLED 3 #define FLOW_STATUS_REMOVE 4 - c_int8_t flow_status; - c_uint32_t precedence; + int flow_status; + uint32_t precedence; qos_t qos; } pcc_rule_t; @@ -240,13 +262,13 @@ typedef struct _pcc_rule_t { #define PCC_RULE_FREE(__pCCrULE) \ do { \ int __pCCrULE_iNDEX; \ - d_assert((__pCCrULE), break,); \ + ogs_assert((__pCCrULE)); \ if ((__pCCrULE)->name) \ { \ - CORE_FREE((__pCCrULE)->name); \ + ogs_free((__pCCrULE)->name); \ } \ else \ - d_assert(0,, "Null param"); \ + ogs_assert_if_reached(); \ for (__pCCrULE_iNDEX = 0; \ __pCCrULE_iNDEX < (__pCCrULE)->num_of_flow; __pCCrULE_iNDEX++) \ { \ @@ -258,13 +280,13 @@ typedef struct _pcc_rule_t { /********************************** * PDN Structure */ typedef struct _pdn_t { - c_uint32_t context_identifier; - c_int8_t apn[MAX_APN_LEN+1]; + uint32_t context_identifier; + char apn[MAX_APN_LEN+1]; #define HSS_PDN_TYPE_IPV4 0 #define HSS_PDN_TYPE_IPV6 1 #define HSS_PDN_TYPE_IPV4V6 2 #define HSS_PDN_TYPE_IPV4_OR_IPV6 3 - c_int8_t pdn_type; + int pdn_type; qos_t qos; bitrate_t ambr; /* APN-AMBR */ @@ -273,8 +295,8 @@ typedef struct _pdn_t { ip_t pgw_ip; } pdn_t; -CORE_DECLARE(c_int16_t) apn_build(c_int8_t *dst, c_int8_t *src, c_int16_t len); -CORE_DECLARE(c_int16_t) apn_parse(c_int8_t *dst, c_int8_t *src, c_int16_t len); +int apn_build(char *dst, char *src, int len); +int apn_parse(char *dst, char *src, int len); /************************************************** * Protocol Configuration Options Structure @@ -293,39 +315,39 @@ CORE_DECLARE(c_int16_t) apn_parse(c_int8_t *dst, c_int8_t *src, c_int16_t len); #define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d #define PCO_ID_IPV4_LINK_MTU_REQUEST 0x0010 typedef struct _pco_ipcp_options_t { - c_uint8_t type; - c_uint8_t len; - c_uint32_t addr; + uint8_t type; + uint8_t len; + uint32_t addr; } __attribute__ ((packed)) pco_ipcp_options_t; #define PCO_MAX_NUM_OF_IPCO_OPTIONS 4 typedef struct _pco_ipcp_t { - c_uint8_t code; - c_uint8_t identifier; - c_uint16_t len; + uint8_t code; + uint8_t identifier; + uint16_t len; pco_ipcp_options_t options[PCO_MAX_NUM_OF_IPCO_OPTIONS]; } __attribute__ ((packed)) pco_ipcp_t; typedef struct _pco_id_t { - c_uint16_t id; - c_uint8_t len; + uint16_t id; + uint8_t len; void *data; } pco_id_t; #define MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID 8 typedef struct _pco_t { -ED3(c_uint8_t ext:1;, - c_uint8_t spare:4;, - c_uint8_t configuration_protocol:3;) - c_uint8_t num_of_id; +ED3(uint8_t ext:1;, + uint8_t spare:4;, + uint8_t configuration_protocol:3;) + uint8_t num_of_id; pco_id_t ids[MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID]; } pco_t; -CORE_DECLARE(c_int16_t) pco_parse(pco_t *pco, void *data, int data_len); -CORE_DECLARE(c_int16_t) pco_build(void *data, int data_len, pco_t *pco); +int pco_parse(pco_t *pco, void *data, int data_len); +int pco_build(void *data, int data_len, pco_t *pco); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __3GPP_COMMON_H__ */ +#endif /* __BASE_TYPES_H__ */ diff --git a/lib/core/Makefile.am b/lib/core/Makefile.am deleted file mode 100644 index 101a51422..000000000 --- a/lib/core/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = src test - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/lib/core/include/arch/core_private_common.h b/lib/core/include/arch/core_private_common.h deleted file mode 100644 index 141c04789..000000000 --- a/lib/core/include/arch/core_private_common.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef CORE_PRIVATE_COMMON_H -#define CORE_PRIVATE_COMMON_H - -#endif /*CORE_PRIVATE_COMMON_H*/ diff --git a/lib/core/include/arch/unix/core_arch_file.h b/lib/core/include/arch/unix/core_arch_file.h deleted file mode 100644 index 39e855661..000000000 --- a/lib/core/include/arch/unix/core_arch_file.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __CORE_ARCH_FILE_H__ -#define __CORE_ARCH_FILE_H__ - -#include "core_portable.h" -#include "core_time.h" -#include "core_file.h" - -#define FILE_DEFAULT_BUFSIZE 4096 -/* For backwards-compat */ -#define FILE_BUFSIZE FILE_DEFAULT_BUFSIZE - -struct file_t { - os_file_t filedes; - char fname[MAX_FILENAME_SIZE]; - c_int32_t flags; - int eof_hit; - c_time_t timeout; - off_t filePtr; /* position in file of handle */ -}; - -typedef struct stat struct_stat; - -mode_t unix_perms2mode(file_perms_t perms); -file_perms_t unix_mode2perms(mode_t mode); - -#endif /* ! __CORE_ARCH_FILE_H__ */ - diff --git a/lib/core/include/arch/unix/core_arch_mutex.h b/lib/core/include/arch/unix/core_arch_mutex.h deleted file mode 100644 index 38d67803a..000000000 --- a/lib/core/include/arch/unix/core_arch_mutex.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __CORE_ARCH_MUTEX_H__ -#define __CORE_ARCH_MUTEX_H__ - -#include "core.h" -#include "core_mutex.h" - -typedef struct _mutex_t { - pthread_mutex_t mutex; -} mutex_t; - -#endif /* __CORE_ARCH_MUTEX_H__ */ - diff --git a/lib/core/include/arch/unix/core_arch_network.h b/lib/core/include/arch/unix/core_arch_network.h deleted file mode 100644 index 76b42a97e..000000000 --- a/lib/core/include/arch/unix/core_arch_network.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __CORE_ARCH_NETWORK_H__ -#define __CORE_ARCH_NETWORK_H__ - -#include "core_list.h" -#include "core_network.h" - -#if HAVE_NETDB_H -#include -#endif - -#if HAVE_SYS_SOCKET_H -#include -#endif - -#if HAVE_IFADDRS_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _sock_t { - lnode_t node; - - int family; - - int fd; - char ifname[IFNAMSIZ]; - - c_sockaddr_t local_addr; - c_sockaddr_t remote_addr; - - sock_handler handler; - void *data; - - c_int32_t options; -} sock_t; - -#define sock_is_option_set(skt, option) \ - (((skt)->options & (option)) == (option)) - -#define sock_set_option(skt, option, on) \ - do { \ - if (on) \ - (skt)->options |= (option); \ - else \ - (skt)->options &= ~(option); \ - } while (0) - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/lib/core/include/arch/unix/core_arch_proc.h b/lib/core/include/arch/unix/core_arch_proc.h deleted file mode 100644 index 404878be4..000000000 --- a/lib/core/include/arch/unix/core_arch_proc.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __CORE_ARCH_PROC_H__ -#define __CORE_ARCH_PROC_H__ - -#include "core_proc.h" -#include "core_semaphore.h" - -typedef struct _proc_t { - pid_t proc; - void *data; - proc_func_t start_func; - proc_func_t stop_func; - status_t exitval; - - semaphore_id sem1; - semaphore_id sem2; -} proc_t; - -#endif /* __CORE_ARCH_PROC_H__ */ - diff --git a/lib/core/include/arch/unix/core_arch_semaphore.h b/lib/core/include/arch/unix/core_arch_semaphore.h deleted file mode 100644 index fcbae58b9..000000000 --- a/lib/core/include/arch/unix/core_arch_semaphore.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __CORE_ARCH_SEMAPHORE_H__ -#define __CORE_ARCH_SEMAPHORE_H__ - -#include "core.h" -#include "core_semaphore.h" - -typedef struct _semaphore_t { - sem_t *semaphore; -} semaphore_t; - -#endif /* __CORE_ARCH_SEMAPHORE_H__ */ - diff --git a/lib/core/include/arch/unix/core_arch_thread.h b/lib/core/include/arch/unix/core_arch_thread.h deleted file mode 100644 index d75d21af8..000000000 --- a/lib/core/include/arch/unix/core_arch_thread.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __CORE_ARCH_THREAD_H__ -#define __CORE_ARCH_THREAD_H__ - -#include "core_thread.h" -#include "core_semaphore.h" - -typedef struct _thread_t { - pthread_t thread; - void *data; - thread_start_t func; - status_t exitval; - - semaphore_id semaphore; -} thread_t; - -struct threadattr_t { - pthread_attr_t attr; -}; - -#endif /* __CORE_ARCH_THREAD_H__ */ - diff --git a/lib/core/include/core.h.in b/lib/core/include/core.h.in deleted file mode 100644 index 7db7d0ff2..000000000 --- a/lib/core/include/core.h.in +++ /dev/null @@ -1,397 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __CORE_H__ -#define __CORE_H__ - -/* GENERATED FILE WARNING! DO NOT EDIT core.h - * - * You must modify core.h.in instead. - * - * And please, make an effort to stub core.hw and core.hnw in the process. - */ - -#if !defined(__GNUC__) || __GNUC__ < 2 || \ - (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\ - defined(NEXT) -#ifndef __attribute__ -#define __attribute__(__x) -#endif -#define CORE_INLINE -#else -#define CORE_INLINE __inline__ -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/** - * @file core.h - * @brief CORE Platform Definitions - */ - -/** - * @defgroup CORE Core Runtime library - * @{ - */ - -#if HAVE_SYS_TYPES_H -#include -#endif - -#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) -/* C99 7.18.4 requires that stdint.h only exposes INT64_C - * and UINT64_C for C++ implementations if this is defined: */ -#define __STDC_CONSTANT_MACROS -#endif - -#if HAVE_CTYPE_H -#include -#endif - -#if HAVE_ERRNO_H -#include -#endif - -#if HAVE_FCNTL_H -#include -#endif - -#if HAVE_NET_IF_H -#include -#endif - -#if HAVE_PTHREAD_H -#include -#endif - -#if HAVE_SIGNAL_H -#include -#endif - -#if HAVE_SEMAPHORE_H -#include -#endif - -#if HAVE_STDARG_H -#include -#endif - -#if HAVE_STDIO_H -#include -#endif - -#if HAVE_STDINT_H -#include -#endif - -#if HAVE_STDLIB_H -#include -#endif - -#if HAVE_STRING_H -#include -#endif - -#if HAVE_STRINGS_H -#include -#endif - -#if HAVE_TIME_H -#include -#endif - -#if HAVE_UNISTD_H -#include -#endif - -#if HAVE_NET_IF_DL_H -#include -#endif - -#if HAVE_NETINET_ETHER_H -#include -#endif - -#if HAVE_NETINET_IN_H -#include -#endif - -#if HAVE_NETINET_IP_H -#include -#endif - -#if HAVE_NETINET_IP6_H -#include -#endif - -#if HAVE_NETINET_IP_ICMP_H -#include -#endif - -#if HAVE_NETINET_ICMP6_H -#include -#endif - -#if HAVE_NETINET_UDP_H -#include -#endif - -#if HAVE_NETINET_TCP_H -#include -#endif - -#if HAVE_SYS_IOCTL_H -#include -#endif - -#if HAVE_SYS_PARAM_H -#include -#endif - -#if HAVE_SYS_STAT_H -#include -#endif - -#if HAVE_SYS_TIME_H -#include -#endif - -#if HAVE_SYS_WAIT_H -#include -#endif - -/* header files for PATH_MAX, _POSIX_PATH_MAX */ -#if HAVE_LIMITS_H -#include -#else -#if HAVE_SYS_SYSLIMITS_H -#include -#endif -#endif - -#if HAVE_SYS_UIO_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Typedefs that CORE needs. */ - -typedef char c_int8_t; -typedef unsigned char c_uint8_t; - -typedef @short_value@ c_int16_t; -typedef unsigned @short_value@ c_uint16_t; - -typedef @int_value@ c_int32_t; -typedef unsigned @int_value@ c_uint32_t; - -typedef @long_value@ c_int64_t; -typedef unsigned @long_value@ c_uint64_t; - -#if SIZEOF_VOIDP == 8 -typedef c_uint64_t c_uintptr_t; -typedef c_int64_t c_intptr_t; -#else -typedef c_uint32_t c_uintptr_t; -typedef c_int32_t c_intptr_t; -#endif - -/* Mechanisms to properly type numeric literals */ -@int64_literal@ -@uint64_literal@ - -@int64_t_fmt@ -@uint64_t_fmt@ -@uint64_t_hex_fmt@ - -@pid_t_fmt@ - -#ifdef INT16_MIN -#define C_INT16_MIN INT16_MIN -#else -#define C_INT16_MIN (-0x7fff - 1) -#endif - -#ifdef INT16_MAX -#define C_INT16_MAX INT16_MAX -#else -#define C_INT16_MAX (0x7fff) -#endif - -#ifdef UINT16_MAX -#define C_UINT16_MAX UINT16_MAX -#else -#define C_UINT16_MAX (0xffff) -#endif - -#ifdef INT32_MIN -#define C_INT32_MIN INT32_MIN -#else -#define C_INT32_MIN (-0x7fffffff - 1) -#endif - -#ifdef INT32_MAX -#define C_INT32_MAX INT32_MAX -#else -#define C_INT32_MAX 0x7fffffff -#endif - -#ifdef UINT32_MAX -#define C_UINT32_MAX UINT32_MAX -#else -#define C_UINT32_MAX (0xffffffffU) -#endif - -#ifdef INT64_MIN -#define C_INT64_MIN INT64_MIN -#else -#define C_INT64_MIN (C_INT64_C(-0x7fffffffffffffff) - 1) -#endif - -#ifdef INT64_MAX -#define C_INT64_MAX INT64_MAX -#else -#define C_INT64_MAX C_INT64_C(0x7fffffffffffffff) -#endif - -#ifdef UINT64_MAX -#define C_UINT64_MAX UINT64_MAX -#else -#define C_UINT64_MAX C_UINT64_C(0xffffffffffffffff) -#endif - -/* Definitions that CORE programs need to work properly. */ - -/** - * Thread callbacks from CORE functions must be declared with THREAD_FUNC, - * so that they follow the platform's calling convention. - *
- *
- * void* THREAD_FUNC my_thread_entry_fn(thread_id id, void *data);
- *
- * 
- */ -#define THREAD_FUNC - -/** - * The public CORE functions are declared with CORE_DECLARE(), so they may - * use the most appropriate calling convention. Public CORE functions with - * variable arguments must use CORE_DECLARE_NONSTD(). - * - * @remark Both the declaration and implementations must use the same macro. - * - *
- * CORE_DECLARE(rettype) core_func(args)
- * 
- * @see CORE_DECLARE_NONSTD @see CORE_DECLARE_DATA - * @remark Note that when CORE compiles the library itself, it passes the - * symbol -DCORE_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) - * to export public symbols from the dynamic library build.\n - * The user must define the CORE_DECLARE_STATIC when compiling to target - * the static CORE library on some platforms (e.g. Win32.) The public symbols - * are neither exported nor imported when CORE_DECLARE_STATIC is defined.\n - * By default, compiling an application and including the CORE public - * headers, without defining CORE_DECLARE_STATIC, will prepare the code to be - * linked to the dynamic library. - */ -#define CORE_DECLARE(type) type - -/** - * The public CORE functions using variable arguments are declared with - * CORE_DECLARE_NONSTD(), as they must follow the C language calling convention. - * @see CORE_DECLARE @see CORE_DECLARE_DATA - * @remark Both the declaration and implementations must use the same macro. - *
- *
- * CORE_DECLARE_NONSTD(rettype) core_func(args, ...);
- *
- * 
- */ -#define CORE_DECLARE_NONSTD(type) type - -/** - * The public CORE variables are declared with CORE_DECLARE_DATA. - * This assures the appropriate indirection is invoked at compile time. - * @see CORE_DECLARE @see CORE_DECLARE_NONSTD - * @remark Note that the declaration and implementations use different forms, - * but both must include the macro. - * - *
- *
- * extern CORE_DECLARE_DATA type core_variable;\n
- * CORE_DECLARE_DATA type core_variable = value;
- *
- * 
- */ -#define CORE_DECLARE_DATA - -#if defined(PATH_MAX) -#define C_PATH_MAX PATH_MAX -#elif defined(_POSIX_PATH_MAX) -#define C_PATH_MAX _POSIX_PATH_MAX -#else -#error no decision has been made on C_PATH_MAX for your platform -#endif - -/** @} */ - -/* Definitions that only Win32 programs need to compile properly. */ - -#if WORDS_BIGENDIAN -#define ED2(x1, x2) x1 x2 -#define ED3(x1, x2, x3) x1 x2 x3 -#define ED4(x1, x2, x3, x4) x1 x2 x3 x4 -#define ED5(x1, x2, x3, x4, x5) x1 x2 x3 x4 x5 -#define ED6(x1, x2, x3, x4, x5, x6) x1 x2 x3 x4 x5 x6 -#define ED7(x1, x2, x3, x4, x5, x6, x7) x1 x2 x3 x4 x5 x6 x7 -#define ED8(x1, x2, x3, x4, x5, x6, x7, x8) x1 x2 x3 x4 x5 x6 x7 x8 -#else -#define ED2(x1, x2) x2 x1 -#define ED3(x1, x2, x3) x3 x2 x1 -#define ED4(x1, x2, x3, x4) x4 x3 x2 x1 -#define ED5(x1, x2, x3, x4, x5) x5 x4 x3 x2 x1 -#define ED6(x1, x2, x3, x4, x5, x6) x6 x5 x4 x3 x2 x1 -#define ED7(x1, x2, x3, x4, x5, x6, x7) x7 x6 x5 x4 x3 x2 x1 -#define ED8(x1, x2, x3, x4, x5, x6, x7, x8) x8 x7 x6 x5 x4 x3 x2 x1 -#endif - -/** FALSE */ -#ifndef FALSE -#define FALSE 0 -#endif -/** TRUE */ -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -/* CORE_ALIGN() is only to be used to align on a power of 2 boundary */ -#define CORE_ALIGN(size, boundary) \ - (((size) + ((boundary) - 1)) & ~((boundary) - 1)) - -/** Default alignment */ -#define CORE_ALIGN_DEFAULT(size) CORE_ALIGN(size, 4) - -#ifdef __cplusplus -} -#endif - -#endif /* CORE_H */ diff --git a/lib/core/include/core_aes.h b/lib/core/include/core_aes.h deleted file mode 100644 index dc609b566..000000000 --- a/lib/core/include/core_aes.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _CORE_AES_H__ -#define _CORE_AES_H__ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define AES_BLOCK_SIZE 16 -#define MAX_KEY_BITS 256 - -#define KEYLENGTH(keybits) ((keybits)/8) -#define RKLENGTH(keybits) ((keybits)/8+28) -#define NROUNDS(keybits) ((keybits)/32+6) - -CORE_DECLARE(int) aes_setup_enc(c_uint32_t *rk, const c_uint8_t *key, - int keybits); -CORE_DECLARE(int) aes_setup_dec(c_uint32_t *rk, const c_uint8_t *key, - int keybits); - -CORE_DECLARE(void) aes_encrypt(const c_uint32_t *rk, int nrounds, - const c_uint8_t plaintext[16], c_uint8_t ciphertext[16]); -CORE_DECLARE(void) aes_decrypt(const c_uint32_t *rk, int nrounds, - const c_uint8_t ciphertext[16], c_uint8_t plaintext[16]); - -CORE_DECLARE(status_t) aes_cbc_encrypt(const c_uint8_t *key, - const c_uint32_t keybits, c_uint8_t *ivec, - const c_uint8_t *in, const c_uint32_t inlen, - c_uint8_t *out, c_uint32_t *outlen); -CORE_DECLARE(status_t) aes_cbc_decrypt(const c_uint8_t *key, - const c_uint32_t keybits, c_uint8_t *ivec, - const c_uint8_t *in, const c_uint32_t inlen, - c_uint8_t *out, c_uint32_t *outlen); - -CORE_DECLARE(status_t) aes_ctr128_encrypt(const c_uint8_t *key, - c_uint8_t *ivec, const c_uint8_t *in, const c_uint32_t inlen, - c_uint8_t *out); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/lib/core/include/core_aes_cmac.h b/lib/core/include/core_aes_cmac.h deleted file mode 100644 index d2dd36abb..000000000 --- a/lib/core/include/core_aes_cmac.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _CORE_AES_CMAC_H -#define _CORE_AES_CMAC_H - -#include "core_aes.h" - -#define AES_CMAC_DIGEST_LEN 16 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Caculate CMAC value - * - * @param cmac - * @param key - * @param msg - * @param len - * - * @return CORE_OK - * CORE_ERROR - */ -CORE_DECLARE(status_t) aes_cmac_calculate(c_uint8_t *cmac, const c_uint8_t *key, - const c_uint8_t *msg, const c_uint32_t len); - -/** - * Verify CMAC value - * - * @param cmac - * @param key - * @param msg - * @param len - * - * @return CORE_OK - * CORE_ERROR - * ERR_INVALID_CMAC - */ -#define ERR_INVALID_CMAC -2 -CORE_DECLARE(status_t) aes_cmac_verify(c_uint8_t *cmac, const c_uint8_t *key, - const c_uint8_t *msg, const c_uint32_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* ! _CORE_AES_CMAC_H */ diff --git a/lib/core/include/core_atomic.h b/lib/core/include/core_atomic.h deleted file mode 100644 index 64df2ccda..000000000 --- a/lib/core/include/core_atomic.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef __CORE_ATOMIC_H__ -#define __CORE_ATOMIC_H__ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * this function is required on some platforms to initialize the - * atomic operation's internal structures - * @param p pool - * @return APR_SUCCESS on successful completion - * @remark Programs do NOT need to call this directly. APR will call this - * automatically from apr_initialize. - * @internal - */ -CORE_DECLARE(status_t) atomic_init(); - -CORE_DECLARE(status_t) atomic_final(); - -/* - * Atomic operations on 32-bit values - * Note: Each of these functions internally implements a memory barrier - * on platforms that require it - */ - -/** - * atomically read an c_uint32_t from memory - * @param mem the pointer - */ -CORE_DECLARE(c_uint32_t) atomic_read32(volatile c_uint32_t *mem); - -/** - * atomically set an c_uint32_t in memory - * @param mem pointer to the object - * @param val value that the object will assume - */ -CORE_DECLARE(void) atomic_set32(volatile c_uint32_t *mem, c_uint32_t val); - -/** - * atomically add 'val' to an c_uint32_t - * @param mem pointer to the object - * @param val amount to add - * @return old value pointed to by mem - */ -CORE_DECLARE(c_uint32_t) atomic_add32(volatile c_uint32_t *mem, c_uint32_t val); - -/** - * atomically subtract 'val' from an c_uint32_t - * @param mem pointer to the object - * @param val amount to subtract - */ -CORE_DECLARE(void) atomic_sub32(volatile c_uint32_t *mem, c_uint32_t val); - -/** - * atomically increment an c_uint32_t by 1 - * @param mem pointer to the object - * @return old value pointed to by mem - */ -CORE_DECLARE(c_uint32_t) atomic_inc32(volatile c_uint32_t *mem); - -/** - * atomically decrement an c_uint32_t by 1 - * @param mem pointer to the atomic value - * @return zero if the value becomes zero on decrement, otherwise non-zero - */ -CORE_DECLARE(int) atomic_dec32(volatile c_uint32_t *mem); - -/** - * compare an c_uint32_t's value with 'cmp'. - * If they are the same swap the value with 'with' - * @param mem pointer to the value - * @param with what to swap it with - * @param cmp the value to compare it to - * @return the old value of *mem - */ -CORE_DECLARE(c_uint32_t) atomic_cas32(volatile c_uint32_t *mem, c_uint32_t with, - c_uint32_t cmp); - -/** - * exchange an c_uint32_t's value with 'val'. - * @param mem pointer to the value - * @param val what to swap it with - * @return the old value of *mem - */ -CORE_DECLARE(c_uint32_t) atomic_xchg32(volatile c_uint32_t *mem, - c_uint32_t val); - -/** - * compare the pointer's value with cmp. - * If they are the same swap the value with 'with' - * @param mem pointer to the pointer - * @param with what to swap it with - * @param cmp the value to compare it to - * @return the old value of the pointer - */ -CORE_DECLARE(void*) atomic_casptr(void *volatile *mem, void *with, - const void *cmp); - -/** - * exchange a pair of pointer values - * @param mem pointer to the pointer - * @param with what to swap it with - * @return the old value of the pointer - */ -CORE_DECLARE(void*) atomic_xchgptr(void *volatile *mem, void *with); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* !__CORE_ATOMIC_H__ */ diff --git a/lib/core/include/core_cond.h b/lib/core/include/core_cond.h deleted file mode 100644 index e5486e3f5..000000000 --- a/lib/core/include/core_cond.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef __CORE_COND_H__ -#define __CORE_COND_H__ - -/** - * @file cond.h - * @brief CORE Condition Variable Routines - */ - -#include "core.h" -#include "core_errno.h" -#include "core_time.h" -#include "core_mutex.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup cond Condition Variable Routines - * @ingroup CORE - * @{ - */ - -/** Opaque structure for thread condition variables */ -typedef c_uintptr_t cond_id; - -/** - * Initialize Conditional Pool - */ -CORE_DECLARE(status_t) cond_init(void); - -/** - * Finalize Conditional Pool - */ -CORE_DECLARE(status_t) cond_final(void); - -/** - * Note: destroying a condition variable (or likewise, destroying or - * clearing the pool from which a condition variable was allocated) if - * any threads are blocked waiting on it gives undefined results. - */ - -/** - * Create and initialize a condition variable that can be used to signal - * and schedule threads in a single process. - * @param id the memory address where the newly created condition variable - * will be stored. - */ -CORE_DECLARE(status_t) cond_create(cond_id *id); - -/** - * Put the active calling thread to sleep until signaled to wake up. Each - * condition variable must be associated with a mutex, and that mutex must - * be locked before calling this function, or the behavior will be - * undefined. As the calling thread is put to sleep, the given mutex - * will be simultaneously released; and as this thread wakes up the lock - * is again simultaneously acquired. - * @param id the condition variable on which to block. - * @param mid the mutex that must be locked upon entering this function, - * is released while the thread is asleep, and is again acquired before - * returning from this function. - * @remark Spurious wakeups may occur. Before and after every call to wait on - * a condition variable, the caller should test whether the condition is already - * met. - */ -CORE_DECLARE(status_t) cond_wait(cond_id id, mutex_id mid); - -/** - * Put the active calling thread to sleep until signaled to wake up or - * the timeout is reached. Each condition variable must be associated - * with a mutex, and that mutex must be locked before calling this - * function, or the behavior will be undefined. As the calling thread - * is put to sleep, the given mutex will be simultaneously released; - * and as this thread wakes up the lock is again simultaneously acquired. - * @param id the condition variable on which to block. - * @param mid the mutex that must be locked upon entering this function, - * is released while the thread is asleep, and is again acquired before - * returning from this function. - * @param timeout The amount of time in microseconds to wait. This is - * a maximum, not a minimum. If the condition is signaled, we - * will wake up before this time, otherwise the error CORE_TIMEUP - * is returned. - */ -CORE_DECLARE(status_t) cond_timedwait( - cond_id id, mutex_id mid, c_time_t timeout); - -/** - * Signals a single thread, if one exists, that is blocking on the given - * condition variable. That thread is then scheduled to wake up and acquire - * the associated mutex. Although it is not required, if predictable scheduling - * is desired, that mutex must be locked while calling this function. - * @param id the condition variable on which to produce the signal. - * @remark If no threads are waiting on the condition variable, nothing happens. - */ -CORE_DECLARE(status_t) cond_signal(cond_id id); - -/** - * Signals all threads blocking on the given condition variable. - * Each thread that was signaled is then scheduled to wake up and acquire - * the associated mutex. This will happen in a serialized manner. - * @param id the condition variable on which to produce the broadcast. - * @remark If no threads are waiting on the condition variable, nothing happens. - */ -CORE_DECLARE(status_t) cond_broadcast(cond_id id); - -/** - * Destroy the condition variable and free the associated memory. - * @param id the condition variable to destroy. - */ -CORE_DECLARE(status_t) cond_delete(cond_id id); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_COND_H__ */ diff --git a/lib/core/include/core_debug.h b/lib/core/include/core_debug.h deleted file mode 100644 index 25026c691..000000000 --- a/lib/core/include/core_debug.h +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef __CORE_DEBUG_H__ -#define __CORE_DEBUG_H__ - -#include "core.h" -#include "core_time.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifdef TRACE_MODULE -int TRACE_MODULE; -#endif - -extern int g_trace_mask; - -#define trace_level_set(__level) (TRACE_MODULE = __level); - -#define D_MSG_TYPE_NONE 0 -#define D_MSG_TYPE_RAW 1 -#define D_MSG_TYPE_TRACE 2 -#define D_MSG_TYPE_LOG 3 -#define D_MSG_TYPE_ASSERT 4 - -#define D_MSG_TO_CONSOLE 0x00000001 -#define D_MSG_TO_STDOUT 0x00000002 -#define D_MSG_TO_SYSLOG 0x00000004 -#define D_MSG_TO_NETWORK 0x00000008 -#define D_MSG_TO_FILE 0x00000010 -#define D_MSG_TO_ALL (D_MSG_TO_CONSOLE | D_MSG_TO_STDOUT | \ - D_MSG_TO_SYSLOG | D_MSG_TO_NETWORK | \ - D_MSG_TO_FILE ) - -#define D_LOG_LEVEL_NONE 0 -#define D_LOG_LEVEL_FATAL 1 -#define D_LOG_LEVEL_ERROR 2 -#define D_LOG_LEVEL_WARN 3 -#define D_LOG_LEVEL_INFO 4 -#define D_LOG_LEVEL_FULL D_LOG_LEVEL_INFO - -CORE_DECLARE(int) d_msg(int tp, int lv, c_time_t t, char *fn, int ln, - char *fmt, ...); - -/** - * Use for printing message. This always print out the message. - */ -#define d_print(fmt, ...) \ - d_msg(D_MSG_TYPE_RAW, 0, 0, NULL, 0, fmt, ## __VA_ARGS__) - -#define __MAX_HEX_BUF 128 - -/** - * Use for printing binary buffer as printable hex string. This always - * print out the message. - */ -#define d_print_hex(__buf, __buflen) do { \ - int __i = 0, __l, __off = 0; \ - char __hex[__MAX_HEX_BUF*2+__MAX_HEX_BUF/4+__MAX_HEX_BUF/32+4], *__p; \ - d_print("%d bytes hex:\r\n", __buflen); \ - while (__off < (__buflen)) { \ - __p = __hex; __p[0] = 0; \ - __l = ((__buflen) - __off) > __MAX_HEX_BUF ? \ - __MAX_HEX_BUF : (__buflen) - __off; \ - for (__i = 0; __i < __l; __i++) { \ - __p += sprintf(__p, "%02x", ((char*)(__buf))[__off+__i] & 0xff); \ - if ((__i & 0x1f) == 31) \ - __p += sprintf(__p, "\r\n"); \ - else if ((__i & 0x3) == 3) \ - __p += sprintf(__p, " "); \ - } \ - __off += __l; \ - d_print(__hex); \ - } \ - if (__i & 0x1f) d_print("\r\n"); \ -} while (0) - -/** - * Use for trace. - * Trace message shall be shown only if trace level is set equal or higher - * than __level. - */ -#define d_trace(__level, fmt, ...) \ - (!g_trace_mask || TRACE_MODULE < __level ? 0 : \ - d_msg(D_MSG_TYPE_TRACE, 0, time_now(), NULL, 0, fmt, ## __VA_ARGS__)) - -#define d_trace2(__level, fmt, ...) \ - (!g_trace_mask || TRACE_MODULE < __level ? 0 : \ - d_msg(D_MSG_TYPE_RAW, 0, 0, NULL, 0, fmt, ## __VA_ARGS__)) - -/** - * Use for trace binary buffer as printable hex string . - * Trace message shall be shown only if trace level is set equal or higher - * than __level. - */ -#define d_trace_hex(__level, __buf, __buflen) do { \ - if (g_trace_mask && TRACE_MODULE >= __level) \ - d_print_hex(__buf, __buflen); \ -} while (0) - -/** - * Informative log. - * If log level is larger than 4, - * this message is logged with informative format. - */ -#define d_info(fmt, ...) \ - d_msg(D_MSG_TYPE_LOG, D_LOG_LEVEL_INFO, time_now(), \ - __FILE__, __LINE__, fmt, ## __VA_ARGS__) - -/** - * Informative log. - * If log level is larger than 3, - * this message is logged with warning format. - */ -#define d_warn(fmt, ...) \ - d_msg(D_MSG_TYPE_LOG, D_LOG_LEVEL_WARN, time_now(), \ - __FILE__, __LINE__, fmt, ## __VA_ARGS__) - -/** - * Error log. - * If log level is larger than 2, - * this message is logged with error format. - */ -#define d_error(fmt, ...) \ - d_msg(D_MSG_TYPE_LOG, D_LOG_LEVEL_ERROR, time_now(), \ - __FILE__, __LINE__, fmt, ## __VA_ARGS__) - -/** - * Fatal error log. - * If log level is larger than 1, - * this message is logged with fatal error format. - */ -#define d_fatal(fmt, ...) \ - d_msg(D_MSG_TYPE_LOG, D_LOG_LEVEL_FATAL, time_now(), \ - __FILE__, __LINE__, fmt, ## __VA_ARGS__) - -/** - * Assertion - * this message is logged with assertion format. - */ -#define d_assert(cond, expr, fmt, ...) \ - if (!(cond)) { \ - d_msg(D_MSG_TYPE_ASSERT, 0, time_now(), __FILE__, __LINE__, \ - "!("#cond"). "fmt, ## __VA_ARGS__); \ - expr; \ - } - -status_t d_msg_console_init(int console_fd); -void d_msg_console_final(); -void d_msg_syslog_init(const char *name); -void d_msg_syslog_final(); -status_t d_msg_network_init(const char *name); -void d_msg_network_final(); -status_t d_msg_network_start(const char *file); -void d_msg_network_stop(); -void d_msg_network_final(); -status_t d_msg_file_init(const char *file); -void d_msg_file_final(); - -void d_msg_to(int to, int on_off); - -int d_msg_get_to(); - -/** - * Turn on log partially. - * level 4: d_fatal, d_error, d_warn, d_info - * level 3: d_fatal, d_error, d_warn - * level 2: d_fatal, d_error - * level 1: d_fatal - * level 0: none - */ -void d_log_set_level(int to, int level); - -int d_log_get_level(int to); - -/** - * Turn on log fully. - * All of d_info, d_warn, d_error and d_fatal will be shown. - * Equivalent to log_level(4). - */ -void d_log_full(int to); - -/** - * Turn off log fully. - * All log will not be shown. - * Equivalent to log_level(0). - */ -void d_log_off(int to); - -/** - * Turn on trace mask globally. - */ -void d_trace_global_on(); - -/** - * Turn off trace mask globally. - * Any trace of any module will not be shown although some trace module is - * turned on. - */ -void d_trace_global_off(); - -/** - * Turn on trace of specifed module with level. */ -void d_trace_level(int *mod_name, int level); - -/** - * Turn off trace of specifed module. - * Equivalent to trace_level(0). - */ -void d_trace_off(int *mod_name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_DEBUG_H__ */ diff --git a/lib/core/include/core_errno.h b/lib/core/include/core_errno.h deleted file mode 100644 index 593d6fab7..000000000 --- a/lib/core/include/core_errno.h +++ /dev/null @@ -1,1309 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __CORE_ERRNO_H__ -#define __CORE_ERRNO_H__ - -/** - * @file core_errno.h - * @brief CORE Error Codes - */ - -#include "core.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup core_errno Error Codes - * @ingroup CORE - * @{ - */ - -/** - * Type for specifying an error or status code. - */ -typedef int status_t; - -/** - * Return a human readable string describing the specified error. - * @param statcode The error code the get a string for. - * @param buf A buffer to hold the error string. - * @param bufsize Size of the buffer to hold the string. - */ -CORE_DECLARE(char *) core_strerror(status_t statcode, char *buf, - size_t bufsize); - -#if defined(DOXYGEN) -/** - * @def FROM_OS_ERROR(os_err_type syserr) - * Fold a platform specific error into an STATUS_T code. - * @return STATUS_T - * @param e The platform os error code. - * @warning macro implementation; the syserr argument may be evaluated - * multiple times. - */ -#define FROM_OS_ERROR(e) (e == 0 ? CORE_OK : e + OS_START_SYSERR) - -/** - * @def TO_OS_ERROR(STATUS_T statcode) - * @return os_err_type - * Fold an STATUS_T code back to the native platform defined error. - * @param e The STATUS_T folded platform os error code. - * @warning macro implementation; the statcode argument may be evaluated - * multiple times. If the statcode was not created by get_os_error - * or FROM_OS_ERROR, the results are undefined. - */ -#define TO_OS_ERROR(e) (e == 0 ? CORE_OK : e - OS_START_SYSERR) - -/** @def get_os_error() - * @return STATUS_T the last platform error, folded into STATUS_T, on most platforms - * @remark This retrieves errno, or calls a GetLastError() style function, and - * folds it with FROM_OS_ERROR. Some platforms (such as OS2) have no - * such mechanism, so this call may be unsupported. Do NOT use this - * call for socket errors from socket, send, recv etc! - */ - -/** @def set_os_error(e) - * Reset the last platform error, unfolded from an STATUS_T, on some platforms - * @param e The OS error folded in a prior call to FROM_OS_ERROR() - * @warning This is a macro implementation; the statcode argument may be evaluated - * multiple times. If the statcode was not created by get_os_error - * or FROM_OS_ERROR, the results are undefined. This macro sets - * errno, or calls a SetLastError() style function, unfolding statcode - * with TO_OS_ERROR. Some platforms (such as OS2) have no such - * mechanism, so this call may be unsupported. - */ - -/** @def get_netos_error() - * Return the last socket error, folded into STATUS_T, on all platforms - * @remark This retrieves errno or calls a GetLastSocketError() style function, - * and folds it with FROM_OS_ERROR. - */ - -/** @def set_netos_error(e) - * Reset the last socket error, unfolded from an STATUS_T - * @param e The socket error folded in a prior call to FROM_OS_ERROR() - * @warning This is a macro implementation; the statcode argument may be evaluated - * multiple times. If the statcode was not created by get_os_error - * or FROM_OS_ERROR, the results are undefined. This macro sets - * errno, or calls a WSASetLastError() style function, unfolding - * socketcode with TO_OS_ERROR. - */ - -#endif /* defined(DOXYGEN) */ - -/** - * OS_START_ERROR is where the CORE specific error values start. - */ -#define OS_START_ERROR 20000 -/** - * OS_ERRSPACE_SIZE is the maximum number of errors you can fit - * into one of the error/status ranges below -- except for - * OS_START_USERERR, which see. - */ -#define OS_ERRSPACE_SIZE 50000 -/** - * UTIL_ERRSPACE_SIZE is the size of the space that is reserved for - * use within core-util. This space is reserved above that used by CORE - * internally. - * @note This number MUST be smaller than OS_ERRSPACE_SIZE by a - * large enough amount that CORE has sufficient room for it's - * codes. - */ -#define UTIL_ERRSPACE_SIZE 20000 -/** - * OS_START_STATUS is where the CORE specific status codes start. - */ -#define OS_START_STATUS (OS_START_ERROR + OS_ERRSPACE_SIZE) -/** - * UTIL_START_STATUS is where CORE-Util starts defining it's - * status codes. - */ -#define UTIL_START_STATUS (OS_START_STATUS + \ - (OS_ERRSPACE_SIZE - UTIL_ERRSPACE_SIZE)) -/** - * OS_START_USERERR are reserved for applications that use CORE that - * layer their own error codes along with CORE's. Note that the - * error immediately following this one is set ten times farther - * away than usual, so that users of core have a lot of room in - * which to declare custom error codes. - * - * In general applications should try and create unique error codes. To try - * and assist in finding suitable ranges of numbers to use, the following - * ranges are known to be used by the listed applications. If your - * application defines error codes please advise the range of numbers it - * uses to dev@core.apache.org for inclusion in this list. - * - * Ranges shown are in relation to OS_START_USERERR - * - * Subversion - Defined ranges, of less than 100, at intervals of 5000 - * starting at an offset of 5000, e.g. - * +5000 to 5100, +10000 to 10100 - */ -#define OS_START_USERERR (OS_START_STATUS + OS_ERRSPACE_SIZE) -/** - * OS_START_USEERR is obsolete, defined for compatibility only. - * Use OS_START_USERERR instead. - */ -#define OS_START_USEERR OS_START_USERERR -/** - * OS_START_CANONERR is where CORE versions of errno values are defined - * on systems which don't have the corresponding errno. - */ -#define OS_START_CANONERR (OS_START_USERERR \ - + (OS_ERRSPACE_SIZE * 10)) -/** - * OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into - * STATUS_T values. - */ -#define OS_START_EAIERR (OS_START_CANONERR + OS_ERRSPACE_SIZE) -/** - * OS_START_SYSERR folds platform-specific system error values into - * STATUS_T values. - */ -#define OS_START_SYSERR (OS_START_EAIERR + OS_ERRSPACE_SIZE) - -/** - * @defgroup CORE_ERROR_map CORE Error Space - *
- * The following attempts to show the relation of the various constants
- * used for mapping CORE Status codes.
- *
- *       0
- *
- *  20,000     OS_START_ERROR
- *
- *         + OS_ERRSPACE_SIZE (50,000)
- *
- *  70,000      OS_START_STATUS
- *
- *         + OS_ERRSPACE_SIZE - UTIL_ERRSPACE_SIZE (30,000)
- *
- * 100,000      UTIL_START_STATUS
- *
- *         + UTIL_ERRSPACE_SIZE (20,000)
- *
- * 120,000      OS_START_USERERR
- *
- *         + 10 x OS_ERRSPACE_SIZE (50,000 * 10)
- *
- * 620,000      OS_START_CANONERR
- *
- *         + OS_ERRSPACE_SIZE (50,000)
- *
- * 670,000      OS_START_EAIERR
- *
- *         + OS_ERRSPACE_SIZE (50,000)
- *
- * 720,000      OS_START_SYSERR
- *
- * 
- */ - -/** no error. */ -#define CORE_OK 0 -#define CORE_ERROR -1 - -/** - * @defgroup CORE_Error CORE Error Values - *
- * CORE ERROR VALUES
- * CORE_ENOSTAT      CORE was unable to perform a stat on the file
- * CORE_ENOPOOL      CORE was not provided a pool with which to allocate memory
- * CORE_EBADDATE     CORE was given an invalid date
- * CORE_EINVALSOCK   CORE was given an invalid socket
- * CORE_ENOPROC      CORE was not given a process structure
- * CORE_ENOTIME      CORE was not given a time structure
- * CORE_ENODIR       CORE was not given a directory structure
- * CORE_ENOLOCK      CORE was not given a lock structure
- * CORE_ENOPOLL      CORE was not given a poll structure
- * CORE_ENOSOCKET    CORE was not given a socket
- * CORE_ENOTHREAD    CORE was not given a thread structure
- * CORE_ENOTHDKEY    CORE was not given a thread key structure
- * CORE_ENOSHMAVAIL  There is no more shared memory available
- * CORE_EDSOOPEN     CORE was unable to open the dso object.  For more
- *                  information call dso_error().
- * CORE_EGENERAL     General failure (specific information not available)
- * CORE_EBADIP       The specified IP address is invalid
- * CORE_EBADMASK     The specified netmask is invalid
- * CORE_ESYMNOTFOUND Could not find the requested symbol
- * CORE_ENOTENOUGHENTROPY Not enough entropy to continue
- * 
- * - *
- * CORE STATUS VALUES
- * CORE_INCHILD        Program is currently executing in the child
- * CORE_INPARENT       Program is currently executing in the parent
- * CORE_DETACH         The thread is detached
- * CORE_NOTDETACH      The thread is not detached
- * CORE_CHILD_DONE     The child has finished executing
- * CORE_CHILD_NOTDONE  The child has not finished executing
- * CORE_TIMEUP         The operation did not finish before the timeout
- * CORE_INCOMPLETE     The operation was incomplete although some processing
- *                    was performed and the results are partially valid
- * CORE_BADCH          Getopt found an option not in the option string
- * CORE_BADARG         Getopt found an option that is missing an argument
- *                    and an argument was specified in the option string
- * CORE_EOF            CORE has encountered the end of the file
- * CORE_NOTFOUND       CORE was unable to find the socket in the poll structure
- * CORE_ANONYMOUS      CORE is using anonymous shared memory
- * CORE_FILEBASED      CORE is using a file name as the key to the shared memory
- * CORE_KEYBASED       CORE is using a shared key as the key to the shared memory
- * CORE_EINIT          Ininitalizer value.  If no option has been found, but
- *                    the status variable requires a value, this should be used
- * CORE_ENOTIMPL       The CORE function has not been implemented on this
- *                    platform, either because nobody has gotten to it yet,
- *                    or the function is impossible on this platform.
- * CORE_EMISMATCH      Two passwords do not match.
- * CORE_EABSOLUTE      The given path was absolute.
- * CORE_ERELATIVE      The given path was relative.
- * CORE_EINCOMPLETE    The given path was neither relative nor absolute.
- * CORE_EABOVEROOT     The given path was above the root path.
- * CORE_EBUSY          The given lock was busy.
- * CORE_EPROC_UNKNOWN  The given process wasn't recognized by CORE
- * 
- * @{ - */ -/** @see STATUS_IS_ENOSTAT */ -#define CORE_ENOSTAT (OS_START_ERROR + 1) -/** @see STATUS_IS_ENOPOOL */ -#define CORE_ENOPOOL (OS_START_ERROR + 2) -/* empty slot: +3 */ -/** @see STATUS_IS_EBADDATE */ -#define CORE_EBADDATE (OS_START_ERROR + 4) -/** @see STATUS_IS_EINVALSOCK */ -#define CORE_EINVALSOCK (OS_START_ERROR + 5) -/** @see STATUS_IS_ENOPROC */ -#define CORE_ENOPROC (OS_START_ERROR + 6) -/** @see STATUS_IS_ENOTIME */ -#define CORE_ENOTIME (OS_START_ERROR + 7) -/** @see STATUS_IS_ENODIR */ -#define CORE_ENODIR (OS_START_ERROR + 8) -/** @see STATUS_IS_ENOLOCK */ -#define CORE_ENOLOCK (OS_START_ERROR + 9) -/** @see STATUS_IS_ENOPOLL */ -#define CORE_ENOPOLL (OS_START_ERROR + 10) -/** @see STATUS_IS_ENOSOCKET */ -#define CORE_ENOSOCKET (OS_START_ERROR + 11) -/** @see STATUS_IS_ENOTHREAD */ -#define CORE_ENOTHREAD (OS_START_ERROR + 12) -/** @see STATUS_IS_ENOTHDKEY */ -#define CORE_ENOTHDKEY (OS_START_ERROR + 13) -/** @see STATUS_IS_EGENERAL */ -#define CORE_EGENERAL (OS_START_ERROR + 14) -/** @see STATUS_IS_ENOSHMAVAIL */ -#define CORE_ENOSHMAVAIL (OS_START_ERROR + 15) -/** @see STATUS_IS_EBADIP */ -#define CORE_EBADIP (OS_START_ERROR + 16) -/** @see STATUS_IS_EBADMASK */ -#define CORE_EBADMASK (OS_START_ERROR + 17) -/* empty slot: +18 */ -/** @see STATUS_IS_EDSOPEN */ -#define CORE_EDSOOPEN (OS_START_ERROR + 19) -/** @see STATUS_IS_EABSOLUTE */ -#define CORE_EABSOLUTE (OS_START_ERROR + 20) -/** @see STATUS_IS_ERELATIVE */ -#define CORE_ERELATIVE (OS_START_ERROR + 21) -/** @see STATUS_IS_EINCOMPLETE */ -#define CORE_EINCOMPLETE (OS_START_ERROR + 22) -/** @see STATUS_IS_EABOVEROOT */ -#define CORE_EABOVEROOT (OS_START_ERROR + 23) -/** @see STATUS_IS_EBADPATH */ -#define CORE_EBADPATH (OS_START_ERROR + 24) -/** @see STATUS_IS_EPATHWILD */ -#define CORE_EPATHWILD (OS_START_ERROR + 25) -/** @see STATUS_IS_ESYMNOTFOUND */ -#define CORE_ESYMNOTFOUND (OS_START_ERROR + 26) -/** @see STATUS_IS_EPROC_UNKNOWN */ -#define CORE_EPROC_UNKNOWN (OS_START_ERROR + 27) -/** @see STATUS_IS_ENOTENOUGHENTROPY */ -#define CORE_ENOTENOUGHENTROPY (OS_START_ERROR + 28) -/** @} */ - -/** - * @defgroup STATUS_IS Status Value Tests - * @warning For any particular error condition, more than one of these tests - * may match. This is because platform-specific error codes may not - * always match the semantics of the POSIX codes these tests (and the - * corresponding CORE error codes) are named after. A notable example - * are the STATUS_IS_ENOENT and STATUS_IS_ENOTDIR tests on - * Win32 platforms. The programmer should always be aware of this and - * adjust the order of the tests accordingly. - * @{ - */ -/** - * CORE was unable to perform a stat on the file - * @warning always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_ENOSTAT(s) ((s) == CORE_ENOSTAT) -/** - * CORE was not provided a pool with which to allocate memory - * @warning always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_ENOPOOL(s) ((s) == CORE_ENOPOOL) -/** CORE was given an invalid date */ -#define STATUS_IS_EBADDATE(s) ((s) == CORE_EBADDATE) -/** CORE was given an invalid socket */ -#define STATUS_IS_EINVALSOCK(s) ((s) == CORE_EINVALSOCK) -/** CORE was not given a process structure */ -#define STATUS_IS_ENOPROC(s) ((s) == CORE_ENOPROC) -/** CORE was not given a time structure */ -#define STATUS_IS_ENOTIME(s) ((s) == CORE_ENOTIME) -/** CORE was not given a directory structure */ -#define STATUS_IS_ENODIR(s) ((s) == CORE_ENODIR) -/** CORE was not given a lock structure */ -#define STATUS_IS_ENOLOCK(s) ((s) == CORE_ENOLOCK) -/** CORE was not given a poll structure */ -#define STATUS_IS_ENOPOLL(s) ((s) == CORE_ENOPOLL) -/** CORE was not given a socket */ -#define STATUS_IS_ENOSOCKET(s) ((s) == CORE_ENOSOCKET) -/** CORE was not given a thread structure */ -#define STATUS_IS_ENOTHREAD(s) ((s) == CORE_ENOTHREAD) -/** CORE was not given a thread key structure */ -#define STATUS_IS_ENOTHDKEY(s) ((s) == CORE_ENOTHDKEY) -/** Generic Error which can not be put into another spot */ -#define STATUS_IS_EGENERAL(s) ((s) == CORE_EGENERAL) -/** There is no more shared memory available */ -#define STATUS_IS_ENOSHMAVAIL(s) ((s) == CORE_ENOSHMAVAIL) -/** The specified IP address is invalid */ -#define STATUS_IS_EBADIP(s) ((s) == CORE_EBADIP) -/** The specified netmask is invalid */ -#define STATUS_IS_EBADMASK(s) ((s) == CORE_EBADMASK) -/* empty slot: +18 */ -/** - * CORE was unable to open the dso object. - * For more information call dso_error(). - */ -#if defined(WIN32) -#define STATUS_IS_EDSOOPEN(s) ((s) == CORE_EDSOOPEN \ - || TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND) -#else -#define STATUS_IS_EDSOOPEN(s) ((s) == CORE_EDSOOPEN) -#endif -/** The given path was absolute. */ -#define STATUS_IS_EABSOLUTE(s) ((s) == CORE_EABSOLUTE) -/** The given path was relative. */ -#define STATUS_IS_ERELATIVE(s) ((s) == CORE_ERELATIVE) -/** The given path was neither relative nor absolute. */ -#define STATUS_IS_EINCOMPLETE(s) ((s) == CORE_EINCOMPLETE) -/** The given path was above the root path. */ -#define STATUS_IS_EABOVEROOT(s) ((s) == CORE_EABOVEROOT) -/** The given path was bad. */ -#define STATUS_IS_EBADPATH(s) ((s) == CORE_EBADPATH) -/** The given path contained wildcards. */ -#define STATUS_IS_EPATHWILD(s) ((s) == CORE_EPATHWILD) -/** Could not find the requested symbol. - * For more information call dso_error(). - */ -#if defined(WIN32) -#define STATUS_IS_ESYMNOTFOUND(s) ((s) == CORE_ESYMNOTFOUND \ - || TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND) -#else -#define STATUS_IS_ESYMNOTFOUND(s) ((s) == CORE_ESYMNOTFOUND) -#endif -/** The given process was not recognized by CORE. */ -#define STATUS_IS_EPROC_UNKNOWN(s) ((s) == CORE_EPROC_UNKNOWN) -/** CORE could not gather enough entropy to continue. */ -#define STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == CORE_ENOTENOUGHENTROPY) - -/** @} */ - -/** - * @addtogroup CORE_Error - * @{ - */ -/** @see STATUS_IS_INCHILD */ -#define CORE_INCHILD (OS_START_STATUS + 1) -/** @see STATUS_IS_INPARENT */ -#define CORE_INPARENT (OS_START_STATUS + 2) -/** @see STATUS_IS_DETACH */ -#define CORE_DETACH (OS_START_STATUS + 3) -/** @see STATUS_IS_NOTDETACH */ -#define CORE_NOTDETACH (OS_START_STATUS + 4) -/** @see STATUS_IS_CHILD_DONE */ -#define CORE_CHILD_DONE (OS_START_STATUS + 5) -/** @see STATUS_IS_CHILD_NOTDONE */ -#define CORE_CHILD_NOTDONE (OS_START_STATUS + 6) -/** @see STATUS_IS_TIMEUP */ -#define CORE_TIMEUP (OS_START_STATUS + 7) -/** @see STATUS_IS_INCOMPLETE */ -#define CORE_INCOMPLETE (OS_START_STATUS + 8) -/* empty slot: +9 */ -/* empty slot: +10 */ -/* empty slot: +11 */ -/** @see STATUS_IS_BADCH */ -#define CORE_BADCH (OS_START_STATUS + 12) -/** @see STATUS_IS_BADARG */ -#define CORE_BADARG (OS_START_STATUS + 13) -/** @see STATUS_IS_EOF */ -#define CORE_EOF (OS_START_STATUS + 14) -/** @see STATUS_IS_NOTFOUND */ -#define CORE_NOTFOUND (OS_START_STATUS + 15) -/* empty slot: +16 */ -/* empty slot: +17 */ -/* empty slot: +18 */ -/** @see STATUS_IS_ANONYMOUS */ -#define CORE_ANONYMOUS (OS_START_STATUS + 19) -/** @see STATUS_IS_FILEBASED */ -#define CORE_FILEBASED (OS_START_STATUS + 20) -/** @see STATUS_IS_KEYBASED */ -#define CORE_KEYBASED (OS_START_STATUS + 21) -/** @see STATUS_IS_EINIT */ -#define CORE_EINIT (OS_START_STATUS + 22) -/** @see STATUS_IS_ENOTIMPL */ -#define CORE_ENOTIMPL (OS_START_STATUS + 23) -/** @see STATUS_IS_EMISMATCH */ -#define CORE_EMISMATCH (OS_START_STATUS + 24) -/** @see STATUS_IS_EBUSY */ -#define CORE_EBUSY (OS_START_STATUS + 25) -/** @} */ - -/** - * @addtogroup STATUS_IS - * @{ - */ -/** - * Program is currently executing in the child - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code */ -#define STATUS_IS_INCHILD(s) ((s) == CORE_INCHILD) -/** - * Program is currently executing in the parent - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_INPARENT(s) ((s) == CORE_INPARENT) -/** - * The thread is detached - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_DETACH(s) ((s) == CORE_DETACH) -/** - * The thread is not detached - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_NOTDETACH(s) ((s) == CORE_NOTDETACH) -/** - * The child has finished executing - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_CHILD_DONE(s) ((s) == CORE_CHILD_DONE) -/** - * The child has not finished executing - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_CHILD_NOTDONE(s) ((s) == CORE_CHILD_NOTDONE) -/** - * The operation did not finish before the timeout - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_TIMEUP(s) ((s) == CORE_TIMEUP) -/** - * The operation was incomplete although some processing was performed - * and the results are partially valid. - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_INCOMPLETE(s) ((s) == CORE_INCOMPLETE) -/* empty slot: +9 */ -/* empty slot: +10 */ -/* empty slot: +11 */ -/** - * Getopt found an option not in the option string - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_BADCH(s) ((s) == CORE_BADCH) -/** - * Getopt found an option not in the option string and an argument was - * specified in the option string - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_BADARG(s) ((s) == CORE_BADARG) -/** - * CORE has encountered the end of the file - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_EOF(s) ((s) == CORE_EOF) -/** - * CORE was unable to find the socket in the poll structure - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_NOTFOUND(s) ((s) == CORE_NOTFOUND) -/* empty slot: +16 */ -/* empty slot: +17 */ -/* empty slot: +18 */ -/** - * CORE is using anonymous shared memory - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_ANONYMOUS(s) ((s) == CORE_ANONYMOUS) -/** - * CORE is using a file name as the key to the shared memory - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_FILEBASED(s) ((s) == CORE_FILEBASED) -/** - * CORE is using a shared key as the key to the shared memory - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_KEYBASED(s) ((s) == CORE_KEYBASED) -/** - * Ininitalizer value. If no option has been found, but - * the status variable requires a value, this should be used - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_EINIT(s) ((s) == CORE_EINIT) -/** - * The CORE function has not been implemented on this - * platform, either because nobody has gotten to it yet, - * or the function is impossible on this platform. - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_ENOTIMPL(s) ((s) == CORE_ENOTIMPL) -/** - * Two passwords do not match. - * @warning - * always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_EMISMATCH(s) ((s) == CORE_EMISMATCH) -/** - * The given lock was busy - * @warning always use this test, as platform-specific variances may meet this - * more than one error code - */ -#define STATUS_IS_EBUSY(s) ((s) == CORE_EBUSY) - -/** @} */ - -/** - * @addtogroup CORE_Error CORE Error Values - * @{ - */ -/* CORE CANONICAL ERROR VALUES */ -/** @see STATUS_IS_EACCES */ -#ifdef EACCES -#define CORE_EACCES EACCES -#else -#define CORE_EACCES (OS_START_CANONERR + 1) -#endif - -/** @see STATUS_IS_EEXIST */ -#ifdef EEXIST -#define CORE_EEXIST EEXIST -#else -#define CORE_EEXIST (OS_START_CANONERR + 2) -#endif - -/** @see STATUS_IS_ENAMETOOLONG */ -#ifdef ENAMETOOLONG -#define CORE_ENAMETOOLONG ENAMETOOLONG -#else -#define CORE_ENAMETOOLONG (OS_START_CANONERR + 3) -#endif - -/** @see STATUS_IS_ENOENT */ -#ifdef ENOENT -#define CORE_ENOENT ENOENT -#else -#define CORE_ENOENT (OS_START_CANONERR + 4) -#endif - -/** @see STATUS_IS_ENOTDIR */ -#ifdef ENOTDIR -#define CORE_ENOTDIR ENOTDIR -#else -#define CORE_ENOTDIR (OS_START_CANONERR + 5) -#endif - -/** @see STATUS_IS_ENOSPC */ -#ifdef ENOSPC -#define CORE_ENOSPC ENOSPC -#else -#define CORE_ENOSPC (OS_START_CANONERR + 6) -#endif - -/** @see STATUS_IS_ENOMEM */ -#ifdef ENOMEM -#define CORE_ENOMEM ENOMEM -#else -#define CORE_ENOMEM (OS_START_CANONERR + 7) -#endif - -/** @see STATUS_IS_EMFILE */ -#ifdef EMFILE -#define CORE_EMFILE EMFILE -#else -#define CORE_EMFILE (OS_START_CANONERR + 8) -#endif - -/** @see STATUS_IS_ENFILE */ -#ifdef ENFILE -#define CORE_ENFILE ENFILE -#else -#define CORE_ENFILE (OS_START_CANONERR + 9) -#endif - -/** @see STATUS_IS_EBADF */ -#ifdef EBADF -#define CORE_EBADF EBADF -#else -#define CORE_EBADF (OS_START_CANONERR + 10) -#endif - -/** @see STATUS_IS_EINVAL */ -#ifdef EINVAL -#define CORE_EINVAL EINVAL -#else -#define CORE_EINVAL (OS_START_CANONERR + 11) -#endif - -/** @see STATUS_IS_ESPIPE */ -#ifdef ESPIPE -#define CORE_ESPIPE ESPIPE -#else -#define CORE_ESPIPE (OS_START_CANONERR + 12) -#endif - -/** - * @see STATUS_IS_EAGAIN - * @warning use STATUS_IS_EAGAIN instead of just testing this value - */ -#ifdef EAGAIN -#define CORE_EAGAIN EAGAIN -#elif defined(EWOULDBLOCK) -#define CORE_EAGAIN EWOULDBLOCK -#else -#define CORE_EAGAIN (OS_START_CANONERR + 13) -#endif - -/** @see STATUS_IS_EINTR */ -#ifdef EINTR -#define CORE_EINTR EINTR -#else -#define CORE_EINTR (OS_START_CANONERR + 14) -#endif - -/** @see STATUS_IS_ENOTSOCK */ -#ifdef ENOTSOCK -#define CORE_ENOTSOCK ENOTSOCK -#else -#define CORE_ENOTSOCK (OS_START_CANONERR + 15) -#endif - -/** @see STATUS_IS_ECONNREFUSED */ -#ifdef ECONNREFUSED -#define CORE_ECONNREFUSED ECONNREFUSED -#else -#define CORE_ECONNREFUSED (OS_START_CANONERR + 16) -#endif - -/** @see STATUS_IS_EINPROGRESS */ -#ifdef EINPROGRESS -#define CORE_EINPROGRESS EINPROGRESS -#else -#define CORE_EINPROGRESS (OS_START_CANONERR + 17) -#endif - -/** - * @see STATUS_IS_ECONNABORTED - * @warning use STATUS_IS_ECONNABORTED instead of just testing this value - */ - -#ifdef ECONNABORTED -#define CORE_ECONNABORTED ECONNABORTED -#else -#define CORE_ECONNABORTED (OS_START_CANONERR + 18) -#endif - -/** @see STATUS_IS_ECONNRESET */ -#ifdef ECONNRESET -#define CORE_ECONNRESET ECONNRESET -#else -#define CORE_ECONNRESET (OS_START_CANONERR + 19) -#endif - -/** @see STATUS_IS_ETIMEDOUT - * @deprecated */ -#ifdef ETIMEDOUT -#define CORE_ETIMEDOUT ETIMEDOUT -#else -#define CORE_ETIMEDOUT (OS_START_CANONERR + 20) -#endif - -/** @see STATUS_IS_EHOSTUNREACH */ -#ifdef EHOSTUNREACH -#define CORE_EHOSTUNREACH EHOSTUNREACH -#else -#define CORE_EHOSTUNREACH (OS_START_CANONERR + 21) -#endif - -/** @see STATUS_IS_ENETUNREACH */ -#ifdef ENETUNREACH -#define CORE_ENETUNREACH ENETUNREACH -#else -#define CORE_ENETUNREACH (OS_START_CANONERR + 22) -#endif - -/** @see STATUS_IS_EFTYPE */ -#ifdef EFTYPE -#define CORE_EFTYPE EFTYPE -#else -#define CORE_EFTYPE (OS_START_CANONERR + 23) -#endif - -/** @see STATUS_IS_EPIPE */ -#ifdef EPIPE -#define CORE_EPIPE EPIPE -#else -#define CORE_EPIPE (OS_START_CANONERR + 24) -#endif - -/** @see STATUS_IS_EXDEV */ -#ifdef EXDEV -#define CORE_EXDEV EXDEV -#else -#define CORE_EXDEV (OS_START_CANONERR + 25) -#endif - -/** @see STATUS_IS_ENOTEMPTY */ -#ifdef ENOTEMPTY -#define CORE_ENOTEMPTY ENOTEMPTY -#else -#define CORE_ENOTEMPTY (OS_START_CANONERR + 26) -#endif - -/** @see STATUS_IS_EAFNOSUPPORT */ -#ifdef EAFNOSUPPORT -#define CORE_EAFNOSUPPORT EAFNOSUPPORT -#else -#define CORE_EAFNOSUPPORT (OS_START_CANONERR + 27) -#endif - -/** @} */ - -#if defined(OS2) && !defined(DOXYGEN) - -#define FROM_OS_ERROR(e) (e == 0 ? CORE_OK : e + OS_START_SYSERR) -#define TO_OS_ERROR(e) (e == 0 ? CORE_OK : e - OS_START_SYSERR) - -#define INCL_DOSERRORS -#define INCL_DOS - -/* Leave these undefined. - * OS2 doesn't rely on the errno concept. - * The API calls always return a result codes which - * should be filtered through FROM_OS_ERROR(). - * - * #define get_os_error() (FROM_OS_ERROR(GetLastError())) - * #define set_os_error(e) (SetLastError(TO_OS_ERROR(e))) - */ - -/* A special case, only socket calls require this; - */ -#define get_netos_error() (FROM_OS_ERROR(errno)) -#define set_netos_error(e) (errno = TO_OS_ERROR(e)) - -/* And this needs to be greped away for good: - */ -#define OS2_STATUS(e) (FROM_OS_ERROR(e)) - -/* These can't sit in a private header, so in spite of the extra size, - * they need to be made available here. - */ -#define SOCBASEERR 10000 -#define SOCEPERM (SOCBASEERR+1) /* Not owner */ -#define SOCESRCH (SOCBASEERR+3) /* No such process */ -#define SOCEINTR (SOCBASEERR+4) /* Interrupted system call */ -#define SOCENXIO (SOCBASEERR+6) /* No such device or address */ -#define SOCEBADF (SOCBASEERR+9) /* Bad file number */ -#define SOCEACCES (SOCBASEERR+13) /* Permission denied */ -#define SOCEFAULT (SOCBASEERR+14) /* Bad address */ -#define SOCEINVAL (SOCBASEERR+22) /* Invalid argument */ -#define SOCEMFILE (SOCBASEERR+24) /* Too many open files */ -#define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */ -#define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */ -#define SOCEWOULDBLOCK (SOCBASEERR+35) /* Operation would block */ -#define SOCEINPROGRESS (SOCBASEERR+36) /* Operation now in progress */ -#define SOCEALREADY (SOCBASEERR+37) /* Operation already in progress */ -#define SOCENOTSOCK (SOCBASEERR+38) /* Socket operation on non-socket */ -#define SOCEDESTADDRREQ (SOCBASEERR+39) /* Destination address required */ -#define SOCEMSGSIZE (SOCBASEERR+40) /* Message too long */ -#define SOCEPROTOTYPE (SOCBASEERR+41) /* Protocol wrong type for socket */ -#define SOCENOPROTOOPT (SOCBASEERR+42) /* Protocol not available */ -#define SOCEPROTONOSUPPORT (SOCBASEERR+43) /* Protocol not supported */ -#define SOCESOCKTNOSUPPORT (SOCBASEERR+44) /* Socket type not supported */ -#define SOCEOPNOTSUPP (SOCBASEERR+45) /* Operation not supported on socket */ -#define SOCEPFNOSUPPORT (SOCBASEERR+46) /* Protocol family not supported */ -#define SOCEAFNOSUPPORT (SOCBASEERR+47) /* Address family not supported by protocol family */ -#define SOCEADDRINUSE (SOCBASEERR+48) /* Address already in use */ -#define SOCEADDRNOTAVAIL (SOCBASEERR+49) /* Can't assign requested address */ -#define SOCENETDOWN (SOCBASEERR+50) /* Network is down */ -#define SOCENETUNREACH (SOCBASEERR+51) /* Network is unreachable */ -#define SOCENETRESET (SOCBASEERR+52) /* Network dropped connection on reset */ -#define SOCECONNABORTED (SOCBASEERR+53) /* Software caused connection abort */ -#define SOCECONNRESET (SOCBASEERR+54) /* Connection reset by peer */ -#define SOCENOBUFS (SOCBASEERR+55) /* No buffer space available */ -#define SOCEISCONN (SOCBASEERR+56) /* Socket is already connected */ -#define SOCENOTCONN (SOCBASEERR+57) /* Socket is not connected */ -#define SOCESHUTDOWN (SOCBASEERR+58) /* Can't send after socket shutdown */ -#define SOCETOOMANYREFS (SOCBASEERR+59) /* Too many references: can't splice */ -#define SOCETIMEDOUT (SOCBASEERR+60) /* Connection timed out */ -#define SOCECONNREFUSED (SOCBASEERR+61) /* Connection refused */ -#define SOCELOOP (SOCBASEERR+62) /* Too many levels of symbolic links */ -#define SOCENAMETOOLONG (SOCBASEERR+63) /* File name too long */ -#define SOCEHOSTDOWN (SOCBASEERR+64) /* Host is down */ -#define SOCEHOSTUNREACH (SOCBASEERR+65) /* No route to host */ -#define SOCENOTEMPTY (SOCBASEERR+66) /* Directory not empty */ - -/* CORE CANONICAL ERROR TESTS */ -#define STATUS_IS_EACCES(s) ((s) == CORE_EACCES \ - || (s) == OS_START_SYSERR + ERROR_ACCESS_DENIED \ - || (s) == OS_START_SYSERR + ERROR_SHARING_VIOLATION) -#define STATUS_IS_EEXIST(s) ((s) == CORE_EEXIST \ - || (s) == OS_START_SYSERR + ERROR_OPEN_FAILED \ - || (s) == OS_START_SYSERR + ERROR_FILE_EXISTS \ - || (s) == OS_START_SYSERR + ERROR_ALREADY_EXISTS \ - || (s) == OS_START_SYSERR + ERROR_ACCESS_DENIED) -#define STATUS_IS_ENAMETOOLONG(s) ((s) == CORE_ENAMETOOLONG \ - || (s) == OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \ - || (s) == OS_START_SYSERR + SOCENAMETOOLONG) -#define STATUS_IS_ENOENT(s) ((s) == CORE_ENOENT \ - || (s) == OS_START_SYSERR + ERROR_FILE_NOT_FOUND \ - || (s) == OS_START_SYSERR + ERROR_PATH_NOT_FOUND \ - || (s) == OS_START_SYSERR + ERROR_NO_MORE_FILES \ - || (s) == OS_START_SYSERR + ERROR_OPEN_FAILED) -#define STATUS_IS_ENOTDIR(s) ((s) == CORE_ENOTDIR) -#define STATUS_IS_ENOSPC(s) ((s) == CORE_ENOSPC \ - || (s) == OS_START_SYSERR + ERROR_DISK_FULL) -#define STATUS_IS_ENOMEM(s) ((s) == CORE_ENOMEM) -#define STATUS_IS_EMFILE(s) ((s) == CORE_EMFILE \ - || (s) == OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES) -#define STATUS_IS_ENFILE(s) ((s) == CORE_ENFILE) -#define STATUS_IS_EBADF(s) ((s) == CORE_EBADF \ - || (s) == OS_START_SYSERR + ERROR_INVALID_HANDLE) -#define STATUS_IS_EINVAL(s) ((s) == CORE_EINVAL \ - || (s) == OS_START_SYSERR + ERROR_INVALID_PARAMETER \ - || (s) == OS_START_SYSERR + ERROR_INVALID_FUNCTION) -#define STATUS_IS_ESPIPE(s) ((s) == CORE_ESPIPE \ - || (s) == OS_START_SYSERR + ERROR_NEGATIVE_SEEK) -#define STATUS_IS_EAGAIN(s) ((s) == CORE_EAGAIN \ - || (s) == OS_START_SYSERR + ERROR_NO_DATA \ - || (s) == OS_START_SYSERR + SOCEWOULDBLOCK \ - || (s) == OS_START_SYSERR + ERROR_LOCK_VIOLATION) -#define STATUS_IS_EINTR(s) ((s) == CORE_EINTR \ - || (s) == OS_START_SYSERR + SOCEINTR) -#define STATUS_IS_ENOTSOCK(s) ((s) == CORE_ENOTSOCK \ - || (s) == OS_START_SYSERR + SOCENOTSOCK) -#define STATUS_IS_ECONNREFUSED(s) ((s) == CORE_ECONNREFUSED \ - || (s) == OS_START_SYSERR + SOCECONNREFUSED) -#define STATUS_IS_EINPROGRESS(s) ((s) == CORE_EINPROGRESS \ - || (s) == OS_START_SYSERR + SOCEINPROGRESS) -#define STATUS_IS_ECONNABORTED(s) ((s) == CORE_ECONNABORTED \ - || (s) == OS_START_SYSERR + SOCECONNABORTED) -#define STATUS_IS_ECONNRESET(s) ((s) == CORE_ECONNRESET \ - || (s) == OS_START_SYSERR + SOCECONNRESET) -/* XXX deprecated */ -#define STATUS_IS_ETIMEDOUT(s) ((s) == CORE_ETIMEDOUT \ - || (s) == OS_START_SYSERR + SOCETIMEDOUT) -#undef STATUS_IS_TIMEUP -#define STATUS_IS_TIMEUP(s) ((s) == CORE_TIMEUP \ - || (s) == OS_START_SYSERR + SOCETIMEDOUT) -#define STATUS_IS_EHOSTUNREACH(s) ((s) == CORE_EHOSTUNREACH \ - || (s) == OS_START_SYSERR + SOCEHOSTUNREACH) -#define STATUS_IS_ENETUNREACH(s) ((s) == CORE_ENETUNREACH \ - || (s) == OS_START_SYSERR + SOCENETUNREACH) -#define STATUS_IS_EFTYPE(s) ((s) == CORE_EFTYPE) -#define STATUS_IS_EPIPE(s) ((s) == CORE_EPIPE \ - || (s) == OS_START_SYSERR + ERROR_BROKEN_PIPE \ - || (s) == OS_START_SYSERR + SOCEPIPE) -#define STATUS_IS_EXDEV(s) ((s) == CORE_EXDEV \ - || (s) == OS_START_SYSERR + ERROR_NOT_SAME_DEVICE) -#define STATUS_IS_ENOTEMPTY(s) ((s) == CORE_ENOTEMPTY \ - || (s) == OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \ - || (s) == OS_START_SYSERR + ERROR_ACCESS_DENIED) -#define STATUS_IS_EAFNOSUPPORT(s) ((s) == CORE_AFNOSUPPORT \ - || (s) == OS_START_SYSERR + SOCEAFNOSUPPORT) - -/* - Sorry, too tired to wrap this up for OS2... feel free to - fit the following into their best matches. - - { ERROR_NO_SIGNAL_SENT, ESRCH }, - { SOCEALREADY, EALREADY }, - { SOCEDESTADDRREQ, EDESTADDRREQ }, - { SOCEMSGSIZE, EMSGSIZE }, - { SOCEPROTOTYPE, EPROTOTYPE }, - { SOCENOPROTOOPT, ENOPROTOOPT }, - { SOCEPROTONOSUPPORT, EPROTONOSUPPORT }, - { SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT }, - { SOCEOPNOTSUPP, EOPNOTSUPP }, - { SOCEPFNOSUPPORT, EPFNOSUPPORT }, - { SOCEADDRINUSE, EADDRINUSE }, - { SOCEADDRNOTAVAIL, EADDRNOTAVAIL }, - { SOCENETDOWN, ENETDOWN }, - { SOCENETRESET, ENETRESET }, - { SOCENOBUFS, ENOBUFS }, - { SOCEISCONN, EISCONN }, - { SOCENOTCONN, ENOTCONN }, - { SOCESHUTDOWN, ESHUTDOWN }, - { SOCETOOMANYREFS, ETOOMANYREFS }, - { SOCELOOP, ELOOP }, - { SOCEHOSTDOWN, EHOSTDOWN }, - { SOCENOTEMPTY, ENOTEMPTY }, - { SOCEPIPE, EPIPE } -*/ - -#elif defined(WIN32) && !defined(DOXYGEN) /* !defined(OS2) */ - -#define FROM_OS_ERROR(e) (e == 0 ? CORE_OK : e + OS_START_SYSERR) -#define TO_OS_ERROR(e) (e == 0 ? CORE_OK : e - OS_START_SYSERR) - -#define get_os_error() (FROM_OS_ERROR(GetLastError())) -#define set_os_error(e) (SetLastError(TO_OS_ERROR(e))) - -/* A special case, only socket calls require this: - */ -#define get_netos_error() (FROM_OS_ERROR(WSAGetLastError())) -#define set_netos_error(e) (WSASetLastError(TO_OS_ERROR(e))) - -/* CORE CANONICAL ERROR TESTS */ -#define STATUS_IS_EACCES(s) ((s) == CORE_EACCES \ - || (s) == OS_START_SYSERR + ERROR_ACCESS_DENIED \ - || (s) == OS_START_SYSERR + ERROR_CANNOT_MAKE \ - || (s) == OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \ - || (s) == OS_START_SYSERR + ERROR_DRIVE_LOCKED \ - || (s) == OS_START_SYSERR + ERROR_FAIL_I24 \ - || (s) == OS_START_SYSERR + ERROR_LOCK_VIOLATION \ - || (s) == OS_START_SYSERR + ERROR_LOCK_FAILED \ - || (s) == OS_START_SYSERR + ERROR_NOT_LOCKED \ - || (s) == OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \ - || (s) == OS_START_SYSERR + ERROR_SHARING_VIOLATION) -#define STATUS_IS_EEXIST(s) ((s) == CORE_EEXIST \ - || (s) == OS_START_SYSERR + ERROR_FILE_EXISTS \ - || (s) == OS_START_SYSERR + ERROR_ALREADY_EXISTS) -#define STATUS_IS_ENAMETOOLONG(s) ((s) == CORE_ENAMETOOLONG \ - || (s) == OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \ - || (s) == OS_START_SYSERR + WSAENAMETOOLONG) -#define STATUS_IS_ENOENT(s) ((s) == CORE_ENOENT \ - || (s) == OS_START_SYSERR + ERROR_FILE_NOT_FOUND \ - || (s) == OS_START_SYSERR + ERROR_PATH_NOT_FOUND \ - || (s) == OS_START_SYSERR + ERROR_OPEN_FAILED \ - || (s) == OS_START_SYSERR + ERROR_NO_MORE_FILES) -#define STATUS_IS_ENOTDIR(s) ((s) == CORE_ENOTDIR \ - || (s) == OS_START_SYSERR + ERROR_PATH_NOT_FOUND \ - || (s) == OS_START_SYSERR + ERROR_BAD_NETPATH \ - || (s) == OS_START_SYSERR + ERROR_BAD_NET_NAME \ - || (s) == OS_START_SYSERR + ERROR_BAD_PATHNAME \ - || (s) == OS_START_SYSERR + ERROR_INVALID_DRIVE) -#define STATUS_IS_ENOSPC(s) ((s) == CORE_ENOSPC \ - || (s) == OS_START_SYSERR + ERROR_DISK_FULL) -#define STATUS_IS_ENOMEM(s) ((s) == CORE_ENOMEM \ - || (s) == OS_START_SYSERR + ERROR_ARENA_TRASHED \ - || (s) == OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \ - || (s) == OS_START_SYSERR + ERROR_INVALID_BLOCK \ - || (s) == OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \ - || (s) == OS_START_SYSERR + ERROR_OUTOFMEMORY) -#define STATUS_IS_EMFILE(s) ((s) == CORE_EMFILE \ - || (s) == OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES) -#define STATUS_IS_ENFILE(s) ((s) == CORE_ENFILE) -#define STATUS_IS_EBADF(s) ((s) == CORE_EBADF \ - || (s) == OS_START_SYSERR + ERROR_INVALID_HANDLE \ - || (s) == OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE) -#define STATUS_IS_EINVAL(s) ((s) == CORE_EINVAL \ - || (s) == OS_START_SYSERR + ERROR_INVALID_ACCESS \ - || (s) == OS_START_SYSERR + ERROR_INVALID_DATA \ - || (s) == OS_START_SYSERR + ERROR_INVALID_FUNCTION \ - || (s) == OS_START_SYSERR + ERROR_INVALID_HANDLE \ - || (s) == OS_START_SYSERR + ERROR_INVALID_PARAMETER \ - || (s) == OS_START_SYSERR + ERROR_NEGATIVE_SEEK) -#define STATUS_IS_ESPIPE(s) ((s) == CORE_ESPIPE \ - || (s) == OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \ - || (s) == OS_START_SYSERR + ERROR_NEGATIVE_SEEK) -#define STATUS_IS_EAGAIN(s) ((s) == CORE_EAGAIN \ - || (s) == OS_START_SYSERR + ERROR_NO_DATA \ - || (s) == OS_START_SYSERR + ERROR_NO_PROC_SLOTS \ - || (s) == OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \ - || (s) == OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \ - || (s) == OS_START_SYSERR + ERROR_LOCK_VIOLATION \ - || (s) == OS_START_SYSERR + WSAEWOULDBLOCK) -#define STATUS_IS_EINTR(s) ((s) == CORE_EINTR \ - || (s) == OS_START_SYSERR + WSAEINTR) -#define STATUS_IS_ENOTSOCK(s) ((s) == CORE_ENOTSOCK \ - || (s) == OS_START_SYSERR + WSAENOTSOCK) -#define STATUS_IS_ECONNREFUSED(s) ((s) == CORE_ECONNREFUSED \ - || (s) == OS_START_SYSERR + WSAECONNREFUSED) -#define STATUS_IS_EINPROGRESS(s) ((s) == CORE_EINPROGRESS \ - || (s) == OS_START_SYSERR + WSAEINPROGRESS) -#define STATUS_IS_ECONNABORTED(s) ((s) == CORE_ECONNABORTED \ - || (s) == OS_START_SYSERR + WSAECONNABORTED) -#define STATUS_IS_ECONNRESET(s) ((s) == CORE_ECONNRESET \ - || (s) == OS_START_SYSERR + ERROR_NETNAME_DELETED \ - || (s) == OS_START_SYSERR + WSAECONNRESET) -/* XXX deprecated */ -#define STATUS_IS_ETIMEDOUT(s) ((s) == CORE_ETIMEDOUT \ - || (s) == OS_START_SYSERR + WSAETIMEDOUT \ - || (s) == OS_START_SYSERR + WAIT_TIMEOUT) -#undef STATUS_IS_TIMEUP -#define STATUS_IS_TIMEUP(s) ((s) == CORE_TIMEUP \ - || (s) == OS_START_SYSERR + WSAETIMEDOUT \ - || (s) == OS_START_SYSERR + WAIT_TIMEOUT) -#define STATUS_IS_EHOSTUNREACH(s) ((s) == CORE_EHOSTUNREACH \ - || (s) == OS_START_SYSERR + WSAEHOSTUNREACH) -#define STATUS_IS_ENETUNREACH(s) ((s) == CORE_ENETUNREACH \ - || (s) == OS_START_SYSERR + WSAENETUNREACH) -#define STATUS_IS_EFTYPE(s) ((s) == CORE_EFTYPE \ - || (s) == OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \ - || (s) == OS_START_SYSERR + ERROR_INVALID_DLL \ - || (s) == OS_START_SYSERR + ERROR_INVALID_MODULETYPE \ - || (s) == OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \ - || (s) == OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \ - || (s) == OS_START_SYSERR + ERROR_FILE_CORRUPT \ - || (s) == OS_START_SYSERR + ERROR_BAD_FORMAT) -#define STATUS_IS_EPIPE(s) ((s) == CORE_EPIPE \ - || (s) == OS_START_SYSERR + ERROR_BROKEN_PIPE) -#define STATUS_IS_EXDEV(s) ((s) == CORE_EXDEV \ - || (s) == OS_START_SYSERR + ERROR_NOT_SAME_DEVICE) -#define STATUS_IS_ENOTEMPTY(s) ((s) == CORE_ENOTEMPTY \ - || (s) == OS_START_SYSERR + ERROR_DIR_NOT_EMPTY) -#define STATUS_IS_EAFNOSUPPORT(s) ((s) == CORE_EAFNOSUPPORT \ - || (s) == OS_START_SYSERR + WSAEAFNOSUPPORT) - -#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */ - -#define FROM_OS_ERROR(e) (e == 0 ? CORE_OK : e + OS_START_SYSERR) -#define TO_OS_ERROR(e) (e == 0 ? CORE_OK : e - OS_START_SYSERR) - -#define get_os_error() (errno) -#define set_os_error(e) (errno = (e)) - -/* A special case, only socket calls require this: */ -#define get_netos_error() (FROM_OS_ERROR(WSAGetLastError())) -#define set_netos_error(e) (WSASetLastError(TO_OS_ERROR(e))) - -/* CORE CANONICAL ERROR TESTS */ -#define STATUS_IS_EACCES(s) ((s) == CORE_EACCES) -#define STATUS_IS_EEXIST(s) ((s) == CORE_EEXIST) -#define STATUS_IS_ENAMETOOLONG(s) ((s) == CORE_ENAMETOOLONG) -#define STATUS_IS_ENOENT(s) ((s) == CORE_ENOENT) -#define STATUS_IS_ENOTDIR(s) ((s) == CORE_ENOTDIR) -#define STATUS_IS_ENOSPC(s) ((s) == CORE_ENOSPC) -#define STATUS_IS_ENOMEM(s) ((s) == CORE_ENOMEM) -#define STATUS_IS_EMFILE(s) ((s) == CORE_EMFILE) -#define STATUS_IS_ENFILE(s) ((s) == CORE_ENFILE) -#define STATUS_IS_EBADF(s) ((s) == CORE_EBADF) -#define STATUS_IS_EINVAL(s) ((s) == CORE_EINVAL) -#define STATUS_IS_ESPIPE(s) ((s) == CORE_ESPIPE) - -#define STATUS_IS_EAGAIN(s) ((s) == CORE_EAGAIN \ - || (s) == EWOULDBLOCK \ - || (s) == OS_START_SYSERR + WSAEWOULDBLOCK) -#define STATUS_IS_EINTR(s) ((s) == CORE_EINTR \ - || (s) == OS_START_SYSERR + WSAEINTR) -#define STATUS_IS_ENOTSOCK(s) ((s) == CORE_ENOTSOCK \ - || (s) == OS_START_SYSERR + WSAENOTSOCK) -#define STATUS_IS_ECONNREFUSED(s) ((s) == CORE_ECONNREFUSED \ - || (s) == OS_START_SYSERR + WSAECONNREFUSED) -#define STATUS_IS_EINPROGRESS(s) ((s) == CORE_EINPROGRESS \ - || (s) == OS_START_SYSERR + WSAEINPROGRESS) -#define STATUS_IS_ECONNABORTED(s) ((s) == CORE_ECONNABORTED \ - || (s) == OS_START_SYSERR + WSAECONNABORTED) -#define STATUS_IS_ECONNRESET(s) ((s) == CORE_ECONNRESET \ - || (s) == OS_START_SYSERR + WSAECONNRESET) -/* XXX deprecated */ -#define STATUS_IS_ETIMEDOUT(s) ((s) == CORE_ETIMEDOUT \ - || (s) == OS_START_SYSERR + WSAETIMEDOUT \ - || (s) == OS_START_SYSERR + WAIT_TIMEOUT) -#undef STATUS_IS_TIMEUP -#define STATUS_IS_TIMEUP(s) ((s) == CORE_TIMEUP \ - || (s) == OS_START_SYSERR + WSAETIMEDOUT \ - || (s) == OS_START_SYSERR + WAIT_TIMEOUT) -#define STATUS_IS_EHOSTUNREACH(s) ((s) == CORE_EHOSTUNREACH \ - || (s) == OS_START_SYSERR + WSAEHOSTUNREACH) -#define STATUS_IS_ENETUNREACH(s) ((s) == CORE_ENETUNREACH \ - || (s) == OS_START_SYSERR + WSAENETUNREACH) -#define STATUS_IS_ENETDOWN(s) ((s) == OS_START_SYSERR + WSAENETDOWN) -#define STATUS_IS_EFTYPE(s) ((s) == CORE_EFTYPE) -#define STATUS_IS_EPIPE(s) ((s) == CORE_EPIPE) -#define STATUS_IS_EXDEV(s) ((s) == CORE_EXDEV) -#define STATUS_IS_ENOTEMPTY(s) ((s) == CORE_ENOTEMPTY) -#define STATUS_IS_EAFNOSUPPORT(s) ((s) == CORE_EAFNOSUPPORT \ - || (s) == OS_START_SYSERR + WSAEAFNOSUPPORT) - -#else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */ - -/* - * os error codes are clib error codes - */ -#define FROM_OS_ERROR(e) (e) -#define TO_OS_ERROR(e) (e) - -#define get_os_error() (errno) -#define set_os_error(e) (errno = (e)) - -/* A special case, only socket calls require this: - */ -#define get_netos_error() (errno) -#define set_netos_error(e) (errno = (e)) - -/** - * @addtogroup STATUS_IS - * @{ - */ - -/** permission denied */ -#define STATUS_IS_EACCES(s) ((s) == CORE_EACCES) -/** file exists */ -#define STATUS_IS_EEXIST(s) ((s) == CORE_EEXIST) -/** path name is too long */ -#define STATUS_IS_ENAMETOOLONG(s) ((s) == CORE_ENAMETOOLONG) -/** - * no such file or directory - * @remark - * EMVSCATLG can be returned by the automounter on z/OS for - * paths which do not exist. - */ -#ifdef EMVSCATLG -#define STATUS_IS_ENOENT(s) ((s) == CORE_ENOENT \ - || (s) == EMVSCATLG) -#else -#define STATUS_IS_ENOENT(s) ((s) == CORE_ENOENT) -#endif -/** not a directory */ -#define STATUS_IS_ENOTDIR(s) ((s) == CORE_ENOTDIR) -/** no space left on device */ -#ifdef EDQUOT -#define STATUS_IS_ENOSPC(s) ((s) == CORE_ENOSPC \ - || (s) == EDQUOT) -#else -#define STATUS_IS_ENOSPC(s) ((s) == CORE_ENOSPC) -#endif -/** not enough memory */ -#define STATUS_IS_ENOMEM(s) ((s) == CORE_ENOMEM) -/** too many open files */ -#define STATUS_IS_EMFILE(s) ((s) == CORE_EMFILE) -/** file table overflow */ -#define STATUS_IS_ENFILE(s) ((s) == CORE_ENFILE) -/** bad file # */ -#define STATUS_IS_EBADF(s) ((s) == CORE_EBADF) -/** invalid argument */ -#define STATUS_IS_EINVAL(s) ((s) == CORE_EINVAL) -/** illegal seek */ -#define STATUS_IS_ESPIPE(s) ((s) == CORE_ESPIPE) - -/** operation would block */ -#if !defined(EWOULDBLOCK) || !defined(EAGAIN) -#define STATUS_IS_EAGAIN(s) ((s) == CORE_EAGAIN) -#elif (EWOULDBLOCK == EAGAIN) -#define STATUS_IS_EAGAIN(s) ((s) == CORE_EAGAIN) -#else -#define STATUS_IS_EAGAIN(s) ((s) == CORE_EAGAIN \ - || (s) == EWOULDBLOCK) -#endif - -/** interrupted system call */ -#define STATUS_IS_EINTR(s) ((s) == CORE_EINTR) -/** socket operation on a non-socket */ -#define STATUS_IS_ENOTSOCK(s) ((s) == CORE_ENOTSOCK) -/** Connection Refused */ -#define STATUS_IS_ECONNREFUSED(s) ((s) == CORE_ECONNREFUSED) -/** operation now in progress */ -#define STATUS_IS_EINPROGRESS(s) ((s) == CORE_EINPROGRESS) - -/** - * Software caused connection abort - * @remark - * EPROTO on certain older kernels really means ECONNABORTED, so we need to - * ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603 - * - * There is potentially a bug in Solaris 2.x x<6, and other boxes that - * implement tcp sockets in userland (i.e. on top of STREAMS). On these - * systems, EPROTO can actually result in a fatal loop. See PR#981 for - * example. It's hard to handle both uses of EPROTO. - */ -#ifdef EPROTO -#define STATUS_IS_ECONNABORTED(s) ((s) == CORE_ECONNABORTED \ - || (s) == EPROTO) -#else -#define STATUS_IS_ECONNABORTED(s) ((s) == CORE_ECONNABORTED) -#endif - -/** Connection Reset by peer */ -#define STATUS_IS_ECONNRESET(s) ((s) == CORE_ECONNRESET) -/** Operation timed out - * @deprecated */ -#define STATUS_IS_ETIMEDOUT(s) ((s) == CORE_ETIMEDOUT) -/** no route to host */ -#define STATUS_IS_EHOSTUNREACH(s) ((s) == CORE_EHOSTUNREACH) -/** network is unreachable */ -#define STATUS_IS_ENETUNREACH(s) ((s) == CORE_ENETUNREACH) -/** inappropiate file type or format */ -#define STATUS_IS_EFTYPE(s) ((s) == CORE_EFTYPE) -/** broken pipe */ -#define STATUS_IS_EPIPE(s) ((s) == CORE_EPIPE) -/** cross device link */ -#define STATUS_IS_EXDEV(s) ((s) == CORE_EXDEV) -/** Directory Not Empty */ -#define STATUS_IS_ENOTEMPTY(s) ((s) == CORE_ENOTEMPTY || \ - (s) == CORE_EEXIST) -/** Address Family not supported */ -#define STATUS_IS_EAFNOSUPPORT(s) ((s) == CORE_EAFNOSUPPORT) -/** @} */ - -#endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */ - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_ERRNO_H__ */ diff --git a/lib/core/include/core_event.h b/lib/core/include/core_event.h deleted file mode 100644 index 88248b1e4..000000000 --- a/lib/core/include/core_event.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __EVENT_H__ -#define __EVENT_H__ - -#include "core_msgq.h" -#include "core_timer.h" -#include "core_fsm.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define EVENT_SIZE sizeof(event_t) - -#define event_set(__ptr_e, __evnt) ((__ptr_e)->event = (__evnt)) -#define event_get(__ptr_e) ((__ptr_e)->event) - -#define event_set_param1(__ptr_e, __param) \ - ((__ptr_e)->param1 = (c_uintptr_t)(__param)) -#define event_set_param2(__ptr_e, __param) \ - ((__ptr_e)->param2 = (c_uintptr_t)(__param)) -#define event_set_param3(__ptr_e, __param) \ - ((__ptr_e)->param3 = (c_uintptr_t)(__param)) -#define event_set_param4(__ptr_e, __param) \ - ((__ptr_e)->param4 = (c_uintptr_t)(__param)) -#define event_set_param5(__ptr_e, __param) \ - ((__ptr_e)->param5 = (c_uintptr_t)(__param)) -#define event_set_param6(__ptr_e, __param) \ - ((__ptr_e)->param6 = (c_uintptr_t)(__param)) -#define event_set_param7(__ptr_e, __param) \ - ((__ptr_e)->param7 = (c_uintptr_t)(__param)) -#define event_set_param8(__ptr_e, __param) \ - ((__ptr_e)->param8 = (c_uintptr_t)(__param)) - -#define event_get_param1(__ptr_e) ((__ptr_e)->param1) -#define event_get_param2(__ptr_e) ((__ptr_e)->param2) -#define event_get_param3(__ptr_e) ((__ptr_e)->param3) -#define event_get_param4(__ptr_e) ((__ptr_e)->param4) -#define event_get_param5(__ptr_e) ((__ptr_e)->param5) -#define event_get_param6(__ptr_e) ((__ptr_e)->param6) -#define event_get_param7(__ptr_e) ((__ptr_e)->param7) -#define event_get_param8(__ptr_e) ((__ptr_e)->param8) - -#define timer_create(__tm_service, __ptr_e, __duration) \ - event_timer_create((__tm_service), TIMER_TYPE_ONE_SHOT, \ - (__duration), (__ptr_e)) -#define periodic_timer_create(__tm_service, __ptr_e, __duration) \ - event_timer_create((__tm_service), TIMER_TYPE_PERIODIC, \ - (__duration), (__ptr_e)) - -#define timer_set_param1(__ptr_e, __param) tm_set_param2(__ptr_e, __param); -#define timer_set_param2(__ptr_e, __param) tm_set_param3(__ptr_e, __param); -#define timer_set_param3(__ptr_e, __param) tm_set_param4(__ptr_e, __param); -#define timer_set_param4(__ptr_e, __param) tm_set_param5(__ptr_e, __param); -#define timer_set_param5(__ptr_e, __param) tm_set_param6(__ptr_e, __param); - -typedef struct { - fsm_event_t event; - c_uintptr_t param1; - c_uintptr_t param2; - c_uintptr_t param3; - c_uintptr_t param4; - c_uintptr_t param5; - c_uintptr_t param6; - c_uintptr_t param7; - c_uintptr_t param8; -} event_t; - -extern char *EVT_NAME_UNKNOWN; - -/** - * Create event message queue - * - * @return event queue or 0 - */ -CORE_DECLARE(msgq_id) event_create(int opt); - -/** - * Delete event message queue - * - * @return CORE_OK or CORE_ERROR - */ -CORE_DECLARE(status_t) event_delete(msgq_id queue_id); - - -/** - * Send a event to event queue - * - * @return If success, return CORE_OK - * If queue is full, return CORE_EAGAIN - * If else, return CORE_ERROR - */ -CORE_DECLARE(status_t) event_send(msgq_id queue_id, event_t *e); - -/** - * Receive a event from event queue - * - * @return If success, return CORE_OK - * If queue is empty, return CORE_EAGAIN - * If else, return CORE_ERROR. - */ -CORE_DECLARE(status_t) event_recv(msgq_id queue_id, event_t *e); - -/** - * Receive a event from event queue with timeout - * - * @return If success, return CORE_OK - * If timout occurs, return CORE_TIMEUP. - * If queue is empty, return CORE_EAGAIN - * If else, return CORE_ERROR. - */ -CORE_DECLARE(status_t) event_timedrecv( - msgq_id queue_id, event_t *e, c_time_t timeout); - -/** - * Create a timer - */ -CORE_DECLARE(tm_block_id) event_timer_create(tm_service_t *tm_service, - tm_type_e type, c_uint32_t duration, c_uintptr_t event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EVENT_H__ */ diff --git a/lib/core/include/core_file.h b/lib/core/include/core_file.h deleted file mode 100644 index c9d2b93e7..000000000 --- a/lib/core/include/core_file.h +++ /dev/null @@ -1,653 +0,0 @@ -#ifndef __CORE_FILE_H__ -#define __CORE_FILE_H__ - -/** - * @file core_file.h - * @brief CORE File I/O Handling - */ - -#include "core.h" -#include "core_time.h" -#include "core_errno.h" -#include "core_param.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup file_io File I/O Handling Functions - * @ingroup CORE - * @{ - */ - -/** filetype_e values for the filetype member of the - * file_info_t structure - * @warning: Not all of the filetypes below can be determined. - * For example, a given platform might not correctly report - * a socket descriptor as CORE_SOCK if that type isn't - * well-identified on that platform. In such cases where - * a filetype exists but cannot be described by the recognized - * flags below, the filetype will be CORE_UNKFILE. If the - * filetype member is not determined, the type will be CORE_NOFILE. - */ - -typedef enum { - FILE_NOFILE = 0, /**< no file type determined */ - FILE_REG, /**< a regular file */ - FILE_DIR, /**< a directory */ - FILE_CHR, /**< a character device */ - FILE_BLK, /**< a block device */ - FILE_PIPE, /**< a FIFO / pipe */ - FILE_LNK, /**< a symbolic link */ - FILE_SOCK, /**< a [unix domain] socket */ - FILE_UNKFILE = 127 /**< a file of some other unknown type */ -} filetype_e; - -/** - * @defgroup file_permissions File Permissions flags - * @{ - */ - -#define FILE_USETID 0x8000 /**< Set user id */ -#define FILE_UREAD 0x0400 /**< Read by user */ -#define FILE_UWRITE 0x0200 /**< Write by user */ -#define FILE_UEXECUTE 0x0100 /**< Execute by user */ - -#define FILE_GSETID 0x4000 /**< Set group id */ -#define FILE_GREAD 0x0040 /**< Read by group */ -#define FILE_GWRITE 0x0020 /**< Write by group */ -#define FILE_GEXECUTE 0x0010 /**< Execute by group */ - -#define FILE_WSTICKY 0x2000 /**< Sticky bit */ -#define FILE_WREAD 0x0004 /**< Read by others */ -#define FILE_WWRITE 0x0002 /**< Write by others */ -#define FILE_WEXECUTE 0x0001 /**< Execute by others */ - -#define FILE_OS_DEFAULT 0x0FFF /**< use OS's default permissions */ - -/* additional permission flags for file_copy and file_append */ -#define FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */ - -/** @} */ - -/** - * @defgroup file_open_flags File Open Flags/Routines - * @{ - */ - -/* Note to implementors: Values in the range 0x00100000--0x80000000 - are reserved for platform-specific values. */ - -#define FILE_READ 0x00001 /**< Open the file for reading */ -#define FILE_WRITE 0x00002 /**< Open the file for writing */ -#define FILE_CREATE 0x00004 /**< Create the file if not there */ -#define FILE_APPEND 0x00008 /**< Append to the end of the file */ -#define FILE_TRUNCATE 0x00010 /**< Open the file and truncate - to 0 length */ -#define FILE_BINARY 0x00020 /**< Open the file in binary mode */ -#define FILE_EXCL 0x00040 /**< Open should fail if FILE_CREATE - and file exists. */ -#define FILE_DELONCLOSE 0x00100 /**< Delete the file after close */ - -/** @} */ - -/** - * @defgroup file_seek_flags File Seek Flags - * @{ - */ - -/* flags for file_seek */ -/** Set the file position */ -#define FILE_SET SEEK_SET -/** Current */ -#define FILE_CUR SEEK_CUR -/** Go to end of file */ -#define FILE_END SEEK_END -/** @} */ - -/** - * @defgroup file_attrs_set_flags File Attribute Flags - * @{ - */ - -/* flags for file_attrs_set */ -#define ATTR_READONLY 0x01 /**< File is read-only */ -#define ATTR_EXECUTABLE 0x02 /**< File is executable */ -#define ATTR_HIDDEN 0x04 /**< File is hidden */ -/** @} */ - -/** - * @defgroup file_writev{_full} max iovec size - * @{ - */ -#if defined(DOXYGEN) -#define MAX_IOVEC_SIZE 1024 /**< System dependent maximum - size of an iovec array */ -#elif defined(IOV_MAX) -#define MAX_IOVEC_SIZE IOV_MAX -#elif defined(MAX_IOVEC) -#define MAX_IOVEC_SIZE MAX_IOVEC -#else -#define MAX_IOVEC_SIZE 1024 -#endif -/** @} */ - -/** File attributes */ -typedef c_uint32_t file_attrs_t; - -/** Type to pass as whence argument to file_seek. */ -typedef int seek_where_t; - -/** - * Structure for referencing files. - */ -typedef struct file_t file_t; - -/** - * Structure for referencing directories. - */ -typedef struct dir_t dir_t; -/** - * Structure for determining file permissions. - */ -typedef c_int32_t file_perms_t; -#if (defined WIN32) || (defined NETWARE) -/** - * Structure for determining the device the file is on. - */ -typedef c_uint32_t dev_t; -#endif - -/** @} */ - -/** - * @defgroup file_stat Stat Functions - * @{ - */ -/** file info structure */ -typedef struct file_info_t file_info_t; - -#define FILE_INFO_LINK 0x00000001 /**< Stat the link not the file itself - if it is a link */ -#define FILE_INFO_MTIME 0x00000010 /**< Modification Time */ -#define FILE_INFO_CTIME 0x00000020 /**< Creation or inode-changed time */ -#define FILE_INFO_ATIME 0x00000040 /**< Access Time */ -#define FILE_INFO_SIZE 0x00000100 /**< Size of the file */ -#define FILE_INFO_CSIZE 0x00000200 /**< Storage size consumed by the file */ -#define FILE_INFO_DEV 0x00001000 /**< Device */ -#define FILE_INFO_INODE 0x00002000 /**< Inode */ -#define FILE_INFO_NLINK 0x00004000 /**< Number of links */ -#define FILE_INFO_TYPE 0x00008000 /**< Type */ -#define FILE_INFO_USER 0x00010000 /**< User */ -#define FILE_INFO_GROUP 0x00020000 /**< Group */ -#define FILE_INFO_UPROT 0x00100000 /**< User protection bits */ -#define FILE_INFO_GPROT 0x00200000 /**< Group protection bits */ -#define FILE_INFO_WPROT 0x00400000 /**< World protection bits */ -#define FILE_INFO_ICASE 0x01000000 /**< if dev is case insensitive */ -#define FILE_INFO_NAME 0x02000000 /**< ->name in proper case */ - -#define FILE_INFO_MIN 0x00008170 /**< type, mtime, ctime, atime, size */ -#define FILE_INFO_IDENT 0x00003000 /**< dev and inode */ -#define FILE_INFO_OWNER 0x00030000 /**< user and group */ -#define FILE_INFO_PROT 0x00700000 /**< all protections */ -#define FILE_INFO_NORM 0x0073b170 /**< an atomic unix file_stat() */ -#define FILE_INFO_DIRENT 0x02000000 /**< an atomic unix dir_read() */ - -/** - * The file information structure. This is analogous to the POSIX - * stat structure. - */ -struct file_info_t { - /** The bitmask describing valid fields of this c_file_info_t structure - * including all available 'wanted' fields and potentially more */ - c_int32_t valid; - /** The access permissions of the file. Mimics Unix access rights. */ - file_perms_t protection; - /** The type of file. One of CORE_REG, CORE_DIR, CORE_CHR, CORE_BLK, - CORE_PIPE, CORE_LNK or CORE_SOCK. If the type is undetermined, - the value is CORE_NOFILE. - * If the type cannot be determined, the value is CORE_UNKFILE. - */ - filetype_e filetype; - /** The user id that owns the file */ - uid_t user; - /** The group id that owns the file */ - gid_t group; - /** The inode of the file. */ - ino_t inode; - /** The id of the device the file is on. */ - dev_t device; - /** The number of hard links to the file. */ - c_int32_t nlink; - /** The size of the file */ - off_t size; - /** The storage size consumed by the file */ - off_t csize; - /** The time the file was last accessed */ - c_time_t atime; - /** The time the file was last modified */ - c_time_t mtime; - /** The time the file was created, or the inode was last changed */ - c_time_t ctime; - /** The pathname of the file (possibly unrooted) */ - char fname[MAX_FILENAME_SIZE]; - /** The file's name (no path) in filesystem case */ - char name[MAX_FILENAME_SIZE]; - /** The file's handle, if accessed (can be submitted to c_duphandle) */ - struct c_file_t *filehand; -}; - -/** @} */ - -/** - * Initialize the file utility. - */ -CORE_DECLARE(status_t) file_init(void); - -/** - * Finalize the file utility. - */ -CORE_DECLARE(status_t) file_final(void); - -/** - * Open the specified file. - * @param newf The opened file descriptor. - * @param fname The full path to the file (using / on all systems) - * @param flag Or'ed value of: - *
- *         FILE_READ              open for reading
- *         FILE_WRITE             open for writing
- *         FILE_CREATE            create the file if not there
- *         FILE_APPEND            file ptr is set to end prior to all writes
- *         FILE_TRUNCATE          set length to zero if file exists
- *         FILE_BINARY            not a text file (This flag is ignored on
- *                               UNIX because it has no meaning)
- *         FILE_EXCL              return error if FILE_CREATE and file exists
- *         FILE_DELONCLOSE        delete the file after closing.
- * 
- * @param perm Access permissions for file. - * @remark If perm is FILE_OS_DEFAULT and the file is being created, - * appropriate default permissions will be used. - */ -CORE_DECLARE(status_t) file_open(file_t **newf, - const char *fname, c_int32_t flag, file_perms_t perm); - -/** - * Close the specified file. - * @param file The file descriptor to close. - */ -CORE_DECLARE(status_t) file_close(file_t *file); - -/** - * Delete the specified file. - * @param path The full path to the file (using / on all systems) - * @remark If the file is open, it won't be removed until all - * instances are closed. - */ -CORE_DECLARE(status_t) file_remove(const char *path); - -/** - * Rename the specified file. - * @param from_path The full path to the original file (using / on all systems) - * @param to_path The full path to the new file (using / on all systems) - * @warning If a file exists at the new location, then it will be - * overwritten. Moving files or directories across devices may not be - * possible. - */ -CORE_DECLARE(status_t) file_rename(const char *from_path, const char *to_path); - -/** - * Create a hard link to the specified file. - * @param from_path The full path to the original file (using / on all systems) - * @param to_path The full path to the new file (using / on all systems) - * @remark Both files must reside on the same device. - */ -CORE_DECLARE(status_t) file_link(const char *from_path, const char *to_path); - -/** - * Copy the specified file to another file. - * @param from_path The full path to the original file (using / on all systems) - * @param to_path The full path to the new file (using / on all systems) - * @param perms Access permissions for the new file if it is created. - * In place of the usual or'd combination of file permissions, the - * value CORE_SOURCE_PERMS may be given, in which case the source - * file's permissions are copied. - * @remark The new file does not need to exist, it will be created if required. - * @warning If the new file already exists, its contents will be overwritten. - */ -CORE_DECLARE(status_t) file_copy( - const char *from_path, const char *to_path, file_perms_t perms); - -/** - * Append the specified file to another file. - * @param from_path The full path to the source file (use / on all systems) - * @param to_path The full path to the destination file (use / on all systems) - * @param perms Access permissions for the destination file if it is created. - * In place of the usual or'd combination of file permissions, the - * value CORE_SOURCE_PERMS may be given, in which case the source - * file's permissions are copied. - * @remark The new file does not need to exist, it will be created if required. - */ -CORE_DECLARE(status_t) file_append( - const char *from_path, const char *to_path, file_perms_t perms); - -/** - * Are we at the end of the file - * @param fptr The core file we are testing. - * @remark Returns CORE_EOF if we are at the end of file, - * CORE_OK otherwise. - */ -CORE_DECLARE(status_t) file_eof(file_t *fptr); - -/** - * Read data from the specified file. - * @param thefile The file descriptor to read from. - * @param buf The buffer to store the data to. - * @param nbytes On entry, the number of bytes to read; on exit, the number - * of bytes read. - * - * @remark file_read will read up to the specified number of - * bytes, but never more. If there isn't enough data to fill that - * number of bytes, all of the available data is read. The third - * argument is modified to reflect the number of bytes read. If a - * char was put back into the stream via ungetc, it will be the first - * character returned. - * - * @remark It is not possible for both bytes to be read and an CORE_EOF - * or other error to be returned. CORE_EINTR is never returned. - */ -CORE_DECLARE(status_t) file_read(file_t *thefile, void *buf, size_t *nbytes); - -/** - * Write data to the specified file. - * @param thefile The file descriptor to write to. - * @param buf The buffer which contains the data. - * @param nbytes On entry, the number of bytes to write; on exit, the number - * of bytes written. - * - * @remark file_write will write up to the specified number of - * bytes, but never more. If the OS cannot write that many bytes, it - * will write as many as it can. The third argument is modified to - * reflect the * number of bytes written. - * - * @remark It is possible for both bytes to be written and an error to - * be returned. CORE_EINTR is never returned. - */ -CORE_DECLARE(status_t) file_write( - file_t *thefile, const void *buf, size_t *nbytes); - -/** - * Write data from iovec array to the specified file. - * @param thefile The file descriptor to write to. - * @param vec The array from which to get the data to write to the file. - * @param nvec The number of elements in the struct iovec array. This must - * be smaller than MAX_IOVEC_SIZE. If it isn't, the function - * will fail with CORE_EINVAL. - * @param nbytes The number of bytes written. - * - * @remark It is possible for both bytes to be written and an error to - * be returned. CORE_EINTR is never returned. - * - * @remark file_writev is available even if the underlying - * operating system doesn't provide writev(). - */ -CORE_DECLARE(status_t) file_writev(file_t *thefile, - const struct iovec *vec, size_t nvec, size_t *nbytes); - -/** - * Read data from the specified file, ensuring that the buffer is filled - * before returning. - * @param thefile The file descriptor to read from. - * @param buf The buffer to store the data to. - * @param nbytes The number of bytes to read. - * @param bytes_read If non-NULL, this will contain the number of bytes read. - * - * @remark file_read will read up to the specified number of - * bytes, but never more. If there isn't enough data to fill that - * number of bytes, then the process/thread will block until it is - * available or EOF is reached. If a char was put back into the - * stream via ungetc, it will be the first character returned. - * - * @remark It is possible for both bytes to be read and an error to be - * returned. And if *bytes_read is less than nbytes, an accompanying - * error is _always_ returned. - * - * @remark CORE_EINTR is never returned. - */ -CORE_DECLARE(status_t) file_read_full(file_t *thefile, void *buf, - size_t nbytes, size_t *bytes_read); - -/** - * Write data to the specified file, ensuring that all of the data is - * written before returning. - * @param thefile The file descriptor to write to. - * @param buf The buffer which contains the data. - * @param nbytes The number of bytes to write. - * @param bytes_written If non-NULL, set to the number of bytes written. - * - * @remark file_write will write up to the specified number of - * bytes, but never more. If the OS cannot write that many bytes, the - * process/thread will block until they can be written. Exceptional - * error such as "out of space" or "pipe closed" will terminate with - * an error. - * - * @remark It is possible for both bytes to be written and an error to - * be returned. And if *bytes_written is less than nbytes, an - * accompanying error is _always_ returned. - * - * @remark CORE_EINTR is never returned. - */ -CORE_DECLARE(status_t) file_write_full(file_t *thefile, - const void *buf, size_t nbytes, size_t *bytes_written); - - -/** - * Write data from iovec array to the specified file, ensuring that all of the - * data is written before returning. - * @param thefile The file descriptor to write to. - * @param vec The array from which to get the data to write to the file. - * @param nvec The number of elements in the struct iovec array. This must - * be smaller than MAX_IOVEC_SIZE. If it isn't, the function - * will fail with CORE_EINVAL. - * @param nbytes The number of bytes written. - * - * @remark file_writev_full is available even if the underlying - * operating system doesn't provide writev(). - */ -CORE_DECLARE(status_t) file_writev_full(file_t *thefile, - const struct iovec *vec, size_t nvec, size_t *nbytes); -/** - * Write a character into the specified file. - * @param ch The character to write. - * @param thefile The file descriptor to write to - */ -CORE_DECLARE(status_t) file_putc(char ch, file_t *thefile); - -/** - * Read a character from the specified file. - * @param ch The character to read into - * @param thefile The file descriptor to read from - */ -CORE_DECLARE(status_t) file_getc(char *ch, file_t *thefile); - -/** - * Put a character back onto a specified stream. - * @param ch The character to write. - * @param thefile The file descriptor to write to - */ -CORE_DECLARE(status_t) file_ungetc(char ch, file_t *thefile); - -/** - * Read a string from the specified file. - * @param str The buffer to store the string in. - * @param len The length of the string - * @param thefile The file descriptor to read from - * @remark The buffer will be NUL-terminated if any characters are stored. - */ -CORE_DECLARE(status_t) file_gets(char *str, int len, file_t *thefile); - -/** - * Write the string into the specified file. - * @param str The string to write. - * @param thefile The file descriptor to write to - */ -CORE_DECLARE(status_t) file_puts(const char *str, file_t *thefile); - -/** - * Transfer all file modified data and metadata to disk. - * @param thefile The file descriptor to sync - */ -CORE_DECLARE(status_t) file_sync(file_t *thefile); - -/** - * Move the read/write file offset to a specified byte within a file. - * @param thefile The file descriptor - * @param where How to move the pointer, one of: - *
- *            CORE_SET  --  set the offset to offset
- *            CORE_CUR  --  add the offset to the current position
- *            CORE_END  --  add the offset to the current file size
- * 
- * @param offset The offset to move the pointer to. - * @remark The third argument is modified to be the offset the pointer - was actually moved to. - */ -CORE_DECLARE(status_t) file_seek(file_t *thefile, - seek_where_t where, off_t *offset); - -/**accessor and general file_io functions. */ - -/** - * return the file name of the current file. - * @param new_path The path of the file. - * @param thefile The currently open file. - */ -CORE_DECLARE(status_t) file_name_get(const char **fname, file_t *thefile); - -/** - * set the specified file's permission bits. - * @param fname The file (name) to apply the permissions to. - * @param perms The permission bits to apply to the file. - * - * @warning Some platforms may not be able to apply all of the - * available permission bits; CORE_INCOMPLETE will be returned if some - * permissions are specified which could not be set. - * - * @warning Platforms which do not implement this feature will return - * CORE_ENOTIMPL. - */ -CORE_DECLARE(status_t) file_perms_set(const char *fname, file_perms_t perms); - -/** - * Set attributes of the specified file. - * @param fname The full path to the file (using / on all systems) - * @param attributes Or'd combination of - *
- *            ATTR_READONLY   - make the file readonly
- *            ATTR_EXECUTABLE - make the file executable
- *            ATTR_HIDDEN     - make the file hidden
- * 
- * @param attr_mask Mask of valid bits in attributes. - * @remark This function should be used in preference to explict manipulation - * of the file permissions, because the operations to provide these - * attributes are platform specific and may involve more than simply - * setting permission bits. - * @warning Platforms which do not implement this feature will return - * CORE_ENOTIMPL. - */ -CORE_DECLARE(status_t) file_attrs_set(const char *fname, - file_attrs_t attributes, file_attrs_t attr_mask); - -/** - * Set the mtime of the specified file. - * @param fname The full path to the file (using / on all systems) - * @param mtime The mtime to apply to the file. - * @warning Platforms which do not implement this feature will return - * CORE_ENOTIMPL. - */ -CORE_DECLARE(status_t) file_mtime_set(const char *fname, c_time_t mtime); - -/** - * Create a new directory on the file system. - * @param path the path for the directory to be created. (use / on all systems) - * @param perm Permissions for the new direcoty. - */ -CORE_DECLARE(status_t) dir_make(const char *path, file_perms_t perm); - -/** Creates a new directory on the file system, but behaves like - * 'mkdir -p'. Creates intermediate directories as required. No error - * will be reported if PATH already exists. - * @param path the path for the directory to be created. (use / on all systems) - * @param perm Permissions for the new direcoty. - */ -CORE_DECLARE(void) path_remove_last_component(char *dir, const char *path); -CORE_DECLARE(status_t) dir_make_recursive(const char *path, file_perms_t perm); - -/** - * Remove directory from the file system. - * @param path the path for the directory to be removed. (use / on all systems) - * @remark Removing a directory which is in-use (e.g., the current working - * directory, or during core_dir_read, or with an open file) is not portable. - */ -CORE_DECLARE(status_t) dir_remove(const char *path); - -/** - * get the specified file's stats. - * @param finfo Where to store the information about the file. - * @param wanted The desired file_info_t fields, as a bit flag of - * CORE_FINFO_ values - * @param thefile The file to get information about. - */ -CORE_DECLARE(status_t) file_info_get(file_info_t *finfo, - c_int32_t wanted, file_t *thefile); - - -/** - * Truncate the file's length to the specified offset - * @param fp The file to truncate - * @param offset The offset to truncate to. - * @remark The read/write file offset is repositioned to offset. - */ -CORE_DECLARE(status_t) file_trunc(file_t *fp, off_t offset); - -/** - * Retrieve the flags that were passed into file_open() - * when the file was opened. - * @return c_int32_t the flags - */ -CORE_DECLARE(c_int32_t) file_flags_get(file_t *f); - -/** - * get the specified file's stats. The file is specified by filename, - * instead of using a pre-opened file. - * @param finfo Where to store the information about the file, which is - * never touched if the call fails. - * @param fname The name of the file to stat. - * @param wanted The desired file_info_t fields, as a bit flag of FILE_INFO_ - values - * - * @note If @c CORE_INCOMPLETE is returned all the fields in @a finfo may - * not be filled in, and you need to check the @c finfo->valid bitmask - * to verify that what you're looking for is there. - */ -CORE_DECLARE(status_t) file_stat(file_info_t *finfo, - const char *fname, c_int32_t wanted); - -/** - * Find an existing directory suitable as a temporary storage location. - * @param temp_dir The temp directory. - * @remark - * This function uses an algorithm to search for a directory that an - * an application can use for temporary storage. - * - */ -CORE_DECLARE(status_t) temp_dir_get(char *temp_dir); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_FILE_H__ */ diff --git a/lib/core/include/core_fsm.h b/lib/core/include/core_fsm.h deleted file mode 100644 index 63b62643b..000000000 --- a/lib/core/include/core_fsm.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __CORE_FSM_H__ -#define __CORE_FSM_H__ - -#include "core.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -extern char *FSM_NAME_INIT_SIG; -extern char *FSM_NAME_ENTRY_SIG; -extern char *FSM_NAME_EXIT_SIG; - -typedef enum _fsm_signal_t { - FSM_ENTRY_SIG, - FSM_EXIT_SIG, - FSM_USER_SIG -} fsm_signal_t; - -typedef c_uintptr_t fsm_event_t; -typedef c_uintptr_t fsm_state_t; - -typedef void (*fsm_handler_t)(void *s, void *e); - -typedef struct _fsm_t { - fsm_handler_t initial; - fsm_handler_t final; - fsm_handler_t state; -} fsm_t; - -#define fsm_create(__s, __i, __f) \ - (((__s)->initial = (__s)->state = (fsm_handler_t)(__i)), \ - (__s)->final = (fsm_handler_t)(__f)) - -#define fsm_clear(__s) \ - ((__s)->initial = (__s)->state = (__s)->final = NULL) - - -CORE_DECLARE(void) fsm_init(void *s, void *e); -CORE_DECLARE(void) fsm_dispatch(void *s, void *e); -CORE_DECLARE(void) fsm_final(void *s, void *e); - -#define FSM_TRAN(__s, __target) \ - ((fsm_t *)__s)->state = (fsm_handler_t)(__target) - -#define FSM_STATE(__s) \ - (((fsm_t *)__s)->state) - -#define FSM_CHECK(__s, __f) \ - (FSM_STATE(__s) == (fsm_handler_t)__f) - -#ifdef __cplusplus -} -#endif - -#endif /* ! __CORE_FSM_H__ */ diff --git a/lib/core/include/core_general.h b/lib/core/include/core_general.h deleted file mode 100644 index 47559ce08..000000000 --- a/lib/core/include/core_general.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef __CORE_GENERAL_H__ -#define __CORE_GENERAL_H__ - -/** - * @file core_general.h - * This is collection of oddballs that didn't fit anywhere else, - * and might move to more appropriate headers with the release - * of CORE 1.0. - * @brief CORE Miscellaneous library routines - */ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup core_general Miscellaneous library routines - * @ingroup CORE - * This is collection of oddballs that didn't fit anywhere else, - * and might move to more appropriate headers with the release - * of CORE 1.0. - * @{ - */ - -/** a space */ -#define ASCII_BLANK '\040' -/** a carrige return */ -#define ASCII_CR '\015' -/** a line feed */ -#define ASCII_LF '\012' -/** a tab */ -#define ASCII_TAB '\011' - -/** - * Alignment macros - */ - -/* C_ALIGN() is only to be used to align on a power of 2 boundary */ -#define C_ALIGN(size, boundary) \ - (((size) + ((boundary) - 1)) & ~((boundary) - 1)) - -/** Default alignment */ -#define C_ALIGN_DEFAULT(size) C_ALIGN(size, 8) - - -/** - * String and memory functions - */ - -/* STRINGIFY is defined here, and also in core_release.h, so wrap it */ -#ifndef STRINGIFY -/** Properly quote a value as a string in the C preprocessor */ -#define STRINGIFY(n) STRINGIFY_HELPER(n) -/** Helper macro for STRINGIFY */ -#define STRINGIFY_HELPER(n) #n -#endif - -/** @} */ - -/** - * @defgroup core_library Library initialization and termination - * @{ - */ - -/** - * Setup any CORE internal data structures. This MUST be the first function - * called for any CORE library. - * @remark See core_app_initialize if this is an application, rather than - * a library consumer of core. - */ -CORE_DECLARE(status_t) core_initialize(void); - -/** - * Set up an application with normalized argc, argv (and optionally env) in - * order to deal with platform-specific oddities, such as Win32 services, - * code pages and signals. This must be the first function called for any - * CORE program. - * @param argc Pointer to the argc that may be corrected - * @param argv Pointer to the argv that may be corrected - * @param env Pointer to the env that may be corrected, may be NULL - * @remark See core_initialize if this is a library consumer of core. - * Otherwise, this call is identical to core_initialize, and must be closed - * with a call to core_terminate at the end of program execution. - */ -CORE_DECLARE(status_t) core_app_initialize(int *argc, - char const * const * *argv, - char const * const * *env); - -/** - * Tear down any CORE internal data structures which aren't torn down - * automatically. - * @remark An CORE program must call this function at termination once it - * has stopped using CORE services. The CORE developers suggest using - * atexit to ensure this is called. When using CORE from a language - * other than C that has problems with the calling convention, use - * core_terminate2() instead. - */ -CORE_DECLARE_NONSTD(void) core_terminate(void); - -/** - * Tear down any CORE internal data structures which aren't torn down - * automatically, same as core_terminate - * @remark An CORE program must call either the core_terminate or - * core_terminate2 function once it it has finished using CORE - * services. The CORE developers suggest using atexit(core_terminate) - * to ensure this is done. core_terminate2 exists to allow non-c - * language apps to tear down core, while core_terminate is - * recommended from c language applications. - */ -CORE_DECLARE(void) core_terminate2(void); - -/** @} */ - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! CORE_GENERAL_H */ diff --git a/lib/core/include/core_hash.h b/lib/core/include/core_hash.h deleted file mode 100644 index ff285a6c2..000000000 --- a/lib/core/include/core_hash.h +++ /dev/null @@ -1,224 +0,0 @@ -#ifndef __HASH_H__ -#define __HASH_H__ - -#include "core.h" - -/** - * @file hash.h - * @brief CORE Hash Tables - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup hash Hash Tables - * @ingroup CORE - * @{ - */ - -/** - * When passing a key to hash_set or hash_get, this value can be - * passed to indicate a string-valued key, and have hash compute the - * length automatically. - * - * @remark hash will use strlen(key) for the length. The NUL terminator - * is not included in the hash value (why throw a constant in?). - * Since the hash table merely references the provided key (rather - * than copying it), hash_this() will return the NUL-term'd key. - */ -#define HASH_KEY_STRING (-1) - -/** - * Abstract type for hash tables. - */ -typedef struct hash_t hash_t; - -/** - * Abstract type for scanning hash tables. - */ -typedef struct hash_index_t hash_index_t; - -/** - * Callback functions for calculating hash values. - * @param key The key. - * @param klen The length of the key, or HASH_KEY_STRING to use the string - * length. If HASH_KEY_STRING then returns the actual key length. - */ -typedef unsigned int (*hashfunc_t)(const char *key, int *klen); - -/** - * The default hash function. - */ -CORE_DECLARE_NONSTD(unsigned int) - core_hashfunc_default(const char *key, int *klen); - -/** - * Create a hash table. - * @return The hash table just created - */ -CORE_DECLARE(hash_t *) hash_make(); - -/** - * Create a hash table with a custom hash function - * @param hash_func A custom hash function. - * @return The hash table just created - */ -CORE_DECLARE(hash_t *) hash_make_custom(hashfunc_t hash_func); - -/* Destroy hash memory */ -CORE_DECLARE(void) hash_destroy(hash_t *ht); - -/** - * Associate a value with a key in a hash table. - * @param ht The hash table - * @param key Pointer to the key - * @param klen Length of the key. Can be HASH_KEY_STRING to use the string length. - * @param val Value to associate with the key - * @remark If the value is NULL the hash entry is deleted. The key is stored as is, - * and so must have a lifetime at least as long as the hash table's pool. - */ -CORE_DECLARE(void) hash_set(hash_t *ht, - const void *key, int klen, const void *val); - -/** - * Look up the value associated with a key in a hash table. - * @param ht The hash table - * @param key Pointer to the key - * @param klen Length of the key. Can be HASH_KEY_STRING to use the string length. - * @return Returns NULL if the key is not present. - */ -CORE_DECLARE(void *) hash_get(hash_t *ht, const void *key, int klen); - -/** - * Look up the value associated with a key in a hash table, or if none exists - * associate a value. - * @param ht The hash table - * @param key Pointer to the key - * @param klen Length of the key. Can be HASH_KEY_STRING to use the string - * length. - * @param val Value to associate with the key (if none exists). - * @return Returns the existing value if any, the given value otherwise. - * @remark If the given value is NULL and a hash entry exists, nothing is done. - */ -CORE_DECLARE(void *) hash_get_or_set(hash_t *ht, - const void *key, int klen, const void *val); - -/** - * Start iterating over the entries in a hash table. - * @param ht The hash table - * @return The iteration state - * @remark There is no restriction on adding or deleting hash entries during - * an iteration (although the results may be unpredictable unless all you do - * is delete the current entry) and multiple iterations can be in - * progress at the same time. - * - * @par Example: - * - * @code - * int sum_values(hash_t *ht) - * { - * hash_index_t *hi; - * void *val; - * int sum = 0; - * for (hi = hash_first(ht); hi; hi = hash_next(hi)) { - * hash_this(hi, NULL, NULL, &val); - * sum += *(int *)val; - * } - * return sum; - * } - * @endcode - */ -CORE_DECLARE(hash_index_t *) hash_first(hash_t *ht); - -/** - * Continue iterating over the entries in a hash table. - * @param hi The iteration state - * @return a pointer to the updated iteration state. NULL if there are no more - * entries. - */ -CORE_DECLARE(hash_index_t *) hash_next(hash_index_t *hi); - -/** - * Get the current entry's details from the iteration state. - * @param hi The iteration state - * @param key Return pointer for the pointer to the key. - * @param klen Return pointer for the key length. - * @param val Return pointer for the associated value. - * @remark The return pointers should point to a variable that will be set to the - * corresponding data, or they may be NULL if the data isn't interesting. - */ -CORE_DECLARE(void) hash_this(hash_index_t *hi, - const void **key, int *klen, void **val); - -/** - * Get the current entry's key from the iteration state. - * @param hi The iteration state - * @return The pointer to the key - */ -CORE_DECLARE(const void*) hash_this_key(hash_index_t *hi); - -/** - * Get the current entry's key length from the iteration state. - * @param hi The iteration state - * @return The key length - */ -CORE_DECLARE(int) hash_this_key_len(hash_index_t *hi); - -/** - * Get the current entry's value from the iteration state. - * @param hi The iteration state - * @return The pointer to the value - */ -CORE_DECLARE(void*) hash_this_val(hash_index_t *hi); - -/** - * Get the number of key/value pairs in the hash table. - * @param ht The hash table - * @return The number of key/value pairs in the hash table. - */ -CORE_DECLARE(unsigned int) hash_count(hash_t *ht); - -/** - * Clear any key/value pairs in the hash table. - * @param ht The hash table - */ -CORE_DECLARE(void) hash_clear(hash_t *ht); - -/** - * Declaration prototype for the iterator callback function of hash_do(). - * - * @param rec The data passed as the first argument to hash_[v]do() - * @param key The key from this iteration of the hash table - * @param klen The key length from this iteration of the hash table - * @param value The value from this iteration of the hash table - * @remark Iteration continues while this callback function returns non-zero. - * To export the callback function for hash_do() it must be declared - * in the _NONSTD convention. - */ -typedef int (hash_do_callback_fn_t)( - void *rec, const void *key, int klen, const void *value); - -/** - * Iterate over a hash table running the provided function once for every - * element in the hash table. The @param comp function will be invoked for - * every element in the hash table. - * - * @param comp The function to run - * @param rec The data to pass as the first argument to the function - * @param ht The hash table to iterate over - * @return FALSE if one of the comp() iterations returned zero; TRUE if all - * iterations returned non-zero - * @see hash_do_callback_fn_t - */ -CORE_DECLARE(int) hash_do(hash_do_callback_fn_t *comp, - void *rec, const hash_t *ht); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __HASH_H__ */ diff --git a/lib/core/include/core_index.h b/lib/core/include/core_index.h deleted file mode 100644 index 983b0a240..000000000 --- a/lib/core/include/core_index.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __CORE_INDEX_H__ -#define __CORE_INDEX_H__ - -#include "core.h" -#include "core_mutex.h" - -typedef c_uint32_t index_t; - -#define INVALID_INDEX 0 - -#define index_declare(__name, __type, __size) \ - typedef struct { \ - int head, tail; \ - int size, avail; \ - index_t free_index[__size]; \ - __type *index_pool[__size + 1]; \ - __type *free_pool[__size], node_pool[__size]; \ - mutex_id mut; \ - } index_##__name##_t; \ - index_##__name##_t __name - -#define index_init(__pname, __size) do { \ - int __i; \ - mutex_create(&(__pname)->mut, MUTEX_DEFAULT); \ - (__pname)->size = (__pname)->avail = __size; \ - (__pname)->head = (__pname)->tail = 0; \ - for (__i = 0; __i < __size; __i++) \ - { \ - (__pname)->free_index[__i] = (__i + 1); \ - (__pname)->index_pool[__i + 1] = NULL; \ - (__pname)->free_pool[__i] = &((__pname)->node_pool[__i]); \ - } \ -} while (0) - -#define index_final(__pname) \ - ((__pname)->mut ? mutex_delete((__pname)->mut) : CORE_OK) - -#define index_init_wo_lock(__pname, __size) do { \ - int __i; \ - (__pname)->mut = 0; \ - (__pname)->size = (__pname)->avail = __size; \ - (__pname)->head = (__pname)->tail = 0; \ - for (__i = 0; __i < __size; __i++) \ - { \ - (__pname)->free_index[__i] = (__i + 1); \ - (__pname)->index_pool[__i + 1] = NULL; \ - (__pname)->free_pool[__i] = &((__pname)->node_pool[__i]); \ - } \ -} while (0) - -#define index_alloc(__pname, __pptr_node) do { \ - if ((__pname)->mut) mutex_lock((__pname)->mut); \ - if ((__pname)->avail > 0) { \ - (__pname)->avail--; \ - *(__pptr_node) = (void*)(__pname)->free_pool[(__pname)->head]; \ - memset(*(__pptr_node), 0, sizeof(**(__pptr_node))); \ - (__pname)->free_pool[(__pname)->head] = NULL; \ - ((*(__pptr_node))->index) = (__pname)->free_index[(__pname)->head]; \ - (__pname)->index_pool[((*(__pptr_node))->index)] = *(__pptr_node); \ - (__pname)->free_index[(__pname)->head] = INVALID_INDEX; \ - (__pname)->head = ((__pname)->head + 1) % ((__pname)->size); \ - } \ - if ((__pname)->mut) mutex_unlock((__pname)->mut); \ -} while (0) - -#define index_free(__pname, __ptr_node) do { \ - if ((__pname)->mut) mutex_lock((__pname)->mut); \ - if ((__pname)->avail < (__pname)->size) { \ - (__pname)->avail++; \ - (__pname)->index_pool[((__ptr_node)->index)] = NULL; \ - (__pname)->free_index[(__pname)->tail] = ((__ptr_node)->index); \ - (__pname)->free_pool[(__pname)->tail] = (void*)(__ptr_node); \ - (__pname)->tail = ((__pname)->tail + 1) % ((__pname)->size); \ - } \ - if ((__pname)->mut) mutex_unlock((__pname)->mut); \ -} while (0) - -#define index_find(__pname, __index) (void*)(__pname)->index_pool[(__index)]; - -#define index_size(__pname) ((__pname)->size) - -#define index_avail(__pname) ((__pname)->avail) - -#define index_used(__pname) (index_size(__pname) - index_avail(__pname)) - -#endif /* ! __CORE_INDEX_H__ */ diff --git a/lib/core/include/core_lib.h b/lib/core/include/core_lib.h deleted file mode 100644 index 67ce22730..000000000 --- a/lib/core/include/core_lib.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef __CORE_LIB_H__ -#define __CORE_LIB_H__ - -/** - * @file c_lib.h - * This is collection of oddballs that didn't fit anywhere else, - * and might move to more appropriate headers with the release - * of CORE 1.0. - * @brief CORE general purpose library routines - */ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup c_lib General Purpose Library Routines - * @ingroup CORE - * This is collection of oddballs that didn't fit anywhere else, - * and might move to more appropriate headers with the release - * of CORE 1.0. - * @{ - */ - -/* - * Define the structures used by the CORE general-purpose library. - */ - -/** @} */ - -/** - * @defgroup c_ctype ctype functions - * These macros allow correct support of 8-bit characters on systems which - * support 8-bit characters. Pretty dumb how the cast is required, but - * that's legacy libc for ya. These new macros do not support EOF like - * the standard macros do. Tough. - * @{ - */ -/** @see isalnum */ -#define c_isalnum(c) (isalnum(((unsigned char)(c)))) -/** @see isalpha */ -#define c_isalpha(c) (isalpha(((unsigned char)(c)))) -/** @see iscntrl */ -#define c_iscntrl(c) (iscntrl(((unsigned char)(c)))) -/** @see isdigit */ -#define c_isdigit(c) (isdigit(((unsigned char)(c)))) -/** @see isgraph */ -#define c_isgraph(c) (isgraph(((unsigned char)(c)))) -/** @see islower*/ -#define c_islower(c) (islower(((unsigned char)(c)))) -/** @see isascii */ -#ifdef isascii -#define c_isascii(c) (isascii(((unsigned char)(c)))) -#else -#define c_isascii(c) (((c) & ~0x7f)==0) -#endif -/** @see isprint */ -#define c_isprint(c) (isprint(((unsigned char)(c)))) -/** @see ispunct */ -#define c_ispunct(c) (ispunct(((unsigned char)(c)))) -/** @see isspace */ -#define c_isspace(c) (isspace(((unsigned char)(c)))) -/** @see isupper */ -#define c_isupper(c) (isupper(((unsigned char)(c)))) -/** @see isxdigit */ -#define c_isxdigit(c) (isxdigit(((unsigned char)(c)))) -/** @see tolower */ -#define c_tolower(c) (tolower(((unsigned char)(c)))) -/** @see toupper */ -#define c_toupper(c) (toupper(((unsigned char)(c)))) - -#define c_max(x , y) (((x) > (y)) ? (x) : (y)) -#define c_min(x , y) (((x) < (y)) ? (x) : (y)) - -#define c_uint64_to_array(array, uint64) \ - { \ - int i = 0; \ - for (i = 0; i < 8; i++) array[i] = ((uint64 >> (8-1-i) * 8) & 0xff); \ - } - -CORE_DECLARE(status_t) core_generate_random_bytes( - c_uint8_t *buf, int length); - -#define CORE_HEX(I, I_LEN, O) core_ascii_to_hex(I, I_LEN, O, sizeof(O)) -CORE_DECLARE(void *) core_ascii_to_hex( - char *in, int in_len, void *out, int out_len); - -CORE_DECLARE(void *) core_hex_to_ascii( - void *in, int in_len, void *out, int out_len); - -CORE_DECLARE(void *) core_uint64_to_buffer( - c_uint64_t num, int size, void *buffer); - -CORE_DECLARE(c_uint64_t) core_buffer_to_uint64(void *buffer, int size); - -CORE_DECLARE(void *) core_bcd_to_buffer(c_int8_t *in, void *out, int *out_len); -CORE_DECLARE(void *) core_buffer_to_bcd(c_uint8_t *in, int in_len, void *out); - -/* - * Apache's "replacement" for the strncpy() function. We roll our - * own to implement these specific changes: - * (1) strncpy() doesn't always null terminate and we want it to. - * (2) strncpy() null fills, which is bogus, esp. when copy 8byte - * strings into 8k blocks. - * (3) Instead of returning the pointer to the beginning of - * the destination string, we return a pointer to the - * terminating '\0' to allow us to "check" for truncation - * (4) If src is NULL, null terminate dst (empty string copy) - * - * apr_cpystrn() follows the same call structure as strncpy(). - */ -CORE_DECLARE(char *)core_cpystrn(char *dst, const char *src, size_t dst_size); - -/** - * Get the value of an environment variable - * @param value the returned value, allocated from @a pool - * @param envvar the name of the environment variable - */ -CORE_DECLARE(char *) core_env_get(const char *envvar); - -/** - * Set the value of an environment variable - * @param envvar the name of the environment variable - * @param value the value to set - */ -CORE_DECLARE(status_t) core_env_set(const char *envvar, const char *value); - -/** - * Delete a variable from the environment - * @param envvar the name of the environment variable - */ -CORE_DECLARE(status_t) core_env_delete(const char *envvar); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_LIB_H__ */ diff --git a/lib/core/include/core_list.h b/lib/core/include/core_list.h deleted file mode 100644 index 693225679..000000000 --- a/lib/core/include/core_list.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef __CORE_LIST_H__ -#define __CORE_LIST_H__ - -#include "core.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -struct _ln_t { - struct _ln_t *prev; - struct _ln_t *next; -}; - -typedef struct _ln_t ln_t; -typedef struct _ln_t list_t; -typedef struct _ln_t lnode_t; - -#define list_init(__pname) do {\ - (__pname)->prev = NULL; \ - (__pname)->next = NULL; \ -} while (0) - -#define list_first(__pname) ((void*)((__pname)->next)) - -#define list_last(__pname) ((void*)((__pname)->prev)) - -#define list_prev(__ptr_node) ((void*)(((ln_t *)(__ptr_node))->prev)) - -#define list_next(__ptr_node) ((void*)(((ln_t *)(__ptr_node))->next)) - -#define list_is_empty(__pname) ((__pname)->next == NULL) - -#define list_prepend(__pname, __ptr_new) do { \ - ((ln_t*)(__ptr_new))->prev = NULL; \ - ((ln_t*)(__ptr_new))->next = (__pname)->next; \ - if ((__pname)->next) \ - ((__pname)->next)->prev = (ln_t*)(__ptr_new); \ - else \ - (__pname)->prev = (ln_t*)(__ptr_new); \ - (__pname)->next = (ln_t*)(__ptr_new); \ -} while (0) - -#define list_append(__pname, __ptr_new) do { \ - ((ln_t*)(__ptr_new))->prev = (__pname)->prev; \ - ((ln_t*)(__ptr_new))->next = NULL; \ - if ((__pname)->prev) \ - ((__pname)->prev)->next = (ln_t*)(__ptr_new); \ - else \ - (__pname)->next = (ln_t*)(__ptr_new); \ - ((__pname)->prev) = (ln_t*)(__ptr_new); \ -} while (0) - -#define list_insert_prev(__pname, __ptr_node, __ptr_new) do { \ - ((ln_t*)(__ptr_new))->prev = ((ln_t*)(__ptr_node))->prev; \ - ((ln_t*)(__ptr_new))->next = (ln_t*)(__ptr_node); \ - if (((ln_t*)(__ptr_node))->prev) \ - ((ln_t*)(__ptr_node))->prev->next = (ln_t*)(__ptr_new); \ - else \ - (__pname)->next = (ln_t*)(__ptr_new); \ - ((ln_t*)(__ptr_node))->prev = ((ln_t*)(__ptr_new)); \ -} while (0) - -#define list_insert_next(__pname, __ptr_node, __ptr_new) do { \ - ((ln_t*)(__ptr_new))->prev = (ln_t*)(__ptr_node); \ - ((ln_t*)(__ptr_new))->next = ((ln_t*)(__ptr_node))->next; \ - if (((ln_t*)(__ptr_node))->next) \ - ((ln_t*)(__ptr_node))->next->prev = (ln_t*)(__ptr_new); \ - else \ - (__pname)->prev = (ln_t*)(__ptr_new); \ - ((ln_t*)(__ptr_node))->next = ((ln_t*)(__ptr_new)); \ -} while (0) - -#define list_remove(__pname, __ptr_node) do { \ - ln_t *_iter = (__pname)->next; \ - while (_iter) { \ - if (_iter == (ln_t*)(__ptr_node)) { \ - if (_iter->prev) \ - _iter->prev->next = _iter->next; \ - else \ - (__pname)->next = _iter->next; \ - if (_iter->next) \ - _iter->next->prev = _iter->prev; \ - else \ - (__pname)->prev = _iter->prev; \ - break; \ - } \ - _iter = _iter->next; \ - } \ -} while (0) - -typedef int (*ln_cmp_cb)(lnode_t *pnode1, lnode_t *pnode2); - -#define list_insert_sorted(__pname, __ptr_new, __cmp_callback) do { \ - ln_cmp_cb __pcb = (ln_cmp_cb)__cmp_callback; \ - ln_t *_iter = list_first(__pname); \ - while (_iter) { \ - if ((*__pcb)((ln_t*)(__ptr_new), _iter) < 0) { \ - list_insert_prev(__pname, _iter, __ptr_new); \ - break; \ - } \ - _iter = list_next(_iter); \ - } \ - if (_iter == NULL) \ - list_append(__pname, __ptr_new); \ -} while (0) - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_LIST_H__ */ diff --git a/lib/core/include/core_msgq.h b/lib/core/include/core_msgq.h deleted file mode 100644 index d09e3f681..000000000 --- a/lib/core/include/core_msgq.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __CORE_MSGQ_H__ -#define __CORE_MSGQ_H__ - -/** - * @file core_msgq.h - * @brief Message queue header - */ - -#include "core.h" -#include "core_time.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef c_uintptr_t msgq_id; - -#define MAX_MSG_LEN 0xffff - -/** - * @return CORE_OK or CORE_ERROR. - */ -CORE_DECLARE(status_t) msgq_init(void); - -/** - * @return CORE_OK or CORE_ERROR. - */ -CORE_DECLARE(status_t) msgq_final(void); - -#define MSGQ_O_BLOCK 0x0 -#define MSGQ_O_NONBLOCK 0x1 - -/** - * @param id - * @param msgsize - * @param opt - * - * @return If succeed, handler value. If fail, zero - */ -CORE_DECLARE(msgq_id) msgq_create(int qsize, int msgsize, int opt); - -/** - * @param id - * - * @return If succeed, CORE_OK. If fail, CORE_ERROR. - */ -CORE_DECLARE(status_t) msgq_delete(msgq_id id); - -/** - * @param id - * @param msg - * @param msglen - * - * @return the number of bytes to be sent. If there is insufficient room in - * ring buffer, return CORE_EAGAIN. If any error, CORE_ERROR. - */ -CORE_DECLARE(status_t) msgq_send(msgq_id id, const char *msg, int msglen); - -/** - * @param id - * @param msg - * @param msglen - * - * @return the number of bytes to be read. If any error, CORE_ERROR. - * If ring buffer is empty and MSGQ_O_NONBLOCK set, CORE_EAGAIN. - */ -CORE_DECLARE(status_t) msgq_recv(msgq_id id, char *msg, int msglen); - -/** - * @param id - * @param msg - * @param msglen - * - * @return the number of bytes to be read. If any error, CORE_ERROR. - * If ring buffer is empty and MSGQ_O_NONBLOCK set, CORE_EAGAIN. - * If time out with empty buffer, CORE_TIMEUP. - */ -CORE_DECLARE(status_t) msgq_timedrecv(msgq_id id, char *msg, int msglen, - c_time_t timeout); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* !__CORE_MSGQ_H__ */ diff --git a/lib/core/include/core_mutex.h b/lib/core/include/core_mutex.h deleted file mode 100644 index a4cdf53aa..000000000 --- a/lib/core/include/core_mutex.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef __MUTEX_H__ -#define __MUTEX_H__ - -/** - * @file mutex.h - * @brief Core Mutex Routines - */ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup mutex Thread Mutex Routines - * @ingroup CORE - * @{ - */ - -/** Opaque thread-local mutex structure */ -typedef c_uintptr_t mutex_id; - -#define MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */ -#define MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */ -#define MUTEX_UNNESTED 0x2 /**< disable nested locks */ - -/** - * Initialize Mutex Pool - */ -CORE_DECLARE(status_t) mutex_init(void); - -/** - * Finalize Mutex Pool - */ -CORE_DECLARE(status_t) mutex_final(void); - -/** - * Create and initialize a mutex that can be used to synchronize threads. - * @param id the memory address where the newly created mutex will be - * stored. - * @param flags Or'ed value of: - *
- *           MUTEX_DEFAULT   platform-optimal lock behavior.
- *           MUTEX_NESTED    enable nested (recursive) locks.
- *           MUTEX_UNNESTED  disable nested locks (non-recursive).
- * 
- * @param pool the pool from which to allocate the mutex. - * @warning Be cautious in using MUTEX_DEFAULT. While this is the - * most optimial mutex based on a given platform's performance charateristics, - * it will behave as either a nested or an unnested lock. - */ -CORE_DECLARE(status_t) mutex_create(mutex_id *id, unsigned int flags); -/** - * Acquire the lock for the given mutex. If the mutex is already locked, - * the current thread will be put to sleep until the lock becomes available. - * @param id the mutex on which to acquire the lock. - */ -CORE_DECLARE(status_t) mutex_lock(mutex_id id); - -/** - * Attempt to acquire the lock for the given mutex. If the mutex has already - * been acquired, the call returns immediately with CORE_EBUSY. Note: it - * is important that the CORE_STATUS_IS_EBUSY(s) macro be used to determine - * if the return value was CORE_EBUSY, for portability reasons. - * @param id the mutex on which to attempt the lock acquiring. - */ -CORE_DECLARE(status_t) mutex_trylock(mutex_id id); - -/** - * Release the lock for the given mutex. - * @param id the mutex from which to release the lock. - */ -CORE_DECLARE(status_t) mutex_unlock(mutex_id id); - -/** - * Destroy the mutex and free the memory associated with the lock. - * @param id the mutex to destroy. - */ -CORE_DECLARE(status_t) mutex_delete(mutex_id id); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __MUTEX_H__ */ diff --git a/lib/core/include/core_network.h b/lib/core/include/core_network.h deleted file mode 100644 index 22d89477e..000000000 --- a/lib/core/include/core_network.h +++ /dev/null @@ -1,250 +0,0 @@ -#ifndef __CORE_NETWORK_H__ -#define __CORE_NETWORK_H__ - -#include "core_errno.h" -#include "core_time.h" -#include "core_list.h" - -#if HAVE_ARPA_INET_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup sock_option Socket option definitions - * @{ - */ -#define SOCK_O_LINGER (1 << 0) /**< Linger */ -#define SOCK_O_KEEPALIVE (1 << 1) /**< Keepalive */ -#define SOCK_O_DEBUG (1 << 2) /**< Debug */ -#define SOCK_O_NONBLOCK (1 << 3) /**< Non-blocking IO */ -#define SOCK_O_REUSEADDR (1 << 4) /**< Reuse addresses */ -#define SOCK_O_SNDBUF (1 << 5) /**< Send buffer */ -#define SOCK_O_RCVBUF (1 << 6) /**< Receive buffer */ -#define SOCK_O_DISCONNECTED (1 << 7) /**< Disconnected */ -#define SOCK_O_TCP_NODELAY (1 << 8) /**< For SCTP sockets, this is mapped - * to STCP_NODELAY internally. - */ -#define SOCK_O_TCP_NOPUSH (1 << 9) /**< No push */ -#define SOCK_O_RESET_NODELAY (1 << 10) /**< This flag is ONLY set internally - * when we set SOCK_O_TCP_NOPUSH with - * SOCK_O_TCP_NODELAY set to tell us that - * SOCK_O_TCP_NODELAY should be turned on - * again when NOPUSH is turned off - */ -#define SOCK_O_INCOMPLETE_READ (1 << 11) /**< Set on non-blocking sockets - * (timeout != 0) on which the - * previous read() did not fill a buffer - * completely. the next sock_read() - * will first call select()/poll() rather than - * going straight into read(). (Can also - * be set by an application to force a - * select()/poll() call before the next - * read, in cases where the app expects - * that an immediate read would fail.) - */ -#define SOCK_O_INCOMPLETE_WRITE (1 << 12) /**< like SOCK_O_INCOMPLETE_READ, but - * for write - * @see SOCK_O_INCOMPLETE_READ - */ -#define SOCK_O_IPV6_V6ONLY (1 << 13) /**< Don't accept IPv4 connections - * on a IPv6 listening socket. - */ -#define SOCK_O_TCP_DEFER_ACCEPT (1 << 14) /**< Delay accepting of new - * connections until data is available. - * @see apr_socket_accept_filter - */ -#define SOCK_O_BROADCAST (1 << 15) /**< Allow broadcast */ -#define SOCK_O_FREEBIND (1 << 16) /**< Allow binding to addresses not - * owned by any interface - */ - -typedef c_uintptr_t sock_id; -typedef int (*sock_handler)(sock_id sock, void *data); - -typedef struct c_sockaddr_t c_sockaddr_t; -struct c_sockaddr_t { - /* Reserved Area - * - Should not add any atrribute in this area. - * - * e.g) - * struct sockaddr addr; - * ... - * sockaddr_len((c_sockaddr_t *)&addr); - */ -#define c_sa_family sa.sa_family -#define c_sa_port sin.sin_port - union { - struct sockaddr_storage ss; - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - struct sockaddr sa; - }; - - /* User Area - * - Could add your attribute. - */ - c_sockaddr_t *next; -}; - -typedef struct _sock_node_t { - lnode_t node; - - sock_id sock; - c_sockaddr_t *list; -} sock_node_t; - -typedef struct ipsubnet_t { - int family; - - c_uint32_t sub[4]; /* big enough for IPv4 and IPv6 addresses */ - c_uint32_t mask[4]; -} ipsubnet_t; - -typedef struct _sctp_info_t { - c_uint32_t ppid; - c_uint16_t stream_no; - c_uint16_t inbound_streams; - c_uint16_t outbound_streams; -} sctp_info_t; - -/* - * Init/Final - */ -CORE_DECLARE(status_t) network_init(void); -CORE_DECLARE(status_t) network_final(void); - -/* - * Socket - */ -CORE_DECLARE(status_t) sock_create(sock_id *new); -CORE_DECLARE(status_t) sock_delete(sock_id id); -CORE_DECLARE(status_t) sock_delete_list(list_t *list); - -CORE_DECLARE(status_t) sock_socket( - sock_id *id, int family, int type, int protocol); -CORE_DECLARE(status_t) sock_setsockopt(sock_id id, c_int32_t opt, c_int32_t on); -CORE_DECLARE(status_t) sock_bind(sock_id id, c_sockaddr_t *addr); -CORE_DECLARE(status_t) sock_connect(sock_id id, c_sockaddr_t *addr); - -CORE_DECLARE(status_t) sock_listen(sock_id id); -CORE_DECLARE(status_t) sock_accept(sock_id *new, sock_id id); - -CORE_DECLARE(int) sock_family(sock_id id); -CORE_DECLARE(c_sockaddr_t *) sock_local_addr(sock_id id); -CORE_DECLARE(c_sockaddr_t *) sock_remote_addr(sock_id id); - -/* - * Socket Node - */ -CORE_DECLARE(status_t) sock_add_node( - list_t *list, sock_node_t **node, c_sockaddr_t *sa_list, int family); -CORE_DECLARE(status_t) sock_remove_node(list_t *list, sock_node_t *node); -CORE_DECLARE(status_t) sock_remove_all_nodes(list_t *list); - -CORE_DECLARE(status_t) sock_probe_node( - list_t *list, list_t *list6, const char *dev, c_uint16_t port); -CORE_DECLARE(status_t) sock_fill_scope_id_in_local(c_sockaddr_t *sa_list); - -/* - * Socket Address - */ -CORE_DECLARE(status_t) core_getaddrinfo(c_sockaddr_t **sa_list, - int family, const char *hostname, c_uint16_t port, int flags); -CORE_DECLARE(status_t) core_freeaddrinfo(c_sockaddr_t *sa_list); - -CORE_DECLARE(status_t) core_addaddrinfo(c_sockaddr_t **sa_list, - int family, const char *hostname, c_uint16_t port, int flags); -CORE_DECLARE(status_t) core_copyaddrinfo( - c_sockaddr_t **dst, const c_sockaddr_t *src); -CORE_DECLARE(status_t) core_filteraddrinfo(c_sockaddr_t **sa_list, int family); -CORE_DECLARE(status_t) core_sortaddrinfo(c_sockaddr_t **sa_list, int family); -CORE_DECLARE(c_sockaddr_t *) core_link_local_addr_by_dev(const char *dev); - -#define CORE_ADDRSTRLEN INET6_ADDRSTRLEN -#define CORE_ADDR(__aDDR, __bUF) \ - core_inet_ntop(__aDDR, buf, CORE_ADDRSTRLEN) -#define CORE_PORT(__aDDR) \ - ntohs((__aDDR)->c_sa_port) - -#define INET_NTOP(src, dst) \ - inet_ntop(AF_INET,(void *)(c_uintptr_t)(src),(dst),INET_ADDRSTRLEN) -#define INET6_NTOP(src, dst) \ - inet_ntop(AF_INET6,(void *)(src),(dst),INET6_ADDRSTRLEN) -CORE_DECLARE(const char *)core_inet_ntop(void *addr, char *buf, int buflen); -CORE_DECLARE(status_t) core_inet_pton(int family, const char *src, void *addr); - -CORE_DECLARE(socklen_t) sockaddr_len(const void *addr); -CORE_DECLARE(int) sockaddr_is_equal(void *p, void *q); - -CORE_DECLARE(status_t) core_ipsubnet( - ipsubnet_t *ipsub, const char *ipstr, const char *mask_or_numbits); -/* - * UDP Socket - */ -CORE_DECLARE(status_t) udp_socket(sock_id *new, int family); -CORE_DECLARE(status_t) udp_server(sock_id *new, c_sockaddr_t *sa_list); -CORE_DECLARE(status_t) udp_client(sock_id *new, c_sockaddr_t *sa_list); -CORE_DECLARE(status_t) udp_connect(sock_id id, c_sockaddr_t *sa_list); - -/* - * TCP Socket - */ -CORE_DECLARE(status_t) tcp_server(sock_id *new, c_sockaddr_t *sa_list); -CORE_DECLARE(status_t) tcp_client(sock_id *new, c_sockaddr_t *sa_list); - -/* - * SCTP Socket - */ -CORE_DECLARE(void) sctp_set_num_ostreams(int sctp_streams); - -CORE_DECLARE(status_t) sctp_socket(sock_id *new, int family, int type); -CORE_DECLARE(status_t) sctp_server(sock_id *new, - int type, c_sockaddr_t *sa_list); -CORE_DECLARE(status_t) sctp_client(sock_id *new, - int type, c_sockaddr_t *sa_list); -CORE_DECLARE(status_t) sctp_connect(sock_id id, c_sockaddr_t *sa_list); -CORE_DECLARE(int) core_sctp_sendmsg(sock_id id, const void *msg, size_t len, - c_sockaddr_t *to, c_uint32_t ppid, c_uint16_t stream_no); -CORE_DECLARE(int) core_sctp_recvmsg(sock_id id, void *msg, size_t len, - c_sockaddr_t *from, sctp_info_t *sinfo, int *msg_flags); -CORE_DECLARE(int) core_sctp_recvdata(sock_id id, void *msg, size_t len, - c_sockaddr_t *from, sctp_info_t *sinfo); -/* - * TUN Driver - */ -CORE_DECLARE(status_t) tun_open(sock_id *new, - char *ifname, int is_tap); -CORE_DECLARE(status_t) tun_set_ip(sock_id id, ipsubnet_t *gw, ipsubnet_t *sub); - -/* - * Send/Recv - */ -CORE_DECLARE(ssize_t) sock_write(sock_id id, const void *buf, size_t len); -CORE_DECLARE(ssize_t) sock_read(sock_id id, void *buf, size_t len); - -CORE_DECLARE(ssize_t) core_send(sock_id id, - const void *buf, size_t len, int flags); -CORE_DECLARE(ssize_t) core_sendto(sock_id id, - const void *buf, size_t len, int flags, const c_sockaddr_t *to); -CORE_DECLARE(ssize_t) core_recv(sock_id id, void *buf, size_t len, int flags); -CORE_DECLARE(ssize_t) core_recvfrom(sock_id id, - void *buf, size_t len, int flags, c_sockaddr_t *from); - -/* - * Select Loop - */ -CORE_DECLARE(status_t) sock_register(sock_id id, - sock_handler handler, void *data); -CORE_DECLARE(status_t) sock_unregister(sock_id id); -CORE_DECLARE(int) sock_is_registered(sock_id id); -CORE_DECLARE(int) sock_select_loop(c_time_t timeout); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/lib/core/include/core_param.h b/lib/core/include/core_param.h deleted file mode 100644 index 8ca317d2b..000000000 --- a/lib/core/include/core_param.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __CORE_PARAM_H__ -#define __CORE_PARAM_H__ - -#define MAX_NUM_OF_THREAD 128 -#define MAX_NUM_OF_THREADATTR MAX_NUM_OF_THREAD -#define MAX_NUM_OF_PROC 128 -#define MAX_NUM_OF_MUTEX 512 -#define MAX_NUM_OF_COND 512 -#define MAX_NUM_OF_RWLOCK 512 -#define MAX_NUM_OF_SEMAPHORE 512 - -#define MAX_NUM_OF_FILE 256 -#define MAX_FILENAME_SIZE 256 -#define MAX_DIRNAME_SIZE 256 - -#define MAX_NUM_OF_TIMER 1024 - -#define MAX_SIG_DESC_SIZE 256 - -#define HUGE_STRING_LEN 8192 -#define MAX_FILEPATH_LEN 256 -#define MAX_ERROR_STRING_LEN 1024 - -#endif /* ! __CORE_PARAM_H__ */ diff --git a/lib/core/include/core_pkbuf.h b/lib/core/include/core_pkbuf.h deleted file mode 100644 index dd1dbe094..000000000 --- a/lib/core/include/core_pkbuf.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef __CORE_PKBUF_H__ -#define __CORE_PKBUF_H__ - -/** - * @file core_pkbuf.h - * @brief Packet Buffer Routines - */ - -#include "core.h" -#include "core_debug.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * Cluster buffer structre */ -typedef struct _clbuf_t { - - /** - * reference count */ - c_uint16_t ref; - - /** - * pointer to cluster */ - void *cluster; - - /** - * the size of cluster */ - c_uint16_t size; - -} clbuf_t; - -/** - * Packet buffer structure */ -typedef struct _pkbuf_t { - - /** next pkbuf in singly linked pkbuf chain */ - struct _pkbuf_t *next; - - /** pointer to cluster */ - clbuf_t *clbuf; - - /** this buffer */ - void *payload; - - /** - * total length of this buffer and all next buffers in chain - * belonging to the same packet. - * - * For non-queue packet chains this is the invariant: - * p->tot_len == p->len + (p->next? p->next->tot_len: 0) - */ - c_uint16_t tot_len; - - /** length of this buffer */ - c_uint16_t len; - - /** misc flags */ - c_uint8_t flags; - -} pkbuf_t; - -/** - * Initializes the packet buffer library */ -CORE_DECLARE(status_t) pkbuf_init(void); - -/** - * Finalizes the packet buffer library */ -CORE_DECLARE(status_t) pkbuf_final(void); - -/** - * Show the pkbuf/clbuf/cluster count */ -CORE_DECLARE(void) pkbuf_show(void); - -/** - * Allocates a pkbuf of the given type (possibly a chain). - * - * The actual memory allocated for the pkbuf is determined by the - * headroom at which the pkbuf is allocated and the requested size - * (from the headroom parameter). - * - * @param headroom define header size - * @param type define header size - * should be allocated as follows: - * - * @return the allocated pkbuf. If multiple pkbufs where allocated, this - * is the first pkbuf of a pkbuf chain. - */ -#define MAX_SIZEOF_HEADROOM 128 -CORE_DECLARE(pkbuf_t *) pkbuf_alloc(c_uint16_t headroom, c_uint16_t length); - -/** - * Dereference a pkbuf chain and deallocate any no-longer-used - * pkbufs at the head of this chain. - * - * Decrements the reference count of the pkbuf's cluster buffer. - * If it reaches zero, the pkbuf is deallocated. - * - * For a pkbuf chain, this is repeated for each pkbuf in the chain, - * up to the first pkbuf which has a non-zero reference count after - * decrementing. So, when all reference counts are one, the whole - * chain is free'd. - * - * @param pkbuf The pkbuf (chain) to be dereferenced. - * - * @return the number of pkbufs that were de-allocated - * from the head of the chain. - */ -CORE_DECLARE(void) pkbuf_free(pkbuf_t *pkbuf); - -/** - * Adjusts the payload pointer to hide or reveal headers in the payload. - * - * Adjusts the ->payload pointer so that space for a header - * (dis)appears in the pkbuf payload. - * - * The ->payload, ->tot_len and ->len fields are adjusted. - * - * @param pkbuf pkbuf to change the header size. - * @param size Number of bytes to increment header size which - * increases the size of the pkbuf. New space is on the front. - * (Using a negative value decreases the header size.) - * If hdr_size_inc is 0, this function does nothing and returns succesful. - * - * @return non-zero on failure, zero on success. - */ -CORE_DECLARE(status_t) pkbuf_header(pkbuf_t *pkbuf, c_int16_t size); - -/** - * Concatenate two pkbufs (each may be a pkbuf chain) and take over - * the caller's reference of the tail pkbuf. - * - * @note The caller MAY NOT reference the tail pkbuf afterwards. - * Use pkbuf_chain() for that purpose. - * - * @see pkbuf_chain() - */ -CORE_DECLARE(void) pkbuf_join(pkbuf_t *h, pkbuf_t *t); - -/** - * Create copies of pkbufs. - * - * @param pkbuf pkbuf source of the copy - */ -CORE_DECLARE(pkbuf_t*) pkbuf_copy(pkbuf_t *pkbuf); - -/** - * Create copies of some part of pkbufs. - * - * @param pkbuf pkbuf source of the copy - * @param offset offset into the packet buffer from where to begin copying - * len bytes - * @param len length of data to copy - */ -CORE_DECLARE(pkbuf_t*) pkbuf_copy_partial(pkbuf_t *pkbuf, - c_uint16_t offset, c_uint16_t len); - -/** - * Copy the whole contents of a packet buffer to an application supplied - * buffer. - * - * @param pkbuf pkbuf from which to copy data - * @param buf buffer to copy to - * @param buflen - */ -CORE_DECLARE(status_t) pkbuf_tobuf(pkbuf_t *pkbuf, - void *buf, c_uint16_t *buflen); - -/** - * Copy part of the contents of a packet buffer to an application supplied - * buffer. - * - * @param pkbuf pkbuf from which to copy data - * @param buf buffer to copy to - * @param buflen - * @param offset offset into the packet buffer from where - * to begin copying len bytes - * @param len length of data to copy - */ -CORE_DECLARE(status_t) pkbuf_tobuf_partial(pkbuf_t *pkbuf, - void *buf, c_uint16_t *buflen, c_uint16_t offset, c_uint16_t len); - -/** - * Get the total length of packet buffer */ -#define pkbuf_length(__pkbuf) (__pkbuf) ? ((__pkbuf)->tot_len : -1) - -/* memory handling library like OS-function(malloc,free) */ -CORE_DECLARE(void *) core_malloc(size_t size); -#define CORE_FREE(__pTR) d_assert(core_free(__pTR) == CORE_OK,,); -CORE_DECLARE(status_t) core_free(void *ptr); -CORE_DECLARE(void *) core_calloc(size_t nmemb, size_t size); -CORE_DECLARE(void *) core_realloc(void *ptr, size_t size); - -CORE_DECLARE(char *) core_strdup(const char *s); -CORE_DECLARE(char *) core_strndup(const char *s, size_t n); -CORE_DECLARE(void *) core_memdup(const void *m, size_t n); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __PKBUF_H__ */ diff --git a/lib/core/include/core_pool.h b/lib/core/include/core_pool.h deleted file mode 100644 index a7ab286b1..000000000 --- a/lib/core/include/core_pool.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __CORE_POOL_H__ -#define __CORE_POOL_H__ - -#include "core.h" -#include "core_mutex.h" - -#define pool_declare(__name, __type, __size) \ - typedef struct { \ - int head, tail; \ - int size, avail; \ - __type *free[__size], pool[__size]; \ - mutex_id mut; \ - } pool_##__name##_t; \ - pool_##__name##_t __name - -#define pool_init(__pname, __size) do { \ - int __i; \ - mutex_create(&(__pname)->mut, MUTEX_DEFAULT); \ - (__pname)->size = (__pname)->avail = __size; \ - (__pname)->head = (__pname)->tail = 0; \ - for (__i = 0; __i < __size; __i++) \ - (__pname)->free[__i] = &((__pname)->pool[__i]); \ -} while (0) - -#define pool_final(__pname) \ - ((__pname)->mut ? mutex_delete((__pname)->mut) : CORE_OK) - -#define pool_init_wo_lock(__pname, __size) do { \ - int __i; \ - (__pname)->mut = 0; \ - (__pname)->size = (__pname)->avail = __size; \ - (__pname)->head = (__pname)->tail = 0; \ - for (__i = 0; __i < __size; __i++) \ - (__pname)->free[__i] = &((__pname)->pool[__i]); \ -} while (0) - -#define pool_alloc_node(__pname, __pptr_node) do { \ - *(__pptr_node) = NULL; \ - if ((__pname)->mut) mutex_lock((__pname)->mut); \ - if ((__pname)->avail > 0) { \ - (__pname)->avail--; \ - *(__pptr_node) = (void*)(__pname)->free[(__pname)->head]; \ - (__pname)->free[(__pname)->head] = NULL; \ - (__pname)->head = ((__pname)->head + 1) % ((__pname)->size); \ - } \ - if ((__pname)->mut) mutex_unlock((__pname)->mut); \ -} while (0) - -#define pool_free_node(__pname, __ptr_node) do { \ - if ((__pname)->mut) mutex_lock((__pname)->mut); \ - if ((__pname)->avail < (__pname)->size) { \ - (__pname)->avail++; \ - (__pname)->free[(__pname)->tail] = (void*)(__ptr_node); \ - (__pname)->tail = ((__pname)->tail + 1) % ((__pname)->size); \ - } \ - if ((__pname)->mut) mutex_unlock((__pname)->mut); \ -} while (0) - -#define pool_size(__pname) ((__pname)->size) - -#define pool_avail(__pname) ((__pname)->avail) - -#define pool_used(__pname) (pool_size(__pname) - pool_avail(__pname)) - -#endif /* ! __CORE_POOL_H__ */ diff --git a/lib/core/include/core_portable.h b/lib/core/include/core_portable.h deleted file mode 100644 index 87a50e437..000000000 --- a/lib/core/include/core_portable.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* This header file is where you should put ANY platform specific information. - * This should be the only header file that programs need to include that - * actually has platform dependent code which refers to the . - */ -#ifndef __CORE_PORTABLE_H__ -#define __CORE_PORTABLE_H__ - -#include "core_thread.h" -#include "core_network.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef int os_file_t; /**< native file */ -typedef pthread_t os_thread_t; /**< native thread */ -typedef pid_t os_proc_t; /**< native pid */ -typedef int os_sock_t; /**< native socket */ - -/** - * convert the thread to os specific type from core type. - * @param thethd The core thread to convert - * @param thd The os specific thread we are converting to - */ -CORE_DECLARE(status_t) os_thread_get(os_thread_t **thethd, thread_id id); - -/** - * Get the thread ID - */ -CORE_DECLARE(os_thread_t) os_thread_current(void); - - -/** - * Convert the socket from an core type to an OS specific socket - * @param thesock The socket to convert. - * @param sock The os specific equivalent of the core socket.. - */ -CORE_DECLARE(status_t) os_sock_get(os_sock_t *thesock, sock_id id); - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_PORTABLE_H__ */ diff --git a/lib/core/include/core_queue.h b/lib/core/include/core_queue.h deleted file mode 100644 index 901e6b331..000000000 --- a/lib/core/include/core_queue.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __CORE_QUEUE_H__ -#define __CORE_QUEUE_H__ - -#include "core.h" - -#define que_declare(__name, __type, __size) \ - struct { \ - int head, tail, size, used; \ - __type pool[(__size)]; \ - } __name - -#define que_init(__pname, __size) \ - ((__pname)->head = (__pname)->tail = 0, \ - (__pname)->used = 0, \ - (__pname)->size = __size) - -#define que_push(__pname, __ptr_node) \ - ((__pname)->used == ((__pname)->size) ? -1 : \ - (((__pname)->pool[(__pname)->head] = *(__ptr_node), \ - (__pname)->head = ((__pname)->head + 1) % ((__pname)->size), \ - ++(__pname)->used))) - - -#define que_pop(__pname, __ptr_node) \ - ((__pname)->used == 0 ? -1 : \ - ((*(__ptr_node) = (__pname)->pool[(__pname)->tail], \ - (__pname)->tail = ((__pname)->tail + 1) % ((__pname)->size), \ - --(__pname)->used))) - -#define que_is_empty(__pname) ((__pname)->used == 0) - -#define que_is_full(__pname) ((__pname)->used == (__pname)->size) - -#define que_size(__pname) ((__pname)->size) - -#define que_used(__pname) ((__pname)->used) - -#define que_avail(__pname) (que_size(__pname) - que_used(__pname)) - -#endif /* ! __CORE_QUEUE_H__ */ diff --git a/lib/core/include/core_ringbuf.h b/lib/core/include/core_ringbuf.h deleted file mode 100644 index c1a5bee89..000000000 --- a/lib/core/include/core_ringbuf.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __CORE_RINGBUF_H__ -#define __CORE_RINGBUF_H__ - -#include "core.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -struct _rbuf_header_t { - int head, tail, size; - char *pool; -}; - -#define rbuf_declare(__name, __size) \ - struct { \ - struct _rbuf_header_t h; \ - char int_pool[(__size) + 1]; \ - } __name - -#define rbuf_declare_ext(__name) \ - struct { \ - struct _rbuf_header_t h; \ - } __name - -#define rbuf_init(__pname, __size) \ - ((__pname)->h.head = (__pname)->h.tail = 0, \ - (__pname)->h.size = __size, \ - (__pname)->h.pool = (__pname)->int_pool) - -#define rbuf_init_ext(__pname, __size, __ext_pool) \ - ((__pname)->h.head = (__pname)->h.tail = 0, \ - (__pname)->h.size = __size, \ - (__pname)->h.pool = (char *)(__ext_pool)) - -#define rbuf_size(__pname) ((__pname)->h.size) - -#define rbuf_is_empty(__pname) ((__pname)->h.head == (__pname)->h.tail) -#define rbuf_is_full(__pname) (rbuf_free_bytes(__pname) == 0) - -CORE_DECLARE(int) rbuf_bytes(void *__pname); - -CORE_DECLARE(int) rbuf_free_bytes(void *__pname); - -CORE_DECLARE(int) rbuf_skip_write_pos(void *__pname, int __len); - -CORE_DECLARE(int) rbuf_write(void *__pname, const char *__buf, int __buf_len); - -CORE_DECLARE(int) rbuf_skip_read_pos(void *__pname, int __len); - -CORE_DECLARE(int) rbuf_read(void *__pname, char *__buf, int __buf_len); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_RINGBUF_H__ */ diff --git a/lib/core/include/core_rwlock.h b/lib/core/include/core_rwlock.h deleted file mode 100644 index 831e081e6..000000000 --- a/lib/core/include/core_rwlock.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef __CORE_RWLOCK_H__ -#define __CORE_RWLOCK_H__ - -/** - * @file rwlock.h - * @brief CORE Reader/Writer Lock Routines - */ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup rwlock Reader/Writer Lock Routines - * @ingroup CORE - * @{ - */ - -/** Opaque read-write thread-safe lock. */ -typedef c_uintptr_t rwlock_id; - -/** - * Initialize Read-Write Lock Pool - */ -CORE_DECLARE(status_t) rwlock_init(void); - -/** - * Finalize Read-Write Lock Pool - */ -CORE_DECLARE(status_t) rwlock_final(void); - -/** - * Note: The following operations have undefined results: unlocking a - * read-write lock which is not locked in the calling thread; write - * locking a read-write lock which is already locked by the calling - * thread; destroying a read-write lock more than once; clearing or - * destroying the pool from which a locked read-write lock is - * allocated. - */ - -/** - * Create and initialize a read-write lock that can be used to synchronize - * threads. - * @param id the memory address where the newly created readwrite lock - * will be stored. - */ -CORE_DECLARE(status_t) rwlock_create(rwlock_id *id); -/** - * Acquire a shared-read lock on the given read-write lock. This will allow - * multiple threads to enter the same critical section while they have acquired - * the read lock. - * @param id the read-write lock on which to acquire the shared read. - */ -CORE_DECLARE(status_t) rwlock_rdlock(rwlock_id id); - -/** - * Attempt to acquire the shared-read lock on the given read-write lock. This - * is the same as rwlock_rdlock(), only that the function fails - * if there is another thread holding the write lock, or if there are any - * write threads blocking on the lock. If the function fails for this case, - * CORE_EBUSY will be returned. Note: it is important that the - * CORE_STATUS_IS_EBUSY(s) macro be used to determine if the return value was - * CORE_EBUSY, for portability reasons. - * @param id the rwlock on which to attempt the shared read. - */ -CORE_DECLARE(status_t) rwlock_tryrdlock(rwlock_id id); - -/** - * Acquire an exclusive-write lock on the given read-write lock. This will - * allow only one single thread to enter the critical sections. If there - * are any threads currently holding the read-lock, this thread is put to - * sleep until it can have exclusive access to the lock. - * @param id the read-write lock on which to acquire the exclusive write. - */ -CORE_DECLARE(status_t) rwlock_wrlock(rwlock_id id); - -/** - * Attempt to acquire the exclusive-write lock on the given read-write lock. - * This is the same as rwlock_wrlock(), only that the function fails - * if there is any other thread holding the lock (for reading or writing), - * in which case the function will return CORE_EBUSY. Note: it is important - * that the CORE_STATUS_IS_EBUSY(s) macro be used to determine if the return - * value was CORE_EBUSY, for portability reasons. - * @param id the rwlock on which to attempt the exclusive write. - */ -CORE_DECLARE(status_t) rwlock_trywrlock(rwlock_id id); - -/** - * Release either the read or write lock currently held by the calling thread - * associated with the given read-write lock. - * @param id the read-write lock to be released (unlocked). - */ -CORE_DECLARE(status_t) rwlock_unlock(rwlock_id id); - -/** - * Destroy the read-write lock and free the associated memory. - * @param id the rwlock to destroy. - */ -CORE_DECLARE(status_t) rwlock_delete(rwlock_id id); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_RWLOCK_H__ */ diff --git a/lib/core/include/core_semaphore.h b/lib/core/include/core_semaphore.h deleted file mode 100644 index 48df39279..000000000 --- a/lib/core/include/core_semaphore.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __SEMAPHORE_H__ -#define __SEMAPHORE_H__ - -/** - * @file semaphore.h - * @brief Core Mutex Routines - */ - -#include "core.h" -#include "core_errno.h" -#include "core_time.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup semaphore Routines - * @ingroup CORE - * @{ - */ - -/** Opaque semaphore structure */ -typedef c_uintptr_t semaphore_id; - -/** - * Initialize Mutex Pool - */ -CORE_DECLARE(status_t) semaphore_init(void); - -/** - * Finalize Mutex Pool - */ -CORE_DECLARE(status_t) semaphore_final(void); - -/** - * Create and initialize a semaphore that can be used to synchronize processes. - * @param id the memory address where the newly created semaphore will be - * stored. - * @value initial value for semaphore - */ -CORE_DECLARE(status_t) semaphore_create(semaphore_id *id, c_uint32_t value); -/** - * Put the active calling thread to sleep until signaled to wake up. - * @param id the semaphore variable on which to block. - */ -CORE_DECLARE(status_t) semaphore_wait(semaphore_id id); - -#if HAVE_SEM_TIMEDWAIT -/** - * Put the active calling thread to sleep until signaled to wake up or - * the timeout is reached. - * @param id the semaphore variable on which to block. - * @param timeout The amount of time in microsesemaphores to wait. This is - * a maximum, not a minimum. If the semaphoreition is signaled, we - * will wake up before this time, otherwise the error CORE_TIMEUP - * is returned. - */ -CORE_DECLARE(status_t) semaphore_timedwait(semaphore_id id, c_time_t timeout); -#endif - -/** - * Posts a single thread, if one exists, that is blocking on the given - * semaphore variable. - * @param id the semaphore variable on which to produce the signal. - */ -CORE_DECLARE(status_t) semaphore_post(semaphore_id id); - -/** - * Destroy the semaphore and free the memory associated with the lock. - * @param semaphore the semaphore to destroy. - */ -CORE_DECLARE(status_t) semaphore_delete(semaphore_id id); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __SEMAPHORE_H__ */ diff --git a/lib/core/include/core_sha1.h b/lib/core/include/core_sha1.h deleted file mode 100644 index 17c5674e0..000000000 --- a/lib/core/include/core_sha1.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * sha1.h - * - * Copyright (C) 1998, 2009 - * Paul E. Jones - * All Rights Reserved - * - ***************************************************************************** - * $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $ - ***************************************************************************** - * - * Description: - * This class implements the Secure Hashing Standard as defined - * in FIPS PUB 180-1 published April 17, 1995. - * - * Many of the variable names in the sha1_ctx, especially the - * single character names, were used because those were the names - * used in the publication. - * - * Please read the file sha1.c for more information. - * - */ - -#ifndef _CORE_SHA1_H_ -#define _CORE_SHA1_H_ - -#include "core.h" - -#define SHA1_DIGEST_SIZE (160 / 8) -#define SHA1_BLOCK_SIZE (512 / 8) - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct sha1_ctx -{ - unsigned Message_Digest[5]; /* Message Digest (output) */ - - unsigned Length_Low; /* Message length in bits */ - unsigned Length_High; /* Message length in bits */ - - unsigned char Message_Block[64]; /* 512-bit message blocks */ - int Message_Block_Index; /* Index into message block array */ - - int Computed; /* Is the digest computed? */ - int Corrupted; /* Is the message digest corruped? */ -} sha1_ctx; - -CORE_DECLARE(void) sha1_init(sha1_ctx *ctx); -CORE_DECLARE(void) sha1_update(sha1_ctx *ctx, const c_uint8_t *message, - c_uint32_t len); -CORE_DECLARE(void) sha1_final(sha1_ctx *ctx, c_uint8_t *digest); -CORE_DECLARE(void) sha1(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _CORE_SHA1_H_ */ diff --git a/lib/core/include/core_sha1_hmac.h b/lib/core/include/core_sha1_hmac.h deleted file mode 100644 index 50d41ae95..000000000 --- a/lib/core/include/core_sha1_hmac.h +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * HMAC-SHA-224/256/384/512 implementation - * Last update: 06/15/2005 - * Issue date: 06/15/2005 - * - * Copyright (C) 2005 Olivier Gay - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _CORE_HMAC_SHA1_H -#define _CORE_HMAC_SHA1_H - -#include "core_sha1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - sha1_ctx ctx_inside; - sha1_ctx ctx_outside; - - /* for hmac_reinit */ - sha1_ctx ctx_inside_reinit; - sha1_ctx ctx_outside_reinit; - - c_uint8_t block_ipad[SHA1_BLOCK_SIZE]; - c_uint8_t block_opad[SHA1_BLOCK_SIZE]; -} hmac_sha1_ctx; - -CORE_DECLARE(void) hmac_sha1_init(hmac_sha1_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size); -CORE_DECLARE(void) hmac_sha1_reinit(hmac_sha1_ctx *ctx); -CORE_DECLARE(void) hmac_sha1_update(hmac_sha1_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len); -CORE_DECLARE(void) hmac_sha1_final(hmac_sha1_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size); -CORE_DECLARE(void) hmac_sha1(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size); - -#ifdef __cplusplus -} -#endif - -#endif /* ! _CORE_HMAC_SHA1_H */ - diff --git a/lib/core/include/core_sha2.h b/lib/core/include/core_sha2.h deleted file mode 100644 index df095c315..000000000 --- a/lib/core/include/core_sha2.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * FIPS 180-2 SHA-224/256/384/512 implementation - * Last update: 02/02/2007 - * Issue date: 04/30/2005 - * - * Copyright (C) 2005, 2007 Olivier Gay - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _CORE_SHA2_H_ -#define _CORE_SHA2_H_ - -#include "core.h" - -#define SHA224_DIGEST_SIZE ( 224 / 8) -#define SHA256_DIGEST_SIZE ( 256 / 8) -#define SHA384_DIGEST_SIZE ( 384 / 8) -#define SHA512_DIGEST_SIZE ( 512 / 8) - -#define SHA256_BLOCK_SIZE ( 512 / 8) -#define SHA512_BLOCK_SIZE (1024 / 8) -#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE -#define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct { - c_uint32_t tot_len; - c_uint32_t len; - c_uint8_t block[2 * SHA256_BLOCK_SIZE]; - c_uint32_t h[8]; -} sha256_ctx; - -typedef struct { - c_uint32_t tot_len; - c_uint32_t len; - c_uint8_t block[2 * SHA512_BLOCK_SIZE]; - c_uint64_t h[8]; -} sha512_ctx; - -typedef sha512_ctx sha384_ctx; -typedef sha256_ctx sha224_ctx; - -CORE_DECLARE(void) sha224_init(sha224_ctx *ctx); -CORE_DECLARE(void) sha224_update(sha224_ctx *ctx, const c_uint8_t *message, - c_uint32_t len); -CORE_DECLARE(void) sha224_final(sha224_ctx *ctx, c_uint8_t *digest); -CORE_DECLARE(void) sha224(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest); - -CORE_DECLARE(void) sha256_init(sha256_ctx * ctx); -CORE_DECLARE(void) sha256_update(sha256_ctx *ctx, const c_uint8_t *message, - c_uint32_t len); -CORE_DECLARE(void) sha256_final(sha256_ctx *ctx, c_uint8_t *digest); -CORE_DECLARE(void) sha256(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest); - -CORE_DECLARE(void) sha384_init(sha384_ctx *ctx); -CORE_DECLARE(void) sha384_update(sha384_ctx *ctx, const c_uint8_t *message, - c_uint32_t len); -CORE_DECLARE(void) sha384_final(sha384_ctx *ctx, c_uint8_t *digest); -CORE_DECLARE(void) sha384(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest); - -CORE_DECLARE(void) sha512_init(sha512_ctx *ctx); -CORE_DECLARE(void) sha512_update(sha512_ctx *ctx, const c_uint8_t *message, - c_uint32_t len); -CORE_DECLARE(void) sha512_final(sha512_ctx *ctx, c_uint8_t *digest); -CORE_DECLARE(void) sha512(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* !_CORE_SHA2_H_ */ diff --git a/lib/core/include/core_sha2_hmac.h b/lib/core/include/core_sha2_hmac.h deleted file mode 100644 index 7907d3be3..000000000 --- a/lib/core/include/core_sha2_hmac.h +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * HMAC-SHA-224/256/384/512 implementation - * Last update: 06/15/2005 - * Issue date: 06/15/2005 - * - * Copyright (C) 2005 Olivier Gay - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _CORE_HMAC_SHA2_H -#define _CORE_HMAC_SHA2_H - -#include "core_sha2.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - sha224_ctx ctx_inside; - sha224_ctx ctx_outside; - - /* for hmac_reinit */ - sha224_ctx ctx_inside_reinit; - sha224_ctx ctx_outside_reinit; - - c_uint8_t block_ipad[SHA224_BLOCK_SIZE]; - c_uint8_t block_opad[SHA224_BLOCK_SIZE]; -} hmac_sha224_ctx; - -typedef struct { - sha256_ctx ctx_inside; - sha256_ctx ctx_outside; - - /* for hmac_reinit */ - sha256_ctx ctx_inside_reinit; - sha256_ctx ctx_outside_reinit; - - c_uint8_t block_ipad[SHA256_BLOCK_SIZE]; - c_uint8_t block_opad[SHA256_BLOCK_SIZE]; -} hmac_sha256_ctx; - -typedef struct { - sha384_ctx ctx_inside; - sha384_ctx ctx_outside; - - /* for hmac_reinit */ - sha384_ctx ctx_inside_reinit; - sha384_ctx ctx_outside_reinit; - - c_uint8_t block_ipad[SHA384_BLOCK_SIZE]; - c_uint8_t block_opad[SHA384_BLOCK_SIZE]; -} hmac_sha384_ctx; - -typedef struct { - sha512_ctx ctx_inside; - sha512_ctx ctx_outside; - - /* for hmac_reinit */ - sha512_ctx ctx_inside_reinit; - sha512_ctx ctx_outside_reinit; - - c_uint8_t block_ipad[SHA512_BLOCK_SIZE]; - c_uint8_t block_opad[SHA512_BLOCK_SIZE]; -} hmac_sha512_ctx; - -CORE_DECLARE(void) hmac_sha224_init(hmac_sha224_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size); -CORE_DECLARE(void) hmac_sha224_reinit(hmac_sha224_ctx *ctx); -CORE_DECLARE(void) hmac_sha224_update(hmac_sha224_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len); -CORE_DECLARE(void) hmac_sha224_final(hmac_sha224_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size); -CORE_DECLARE(void) hmac_sha224(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size); - -CORE_DECLARE(void) hmac_sha256_init(hmac_sha256_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size); -CORE_DECLARE(void) hmac_sha256_reinit(hmac_sha256_ctx *ctx); -CORE_DECLARE(void) hmac_sha256_update(hmac_sha256_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len); -CORE_DECLARE(void) hmac_sha256_final(hmac_sha256_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size); -CORE_DECLARE(void) hmac_sha256(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size); - -CORE_DECLARE(void) hmac_sha384_init(hmac_sha384_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size); -CORE_DECLARE(void) hmac_sha384_reinit(hmac_sha384_ctx *ctx); -CORE_DECLARE(void) hmac_sha384_update(hmac_sha384_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len); -CORE_DECLARE(void) hmac_sha384_final(hmac_sha384_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size); -CORE_DECLARE(void) hmac_sha384(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size); - -CORE_DECLARE(void) hmac_sha512_init(hmac_sha512_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size); -CORE_DECLARE(void) hmac_sha512_reinit(hmac_sha512_ctx *ctx); -CORE_DECLARE(void) hmac_sha512_update(hmac_sha512_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len); -CORE_DECLARE(void) hmac_sha512_final(hmac_sha512_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size); -CORE_DECLARE(void) hmac_sha512(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size); - -#ifdef __cplusplus -} -#endif - -#endif /* ! _CORE_HMAC_SHA2_H */ - diff --git a/lib/core/include/core_signal.h b/lib/core/include/core_signal.h deleted file mode 100644 index 9810fd926..000000000 --- a/lib/core/include/core_signal.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef CORE_SIGNAL_H -#define CORE_SIGNAL_H - -/** - * @file core_signal.h - * @brief CORE Signal Handling - */ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup core_signal Signal Handling - * @ingroup CORE - * @{ - */ - -/** - * Terminate a process. - * @param proc The process to terminate. - * @param sig How to kill the process. - */ -CORE_DECLARE(status_t) core_kill(pid_t pid, int sig); - -#if HAVE_SIGACTION - -#if defined(DARWIN) && !defined(__cplusplus) && !defined(_ANSI_SOURCE) -/* work around Darwin header file bugs - * http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html - */ -#undef SIG_DFL -#undef SIG_IGN -#undef SIG_ERR -#define SIG_DFL (void (*)(int))0 -#define SIG_IGN (void (*)(int))1 -#define SIG_ERR (void (*)(int))-1 -#endif - -/** Function prototype for signal handlers */ -typedef void core_sigfunc_t(int); - -/** - * Set the signal handler function for a given signal - * @param signo The signal (eg... SIGWINCH) - * @param func the function to get called - */ -CORE_DECLARE(core_sigfunc_t *) core_signal(int signo, core_sigfunc_t * func); - -#if defined(SIG_IGN) && !defined(SIG_ERR) -#define SIG_ERR ((core_sigfunc_t *) -1) -#endif - -#else /* !HAVE_SIGACTION */ -#define core_signal(a, b) signal(a, b) -#endif - - -/** - * Setup the process for a single thread to be used for all signal handling. - * @warning This must be called before any threads are created - */ -CORE_DECLARE(status_t) signal_init(void); - -/** - * Make the current thread listen for signals. This thread will loop - * forever, calling a provided function whenever it receives a signal. That - * functions should return 1 if the signal has been handled, 0 otherwise. - * @param signal_handler The function to call when a signal is received - * apr_status_t apr_signal_thread((int)(*signal_handler)(int signum)) - */ -CORE_DECLARE(status_t) signal_thread(int(*signal_handler)(int signum)); - -/** - * Block the delivery of a particular signal - * @param signum The signal number - * @return status - */ -CORE_DECLARE(status_t) signal_block(int signum); - -/** - * Enable the delivery of a particular signal - * @param signum The signal number - * @return status - */ -CORE_DECLARE(status_t) signal_unblock(int signum); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CORE_SIGNAL_H */ diff --git a/lib/core/include/core_tcp.h b/lib/core/include/core_tcp.h deleted file mode 100644 index 3767db7e0..000000000 --- a/lib/core/include/core_tcp.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __CORE_TCP_H__ -#define __CORE_TCP_H__ - -#include "core_sock.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -CORE_DECLARE(status_t) tcp_open(sock_id *new, - int family, - const char *local_host, c_uint16_t local_port, - const char *remote_host, c_uint16_t remote_port, - int flags); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/lib/core/include/core_thread.h b/lib/core/include/core_thread.h deleted file mode 100644 index d1866eb20..000000000 --- a/lib/core/include/core_thread.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef __CORE_THREAD_H__ -#define __CORE_THREAD_H__ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** Opaque Thread structure. */ -typedef c_uintptr_t thread_id; - -/** Opaque Thread attributes structure. */ -typedef struct threadattr_t threadattr_t; - -typedef void *(THREAD_FUNC *thread_start_t)(thread_id id, void*); - -/** - * Check if Thread Should Stop - */ -CORE_DECLARE(int) thread_should_stop(void); - -/** - * Initialize Thread - */ -CORE_DECLARE(status_t) thread_init(void); - -/** - * Finalize Thread - */ -CORE_DECLARE(status_t) thread_final(void); - -/** - * Create and initialize a new threadattr variable - * @param new_attr The newly created threadattr. - */ -CORE_DECLARE(status_t) threadattr_create(threadattr_t **new_attr); - -/** - * Set the stack size of newly created threads. - * @param attr The threadattr to affect - * @param stacksize The stack size in bytes - */ -CORE_DECLARE(status_t) threadattr_stacksize_set( - threadattr_t *attr, size_t stacksize); - -/** - * Delete and initialize a new threadattr variable - * @param new_attr The newly created threadattr. - */ -CORE_DECLARE(status_t) threadattr_delete(threadattr_t *attr); - -/** - * Create a new thread of execution - * @param id The newly created thread handle. - * @param attr The threadattr to use to determine how to create the thread - * @param func The function to start the new thread in - * @param data Any data to be passed to the starting function - */ -CORE_DECLARE(status_t) thread_create(thread_id *id, - threadattr_t *attr, thread_start_t func, void *data); - -/** - * Delete a new thread of execution - * @param id The thread to delete - */ -CORE_DECLARE(status_t) thread_delete(thread_id id); - -/** - * detach a thread - * @param thd The thread to detach - */ -CORE_DECLARE(status_t) thread_detach(thread_id id); - -/** - * stop the current thread - * @param thd The thread to stop - * @param retval The return value to pass back to any thread that cares - */ -CORE_DECLARE(status_t) thread_exit(thread_id id, status_t retval); - -/** - * block until the desired thread stops executing. - * @param retval The return value from the dead thread. - * @param thd The thread to join - */ -CORE_DECLARE(status_t) thread_join(status_t *retval, thread_id id); - -/** - * force the current thread to yield the processor - */ -CORE_DECLARE(void) thread_yield(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_THREAD_H__ */ diff --git a/lib/core/include/core_time.h b/lib/core/include/core_time.h deleted file mode 100644 index fab242688..000000000 --- a/lib/core/include/core_time.h +++ /dev/null @@ -1,196 +0,0 @@ -#ifndef __CORE_TIME_H__ -#define __CORE_TIME_H__ - -/** - * @file core_time.h - * @brief CORE Time Library - */ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup core_time Time Routines - * @ingroup CORE - * @{ - */ - -/** month names */ -CORE_DECLARE_DATA extern const char month_snames[12][4]; -/** day names */ -CORE_DECLARE_DATA extern const char day_snames[7][4]; - -/** number of microseconds since 00:00:00 january 1, 1970 UTC */ -typedef c_int64_t c_time_t; - -/** mechanism to properly type c_time_t literals */ -#define TIME_C(val) INT64_C(val) - -/** mechanism to properly print c_time_t values */ -#define TIME_T_FMT INT64_T_FMT - -/** number of microseconds per second */ -#define USEC_PER_SEC TIME_C(1000000) - -/** @return c_time_t as a second */ -#define time_sec(time) ((time) / USEC_PER_SEC) - -/** @return c_time_t as a usec */ -#define time_usec(time) ((time) % USEC_PER_SEC) - -/** @return c_time_t as a msec */ -#define time_msec(time) (((time) / 1000) % 1000) - -/** @return c_time_t as a msec */ -#define time_as_msec(time) ((time) / 1000) - -/** @return milliseconds as an c_time_t */ -#define time_from_msec(msec) ((c_time_t)(msec) * 1000) - -/** @return seconds as an c_time_t */ -#define time_from_sec(sec) ((c_time_t)(sec) * USEC_PER_SEC) - -/** @return a second and usec combination as an c_time_t */ -#define time_make(sec, usec) ((c_time_t)(sec) * USEC_PER_SEC \ - + (c_time_t)(usec)) -/** @see time_exp_t */ -typedef struct time_exp_t time_exp_t; - -/** - * a structure similar to ANSI struct tm with the following differences: - * - tm_usec isn't an ANSI field - * - tm_gmtoff isn't an ANSI field (it's a bsdism) - */ -struct time_exp_t { - /** microseconds past tm_sec */ - int32_t tm_usec; - /** (0-61) seconds past tm_min */ - int32_t tm_sec; - /** (0-59) minutes past tm_hour */ - int32_t tm_min; - /** (0-23) hours past midnight */ - int32_t tm_hour; - /** (1-31) day of the month */ - int32_t tm_mday; - /** (0-11) month of the year */ - int32_t tm_mon; - /** year since 1900 */ - int32_t tm_year; - /** (0-6) days since sunday */ - int32_t tm_wday; - /** (0-365) days since jan 1 */ - int32_t tm_yday; - /** daylight saving time */ - int32_t tm_isdst; - /** seconds east of UTC */ - int32_t tm_gmtoff; -}; - -/** - * @return the current time - */ -CORE_DECLARE(c_time_t) time_now(void); - -/** - * Sleep for the specified number of micro-seconds. - * @param t desired amount of time to sleep. - * @warning May sleep for longer than the specified time. - */ -CORE_DECLARE(void) core_sleep(c_time_t t); - -/** - * convert an ansi time_t to an c_time_t - * @param result the resulting c_time_t - * @param input the time_t to convert - */ -CORE_DECLARE(status_t) time_ansi_put(c_time_t *result, time_t input); - -/** - * convert a time to its human readable components using an offset - * from GMT - * @param result the exploded time - * @param input the time to explode - * @param offs the number of seconds offset to apply - */ -CORE_DECLARE(status_t) time_exp_tz(time_exp_t *result, - c_time_t input, int32_t offs); - -/** - * convert a time to its human readable components in GMT timezone - * @param result the exploded time - * @param input the time to explode - */ -CORE_DECLARE(status_t) time_exp_gmt(time_exp_t *result, c_time_t input); - -/** - * convert a time to its human readable components in local timezone - * @param result the exploded time - * @param input the time to explode - */ -CORE_DECLARE(status_t) time_exp_lt(time_exp_t *result, c_time_t input); - -/** - * Convert time value from human readable format to a numeric c_time_t - * e.g. elapsed usec since epoch - * @param result the resulting imploded time - * @param input the input exploded time - */ -CORE_DECLARE(status_t) time_exp_get(c_time_t *result, time_exp_t *input); - -/** - * Convert time value from human readable format to a numeric c_time_t that - * always represents GMT - * @param result the resulting imploded time - * @param input the input exploded time - */ -CORE_DECLARE(status_t) time_exp_gmt_get(c_time_t *result, time_exp_t *input); - -/** length of a RFC822 Date */ -#define APR_RFC822_DATE_LEN (30) -/** - * rfc822_date formats dates in the RFC822 - * format in an efficient manner. It is a fixed length - * format which requires the indicated amount of storage, - * including the trailing NUL terminator. - * @param date_str String to write to. - * @param t the time to convert - */ -CORE_DECLARE(status_t) rfc822_date(char *date_str, c_time_t t); - -/** length of a CTIME date */ -#define CTIME_LEN (25) -/** - * ctime formats dates in the ctime() format - * in an efficient manner. it is a fixed length format - * and requires the indicated amount of storage including - * the trailing NUL terminator. - * Unlike ANSI/ISO C ctime(), ctime() does not include - * a \n at the end of the string. - * @param date_str String to write to. - * @param t the time to convert - */ -CORE_DECLARE(status_t) core_ctime(char *date_str, c_time_t t); - -/** - * formats the exploded time according to the format specified - * @param s string to write to - * @param retsize The length of the returned string - * @param max The maximum length of the string - * @param format The format for the time string - * @param tm The time to convert - */ -CORE_DECLARE(status_t) core_strftime(char *s, size_t *retsize, - size_t max, const char *format, - time_exp_t *tm); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! __CORE_TIME_H__ */ diff --git a/lib/core/include/core_timer.h b/lib/core/include/core_timer.h deleted file mode 100644 index e0a7714f7..000000000 --- a/lib/core/include/core_timer.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __CORE_TIMER_H__ -#define __CORE_TIMER_H__ - -#include "core.h" -#include "core_errno.h" -#include "core_list.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef enum _tm_type { - TIMER_TYPE_ONE_SHOT, - TIMER_TYPE_PERIODIC -} tm_type_e; - -typedef struct _tm_service_t { - list_t active_list; - list_t idle_list; - /* timer basic element */ -} tm_service_t; - -typedef c_uintptr_t tm_block_id; - -typedef void (*expire_func_t)(c_uintptr_t data, - c_uintptr_t param1, c_uintptr_t param2, c_uintptr_t param3, - c_uintptr_t param4, c_uintptr_t param5, c_uintptr_t param6); - -typedef struct _tm_desc_t { - tm_type_e type; - c_uint32_t duration; - expire_func_t expire_func; - c_uintptr_t param1; - c_uintptr_t param2; - c_uintptr_t param3; - c_uintptr_t param4; - c_uintptr_t param5; - c_uintptr_t param6; -} tm_desc_t; - -CORE_DECLARE(status_t) tm_init(void); -CORE_DECLARE(status_t) tm_final(void); - -CORE_DECLARE(c_uint32_t) tm_pool_avail(void); - -CORE_DECLARE(void) tm_service_init(tm_service_t *tm_service); -CORE_DECLARE(status_t) tm_execute_tm_service( - tm_service_t *p_tm_s, c_uintptr_t data); - -CORE_DECLARE(tm_block_id) tm_create(tm_service_t *tm_service, - tm_type_e type, c_uint32_t duration, expire_func_t expire_func); -CORE_DECLARE(void) tm_delete(tm_block_id id); -CORE_DECLARE(status_t) tm_set_duration(tm_block_id id, c_uint32_t duration); -CORE_DECLARE(status_t) tm_set_param1(tm_block_id id, c_uintptr_t param); -CORE_DECLARE(status_t) tm_set_param2(tm_block_id id, c_uintptr_t param); -CORE_DECLARE(status_t) tm_set_param3(tm_block_id id, c_uintptr_t param); -CORE_DECLARE(status_t) tm_set_param4(tm_block_id id, c_uintptr_t param); -CORE_DECLARE(status_t) tm_set_param5(tm_block_id id, c_uintptr_t param); -CORE_DECLARE(status_t) tm_set_param6(tm_block_id id, c_uintptr_t param); -CORE_DECLARE(status_t) tm_start(tm_block_id id); -CORE_DECLARE(status_t) tm_stop(tm_block_id id); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/lib/core/include/core_tlv.h b/lib/core/include/core_tlv.h deleted file mode 100644 index e0f09c35d..000000000 --- a/lib/core/include/core_tlv.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __CORE_TLV_H__ -#define __CORE_TLV_H__ - -#include "core.h" -#include "core_pool.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define TLV_MODE_T1_L1 1 -#define TLV_MODE_T1_L2 2 -#define TLV_MODE_T1_L2_I1 3 -#define TLV_MODE_T2_L2 4 - -#define NUM_OF_TLV_NODE 100 - -/* tlv_t struncture */ - -typedef struct _tlv_t -{ - /* for tlv management */ - struct _tlv_t* head; - struct _tlv_t* tail; /* this is used only for head tlv_t */ - struct _tlv_t* next; - - struct _tlv_t* parent; - struct _tlv_t* embedded; - - - /* tlv basic element */ - c_uint32_t type; - c_uint32_t length; - c_uint8_t instance; - void* value; - - /* can be needed in encoding tlv_t*/ - c_uint8_t buff_allocated; - c_uint32_t buff_len; - c_uint8_t* buff_ptr; - c_uint8_t* buff; -} tlv_t; - -#define tlv_type(pTlv) pTlv->type -#define tlv_length(pTlv) pTlv->length -#define tlv_instance(pTlv) pTlv->instance -#define tlv_value(pTlv) pTlv->value - -/* tlv_t pool related functions */ -CORE_DECLARE(tlv_t*) tlv_get(void); -CORE_DECLARE(void) tlv_free(tlv_t *pTlv); -CORE_DECLARE(void) tlv_free_all(tlv_t *rootTlv); - -CORE_DECLARE(status_t) tlv_init(void); -CORE_DECLARE(status_t) tlv_final(void); - -/* tlv_t encoding functions */ -CORE_DECLARE(tlv_t*) tlv_add(tlv_t *headTlv, - c_uint32_t type, c_uint32_t length, c_uint8_t instance, c_uint8_t *value); -CORE_DECLARE(tlv_t*) tlv_copy(c_uint8_t *buff, c_uint32_t buff_len, - c_uint32_t type, c_uint32_t length, c_uint8_t instance, c_uint8_t *value); -CORE_DECLARE(tlv_t*) tlv_embed(tlv_t *parent_tlv, - c_uint32_t type, c_uint32_t length, c_uint8_t instance, c_uint8_t *value); - -CORE_DECLARE(c_uint32_t) tlv_render( - tlv_t *rootTlv, c_uint8_t *blk, c_uint32_t length, c_uint8_t mode); - -/* tlv_t parsing functions */ -CORE_DECLARE(tlv_t*) tlv_parse_block( - c_uint32_t length, c_uint8_t *blk, c_uint8_t mode); -CORE_DECLARE(tlv_t*) tlv_parse_embedded_block(tlv_t* pTlv, c_uint8_t mode); - -/* tlv operation-related function */ -CORE_DECLARE(tlv_t*) tlv_find(tlv_t* pTlv, c_uint32_t type); -CORE_DECLARE(tlv_t*) tlv_find_root(tlv_t* pTlv); -CORE_DECLARE(c_uint32_t) tlv_pool_avail(void); -CORE_DECLARE(c_uint32_t) tlv_calc_length(tlv_t *p_tlv, c_uint8_t mode); -CORE_DECLARE(c_uint32_t) tlv_calc_count(tlv_t *p_tlv); -CORE_DECLARE(c_uint8_t) tlv_value_8(tlv_t *tlv); -CORE_DECLARE(c_uint16_t) tlv_value_16(tlv_t *tlv); -CORE_DECLARE(c_uint32_t) tlv_value_32(tlv_t *tlv); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* !__CORE_TLV_H__ */ diff --git a/lib/core/include/core_udp.h b/lib/core/include/core_udp.h deleted file mode 100644 index ea2a18d79..000000000 --- a/lib/core/include/core_udp.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __CORE_UDP_H__ -#define __CORE_UDP_H__ - -#include "core_sock.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -CORE_DECLARE(status_t) udp_open(sock_id *new, - int family, - const char *local_host, c_uint16_t local_port, - const char *remote_host, c_uint16_t remote_port, - int flags); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/lib/core/include/core_version.h b/lib/core/include/core_version.h deleted file mode 100644 index bf5a8505f..000000000 --- a/lib/core/include/core_version.h +++ /dev/null @@ -1,141 +0,0 @@ -#ifndef __CORE_VERSION_H__ -#define __CORE_VERSION_H__ - -/** - * @file version.h - * @brief CORE Versioning Interface - * - * CORE's Version - * - * There are several different mechanisms for accessing the version. There - * is a string form, and a set of numbers; in addition, there are constants - * which can be compiled into your application, and you can query the library - * being used for its actual version. - * - * Note that it is possible for an application to detect that it has been - * compiled against a different version of CORE by use of the compile-time - * constants and the use of the run-time query function. - * - */ - - -/* The numeric compile-time version constants. These constants are the - * authoritative version numbers for CORE. - */ - -/** major version - * Major API changes that could cause compatibility problems for older - * programs such as structure size changes. No binary compatibility is - * possible across a change in the major version. - */ -#define CORE_MAJOR_VERSION 1 - -/** minor version - * Minor API changes that do not cause binary compatibility problems. - * Reset to 0 when upgrading CORE_MAJOR_VERSION - */ -#define CORE_MINOR_VERSION 0 - -/** patch level - * The Patch Level never includes API changes, simply bug fixes. - * Reset to 0 when upgrading CORE_MINOR_VERSION - */ -#define CORE_PATCH_VERSION 0 - -/** - * The symbol CORE_IS_DEV_VERSION is only defined for internal, - * "development" copies of CORE. It is undefined for released versions - * of CORE. - */ -#define CORE_IS_DEV_VERSION - -/** - * Check at compile time if the CORE version is at least a certain - * level. - * @param major The major version component of the version checked - * for (e.g., the "1" of "1.3.0"). - * @param minor The minor version component of the version checked - * for (e.g., the "3" of "1.3.0"). - * @param patch The patch level component of the version checked - * for (e.g., the "0" of "1.3.0"). - * @remark This macro is available with CORE versions starting with - * 1.3.0. - */ -#define CORE_VERSION_AT_LEAST(major,minor,patch) \ -(((major) < CORE_MAJOR_VERSION) \ - || ((major) == CORE_MAJOR_VERSION && (minor) < CORE_MINOR_VERSION) \ - || ((major) == CORE_MAJOR_VERSION && (minor) == CORE_MINOR_VERSION && (patch) <= CORE_PATCH_VERSION)) - -#if defined(CORE_IS_DEV_VERSION) || defined(DOXYGEN) -/** Internal: string form of the "is dev" flag */ -#define CORE_IS_DEV_STRING "-dev" -#else -#define CORE_IS_DEV_STRING "" -#endif - -/* STRINGIFY is defined here, and also in general.h, so wrap it */ -#ifndef STRINGIFY -/** Properly quote a value as a string in the C preprocessor */ -#define STRINGIFY(n) STRINGIFY_HELPER(n) -/** Helper macro for STRINGIFY */ -#define STRINGIFY_HELPER(n) #n -#endif - -/** The formatted string of CORE's version */ -#define CORE_VERSION_STRING \ - STRINGIFY(CORE_MAJOR_VERSION) "." \ - STRINGIFY(CORE_MINOR_VERSION) "." \ - STRINGIFY(CORE_PATCH_VERSION) \ - CORE_IS_DEV_STRING - -/** An alternative formatted string of CORE's version */ -/* macro for Win32 .rc files using numeric csv representation */ -#define CORE_VERSION_STRING_CSV CORE_MAJOR_VERSION ##, \ - ##CORE_MINOR_VERSION ##, \ - ##CORE_PATCH_VERSION - - -#ifndef __CORE_VERSION_ONLY__ - -/* The C language API to access the version at run time, - * as opposed to compile time. CORE_VERSION_ONLY may be defined - * externally when preprocessing version.h to obtain strictly - * the C Preprocessor macro declarations. - */ - -#include "core.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * The numeric version information is broken out into fields within this - * structure. - */ -typedef struct -{ - int major; /**< major number */ - int minor; /**< minor number */ - int patch; /**< patch number */ - int is_dev; /**< is development (1 or 0) */ -} core_version_t; - -/** - * Return CORE's version information information in a numeric form. - * - * @param pvsn Pointer to a version structure for returning the version - * information. - */ -CORE_DECLARE(void) core_version(core_version_t *pvsn); - -/** Return CORE's version information as a string. */ -CORE_DECLARE(const char *) core_version_string(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ndef CORE_VERSION_ONLY */ - -#endif /* ndef CORE_VERSION_H */ diff --git a/lib/core/src/Makefile.am b/lib/core/src/Makefile.am deleted file mode 100644 index ea0a0a012..000000000 --- a/lib/core/src/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -## Process this file with automake to produce Makefile.in - -pkglib_LTLIBRARIES = libcore.la - -libcore_la_SOURCES = \ - ../include/core_aes_cmac.h ../include/core_aes.h ../include/core_cond.h \ - ../include/core_debug.h ../include/core_errno.h ../include/core_file.h \ - ../include/core_fsm.h ../include/core_general.h ../include/core.h \ - ../include/core.h.in ../include/core_index.h ../include/core_lib.h \ - ../include/core_list.h ../include/core_msgq.h ../include/core_mutex.h \ - ../include/core_network.h ../include/core_param.h ../include/core_pkbuf.h \ - ../include/core_pool.h ../include/core_queue.h ../include/core_ringbuf.h \ - ../include/core_rwlock.h ../include/core_semaphore.h ../include/core_sha1.h \ - ../include/core_sha1_hmac.h ../include/core_sha2.h ../include/core_sha2_hmac.h \ - ../include/core_signal.h ../include/core_thread.h ../include/core_time.h \ - ../include/core_timer.h ../include/core_tlv.h ../include/core_tlv_msg.h \ - ../include/core_atomic.h ../include/core_portable.h \ - ../include/core_version.h ../include/core_event.h ../include/core_hash.h \ - ../include/3gpp_types.h \ - \ - debug.c version.c fsm.c msgq.c ringbuf.c timer.c tlv.c tlv_msg.c hash.c \ - aes.c aes_cmac.c sha1.c sha1_hmac.c sha2.c sha2_hmac.c misc.c event.c \ - 3gpp_types.c \ - \ - ../include/arch/core_private_common.h \ - ../include/arch/unix/core_arch_file.h \ - ../include/arch/unix/core_arch_mutex.h \ - ../include/arch/unix/core_arch_semaphore.h \ - ../include/arch/unix/core_arch_thread.h \ - unix/start.c unix/errorcodes.c unix/pkbuf.c \ - unix/rand.c unix/time.c unix/file.c \ - unix/thread.c unix/signal.c \ - unix/atomic.c unix/cond.c unix/mutex.c unix/rwlock.c unix/semaphore.c \ - unix/socket.c unix/sockaddr.c unix/udp.c unix/tcp.c unix/tun.c \ - $(NULL) - -if !USRSCTP -libcore_la_SOURCES += unix/sctp.c -endif - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ \ - $(NULL) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include/arch/@OSDIR@ \ - -I$(top_srcdir)/lib/core/include \ - $(NULL) - -AM_CFLAGS = \ - -Wall -Werror \ - @OSCPPFLAGS@ \ - $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/lib/core/src/aes.c b/lib/core/src/aes.c deleted file mode 100644 index 58bcb0fdb..000000000 --- a/lib/core/src/aes.c +++ /dev/null @@ -1,1451 +0,0 @@ -#define FULL_UNROLL - -#define TRACE_MODULE _aes -#include "core_debug.h" -#include "core_aes.h" - -static const c_uint32_t Te0[256] = -{ - 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, - 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, - 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, - 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, - 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, - 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, - 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, - 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, - 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, - 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, - 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, - 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, - 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, - 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, - 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, - 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, - 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, - 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, - 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, - 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, - 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, - 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, - 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, - 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, - 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, - 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, - 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, - 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, - 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, - 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, - 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, - 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, - 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, - 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, - 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, - 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, - 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, - 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, - 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, - 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, - 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, - 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, - 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, - 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, - 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, - 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, - 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, - 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, - 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, - 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, - 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, - 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, - 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, - 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, - 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, - 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, - 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, - 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, - 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, - 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, - 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, - 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, - 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, - 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, -}; - -static const c_uint32_t Te1[256] = -{ - 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, - 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, - 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, - 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, - 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, - 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, - 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, - 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, - 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, - 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, - 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, - 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, - 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, - 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, - 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, - 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, - 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, - 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, - 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, - 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, - 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, - 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, - 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, - 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, - 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, - 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, - 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, - 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, - 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, - 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, - 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, - 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, - 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, - 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, - 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, - 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, - 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, - 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, - 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, - 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, - 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, - 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, - 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, - 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, - 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, - 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, - 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, - 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, - 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, - 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, - 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, - 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, - 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, - 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, - 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, - 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, - 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, - 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, - 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, - 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, - 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, - 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, - 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, - 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, -}; - -static const c_uint32_t Te2[256] = -{ - 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, - 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, - 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, - 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, - 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, - 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, - 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, - 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, - 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, - 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, - 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, - 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, - 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, - 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, - 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, - 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, - 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, - 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, - 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, - 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, - 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, - 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, - 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, - 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, - 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, - 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, - 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, - 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, - 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, - 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, - 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, - 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, - 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, - 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, - 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, - 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, - 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, - 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, - 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, - 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, - 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, - 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, - 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, - 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, - 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, - 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, - 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, - 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, - 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, - 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, - 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, - 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, - 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, - 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, - 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, - 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, - 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, - 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, - 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, - 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, - 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, - 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, - 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, - 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, -}; - -static const c_uint32_t Te3[256] = -{ - 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, - 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, - 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, - 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, - 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, - 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, - 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, - 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, - 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, - 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, - 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, - 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, - 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, - 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, - 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, - 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, - 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, - 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, - 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, - 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, - 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, - 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, - 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, - 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, - 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, - 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, - 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, - 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, - 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, - 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, - 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, - 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, - 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, - 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, - 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, - 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, - 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, - 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, - 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, - 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, - 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, - 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, - 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, - 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, - 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, - 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, - 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, - 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, - 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, - 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, - 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, - 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, - 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, - 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, - 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, - 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, - 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, - 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, - 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, - 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, - 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, - 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, - 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, - 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, -}; - -static const c_uint32_t Te4[256] = -{ - 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, - 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, - 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, - 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, - 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, - 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, - 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, - 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, - 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, - 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, - 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, - 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, - 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, - 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, - 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, - 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, - 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, - 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, - 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, - 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, - 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, - 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, - 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, - 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, - 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, - 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, - 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, - 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, - 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, - 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, - 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, - 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, - 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, - 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, - 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, - 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, - 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, - 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, - 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, - 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, - 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, - 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, - 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, - 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, - 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, - 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, - 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, - 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, - 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, - 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, - 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, - 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, - 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, - 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, - 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, - 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, - 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, - 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, - 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, - 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, - 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, - 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, - 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, - 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, -}; - -static const c_uint32_t Td0[256] = -{ - 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, - 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, - 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, - 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, - 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, - 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, - 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, - 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, - 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, - 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, - 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, - 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, - 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, - 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, - 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, - 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, - 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, - 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, - 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, - 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, - 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, - 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, - 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, - 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, - 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, - 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, - 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, - 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, - 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, - 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, - 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, - 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, - 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, - 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, - 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, - 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, - 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, - 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, - 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, - 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, - 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, - 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, - 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, - 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, - 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, - 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, - 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, - 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, - 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, - 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, - 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, - 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, - 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, - 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, - 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, - 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, - 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, - 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, - 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, - 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, - 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, - 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, - 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, - 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, -}; - -static const c_uint32_t Td1[256] = -{ - 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, - 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, - 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, - 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, - 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, - 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, - 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, - 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, - 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, - 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, - 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, - 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, - 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, - 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, - 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, - 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, - 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, - 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, - 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, - 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, - 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, - 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, - 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, - 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, - 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, - 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, - 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, - 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, - 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, - 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, - 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, - 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, - 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, - 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, - 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, - 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, - 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, - 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, - 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, - 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, - 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, - 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, - 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, - 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, - 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, - 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, - 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, - 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, - 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, - 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, - 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, - 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, - 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, - 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, - 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, - 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, - 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, - 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, - 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, - 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, - 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, - 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, - 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, - 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, -}; - -static const c_uint32_t Td2[256] = -{ - 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, - 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, - 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, - 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, - 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, - 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, - 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, - 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, - 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, - 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, - 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, - 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, - 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, - 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, - 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, - 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, - 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, - 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, - 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, - 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, - 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, - 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, - 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, - 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, - 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, - 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, - 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, - 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, - 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, - 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, - 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, - 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, - 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, - 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, - 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, - 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, - 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, - 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, - 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, - 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, - 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, - 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, - 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, - 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, - 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, - 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, - 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, - 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, - 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, - 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, - 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, - 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, - 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, - 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, - 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, - 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, - 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, - 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, - 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, - 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, - 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, - 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, - 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, - 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, -}; - -static const c_uint32_t Td3[256] = -{ - 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, - 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, - 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, - 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, - 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, - 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, - 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, - 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, - 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, - 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, - 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, - 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, - 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, - 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, - 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, - 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, - 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, - 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, - 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, - 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, - 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, - 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, - 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, - 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, - 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, - 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, - 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, - 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, - 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, - 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, - 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, - 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, - 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, - 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, - 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, - 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, - 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, - 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, - 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, - 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, - 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, - 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, - 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, - 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, - 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, - 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, - 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, - 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, - 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, - 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, - 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, - 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, - 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, - 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, - 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, - 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, - 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, - 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, - 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, - 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, - 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, - 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, - 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, - 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, -}; - -static const c_uint32_t Td4[256] = -{ - 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, - 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, - 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, - 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, - 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, - 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, - 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, - 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, - 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, - 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, - 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, - 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, - 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, - 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, - 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, - 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, - 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, - 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, - 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, - 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, - 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, - 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, - 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, - 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, - 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, - 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, - 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, - 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, - 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, - 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, - 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, - 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, - 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, - 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, - 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, - 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, - 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, - 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, - 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, - 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, - 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, - 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, - 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, - 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, - 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, - 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, - 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, - 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, - 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, - 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, - 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, - 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, - 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, - 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, - 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, - 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, - 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, - 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, - 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, - 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, - 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, - 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, - 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, - 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, -}; - -static const c_uint32_t rcon[] = -{ - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000, - 0x1B000000, 0x36000000, - /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ -}; - -#define GETU32(plaintext) (((c_uint32_t)(plaintext)[0] << 24) ^ \ - ((c_uint32_t)(plaintext)[1] << 16) ^ \ - ((c_uint32_t)(plaintext)[2] << 8) ^ \ - ((c_uint32_t)(plaintext)[3])) - -#define PUTU32(ciphertext, st) { (ciphertext)[0] = (c_uint8_t)((st) >> 24); \ - (ciphertext)[1] = (c_uint8_t)((st) >> 16); \ - (ciphertext)[2] = (c_uint8_t)((st) >> 8); \ - (ciphertext)[3] = (c_uint8_t)(st); } - -/** - * Expand the cipher key into the encryption key schedule. - * - * @return the number of rounds for the given cipher key size. - */ -int aes_setup_enc(c_uint32_t *rk, const c_uint8_t *key, int keybits) -{ - int i = 0; - c_uint32_t temp; - - rk[0] = GETU32(key ); - rk[1] = GETU32(key + 4); - rk[2] = GETU32(key + 8); - rk[3] = GETU32(key + 12); - if (keybits == 128) - { - for (;;) - { - temp = rk[3]; - rk[4] = rk[0] ^ - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ - (Te4[(temp >> 24) ] & 0x000000ff) ^ - rcon[i]; - rk[5] = rk[1] ^ rk[4]; - rk[6] = rk[2] ^ rk[5]; - rk[7] = rk[3] ^ rk[6]; - if (++i == 10) - return 10; - rk += 4; - } - } - rk[4] = GETU32(key + 16); - rk[5] = GETU32(key + 20); - if (keybits == 192) - { - for (;;) - { - temp = rk[ 5]; - rk[ 6] = rk[ 0] ^ - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ - (Te4[(temp >> 24) ] & 0x000000ff) ^ - rcon[i]; - rk[ 7] = rk[ 1] ^ rk[ 6]; - rk[ 8] = rk[ 2] ^ rk[ 7]; - rk[ 9] = rk[ 3] ^ rk[ 8]; - if (++i == 8) - return 12; - rk[10] = rk[ 4] ^ rk[ 9]; - rk[11] = rk[ 5] ^ rk[10]; - rk += 6; - } - } - rk[6] = GETU32(key + 24); - rk[7] = GETU32(key + 28); - if (keybits == 256) - { - for (;;) - { - temp = rk[ 7]; - rk[ 8] = rk[ 0] ^ - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ - (Te4[(temp >> 24) ] & 0x000000ff) ^ - rcon[i]; - rk[ 9] = rk[ 1] ^ rk[ 8]; - rk[10] = rk[ 2] ^ rk[ 9]; - rk[11] = rk[ 3] ^ rk[10]; - if (++i == 7) - return 14; - temp = rk[11]; - rk[12] = rk[ 4] ^ - (Te4[(temp >> 24) ] & 0xff000000) ^ - (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(temp ) & 0xff] & 0x000000ff); - rk[13] = rk[ 5] ^ rk[12]; - rk[14] = rk[ 6] ^ rk[13]; - rk[15] = rk[ 7] ^ rk[14]; - rk += 8; - } - } - return 0; -} - -/** - * Expand the cipher key into the decryption key schedule. - * - * @return the number of rounds for the given cipher key size. - */ -int aes_setup_dec(c_uint32_t *rk, const c_uint8_t *key, int keybits) -{ - int nrounds, i, j; - c_uint32_t temp; - - /* expand the cipher key: */ - nrounds = aes_setup_enc(rk, key, keybits); - /* invert the order of the round keys: */ - for (i = 0, j = 4*nrounds; i < j; i += 4, j -= 4) - { - temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; - temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; - temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; - temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; - } - /* apply the inverse MixColumn transform to all round keys but the first and the last: */ - for (i = 1; i < nrounds; i++) - { - rk += 4; - rk[0] = - Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[0] ) & 0xff] & 0xff]; - rk[1] = - Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[1] ) & 0xff] & 0xff]; - rk[2] = - Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[2] ) & 0xff] & 0xff]; - rk[3] = - Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[3] ) & 0xff] & 0xff]; - } - return nrounds; -} - -void aes_encrypt(const c_uint32_t *rk, int nrounds, const c_uint8_t plaintext[16], - c_uint8_t ciphertext[16]) -{ - c_uint32_t s0, s1, s2, s3, t0, t1, t2, t3; - #ifndef FULL_UNROLL - int r; - #endif /* ?FULL_UNROLL */ - /* - * map byte array block to cipher state - * and add initial round key: - */ - s0 = GETU32(plaintext ) ^ rk[0]; - s1 = GETU32(plaintext + 4) ^ rk[1]; - s2 = GETU32(plaintext + 8) ^ rk[2]; - s3 = GETU32(plaintext + 12) ^ rk[3]; - #ifdef FULL_UNROLL - /* round 1: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7]; - /* round 2: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11]; - /* round 3: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15]; - /* round 4: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19]; - /* round 5: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23]; - /* round 6: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27]; - /* round 7: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31]; - /* round 8: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35]; - /* round 9: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39]; - if (nrounds > 10) - { - /* round 10: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43]; - /* round 11: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47]; - if (nrounds > 12) - { - /* round 12: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51]; - /* round 13: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55]; - } - } - rk += nrounds << 2; - #else /* !FULL_UNROLL */ - /* - * nrounds - 1 full rounds: - */ - r = nrounds >> 1; - for (;;) - { - t0 = - Te0[(s0 >> 24) ] ^ - Te1[(s1 >> 16) & 0xff] ^ - Te2[(s2 >> 8) & 0xff] ^ - Te3[(s3 ) & 0xff] ^ - rk[4]; - t1 = - Te0[(s1 >> 24) ] ^ - Te1[(s2 >> 16) & 0xff] ^ - Te2[(s3 >> 8) & 0xff] ^ - Te3[(s0 ) & 0xff] ^ - rk[5]; - t2 = - Te0[(s2 >> 24) ] ^ - Te1[(s3 >> 16) & 0xff] ^ - Te2[(s0 >> 8) & 0xff] ^ - Te3[(s1 ) & 0xff] ^ - rk[6]; - t3 = - Te0[(s3 >> 24) ] ^ - Te1[(s0 >> 16) & 0xff] ^ - Te2[(s1 >> 8) & 0xff] ^ - Te3[(s2 ) & 0xff] ^ - rk[7]; - rk += 8; - if (--r == 0) - break; - s0 = - Te0[(t0 >> 24) ] ^ - Te1[(t1 >> 16) & 0xff] ^ - Te2[(t2 >> 8) & 0xff] ^ - Te3[(t3 ) & 0xff] ^ - rk[0]; - s1 = - Te0[(t1 >> 24) ] ^ - Te1[(t2 >> 16) & 0xff] ^ - Te2[(t3 >> 8) & 0xff] ^ - Te3[(t0 ) & 0xff] ^ - rk[1]; - s2 = - Te0[(t2 >> 24) ] ^ - Te1[(t3 >> 16) & 0xff] ^ - Te2[(t0 >> 8) & 0xff] ^ - Te3[(t1 ) & 0xff] ^ - rk[2]; - s3 = - Te0[(t3 >> 24) ] ^ - Te1[(t0 >> 16) & 0xff] ^ - Te2[(t1 >> 8) & 0xff] ^ - Te3[(t2 ) & 0xff] ^ - rk[3]; - } - #endif /* ?FULL_UNROLL */ - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Te4[(t0 >> 24) ] & 0xff000000) ^ - (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t3 ) & 0xff] & 0x000000ff) ^ - rk[0]; - PUTU32(ciphertext , s0); - s1 = - (Te4[(t1 >> 24) ] & 0xff000000) ^ - (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t0 ) & 0xff] & 0x000000ff) ^ - rk[1]; - PUTU32(ciphertext + 4, s1); - s2 = - (Te4[(t2 >> 24) ] & 0xff000000) ^ - (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t1 ) & 0xff] & 0x000000ff) ^ - rk[2]; - PUTU32(ciphertext + 8, s2); - s3 = - (Te4[(t3 >> 24) ] & 0xff000000) ^ - (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t2 ) & 0xff] & 0x000000ff) ^ - rk[3]; - PUTU32(ciphertext + 12, s3); -} - -void aes_decrypt(const c_uint32_t *rk, int nrounds, const c_uint8_t ciphertext[16], - c_uint8_t plaintext[16]) -{ - c_uint32_t s0, s1, s2, s3, t0, t1, t2, t3; - #ifndef FULL_UNROLL - int r; - #endif /* ?FULL_UNROLL */ - - /* - * map byte array block to cipher state - * and add initial round key: - */ - s0 = GETU32(ciphertext ) ^ rk[0]; - s1 = GETU32(ciphertext + 4) ^ rk[1]; - s2 = GETU32(ciphertext + 8) ^ rk[2]; - s3 = GETU32(ciphertext + 12) ^ rk[3]; - #ifdef FULL_UNROLL - /* round 1: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7]; - /* round 2: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11]; - /* round 3: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15]; - /* round 4: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19]; - /* round 5: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23]; - /* round 6: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27]; - /* round 7: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31]; - /* round 8: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35]; - /* round 9: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39]; - if (nrounds > 10) - { - /* round 10: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43]; - /* round 11: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47]; - if (nrounds > 12) - { - /* round 12: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51]; - /* round 13: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55]; - } - } - rk += nrounds << 2; - #else /* !FULL_UNROLL */ - /* - * nrounds - 1 full rounds: - */ - r = nrounds >> 1; - for (;;) - { - t0 = - Td0[(s0 >> 24) ] ^ - Td1[(s3 >> 16) & 0xff] ^ - Td2[(s2 >> 8) & 0xff] ^ - Td3[(s1 ) & 0xff] ^ - rk[4]; - t1 = - Td0[(s1 >> 24) ] ^ - Td1[(s0 >> 16) & 0xff] ^ - Td2[(s3 >> 8) & 0xff] ^ - Td3[(s2 ) & 0xff] ^ - rk[5]; - t2 = - Td0[(s2 >> 24) ] ^ - Td1[(s1 >> 16) & 0xff] ^ - Td2[(s0 >> 8) & 0xff] ^ - Td3[(s3 ) & 0xff] ^ - rk[6]; - t3 = - Td0[(s3 >> 24) ] ^ - Td1[(s2 >> 16) & 0xff] ^ - Td2[(s1 >> 8) & 0xff] ^ - Td3[(s0 ) & 0xff] ^ - rk[7]; - rk += 8; - if (--r == 0) - break; - s0 = - Td0[(t0 >> 24) ] ^ - Td1[(t3 >> 16) & 0xff] ^ - Td2[(t2 >> 8) & 0xff] ^ - Td3[(t1 ) & 0xff] ^ - rk[0]; - s1 = - Td0[(t1 >> 24) ] ^ - Td1[(t0 >> 16) & 0xff] ^ - Td2[(t3 >> 8) & 0xff] ^ - Td3[(t2 ) & 0xff] ^ - rk[1]; - s2 = - Td0[(t2 >> 24) ] ^ - Td1[(t1 >> 16) & 0xff] ^ - Td2[(t0 >> 8) & 0xff] ^ - Td3[(t3 ) & 0xff] ^ - rk[2]; - s3 = - Td0[(t3 >> 24) ] ^ - Td1[(t2 >> 16) & 0xff] ^ - Td2[(t1 >> 8) & 0xff] ^ - Td3[(t0 ) & 0xff] ^ - rk[3]; - } - #endif /* ?FULL_UNROLL */ - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Td4[(t0 >> 24) ] & 0xff000000) ^ - (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t1 ) & 0xff] & 0x000000ff) ^ - rk[0]; - PUTU32(plaintext , s0); - s1 = - (Td4[(t1 >> 24) ] & 0xff000000) ^ - (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t2 ) & 0xff] & 0x000000ff) ^ - rk[1]; - PUTU32(plaintext + 4, s1); - s2 = - (Td4[(t2 >> 24) ] & 0xff000000) ^ - (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t3 ) & 0xff] & 0x000000ff) ^ - rk[2]; - PUTU32(plaintext + 8, s2); - s3 = - (Td4[(t3 >> 24) ] & 0xff000000) ^ - (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t0 ) & 0xff] & 0x000000ff) ^ - rk[3]; - PUTU32(plaintext + 12, s3); -} - -status_t aes_cbc_encrypt(const c_uint8_t *key, const c_uint32_t keybits, - c_uint8_t *ivec, const c_uint8_t *in, const c_uint32_t inlen, - c_uint8_t *out, c_uint32_t *outlen) -{ - c_uint32_t n; - c_uint32_t len = inlen; - const c_uint8_t *iv = ivec; - - c_uint32_t rk[RKLENGTH(MAX_KEY_BITS)]; - int nrounds; - - d_assert(key, return CORE_ERROR, "Null param"); - d_assert(keybits >= 128, return CORE_ERROR, - "param 'keybits' must be larger than 128"); - d_assert(ivec, return CORE_ERROR, "Null param"); - d_assert(in, return CORE_ERROR, "Null param"); - d_assert(inlen, return CORE_ERROR, "param 'inlen' is zero"); - d_assert(out, return CORE_ERROR, "Null param"); - d_assert(outlen, return CORE_ERROR, "Null param"); - - if (*outlen < ((inlen - 1) / AES_BLOCK_SIZE + 1) * AES_BLOCK_SIZE) - { - return CORE_ERROR; - } - - *outlen = ((inlen - 1) / AES_BLOCK_SIZE + 1) * AES_BLOCK_SIZE; - - nrounds = aes_setup_enc(rk, key, keybits); - - while (len >= AES_BLOCK_SIZE) - { - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] = in[n] ^ iv[n]; - aes_encrypt(rk, nrounds, out, out); - iv = out; - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - - if (len) - { - for(n=0; n < len; ++n) - out[n] = in[n] ^ iv[n]; - for(n=len; n < AES_BLOCK_SIZE; ++n) - out[n] = iv[n]; - aes_encrypt(rk, nrounds, out, out); - iv = out; - } - - memcpy(ivec, iv, AES_BLOCK_SIZE); - - return CORE_OK; -} - -status_t aes_cbc_decrypt(const c_uint8_t *key, const c_uint32_t keybits, - c_uint8_t *ivec, const c_uint8_t *in, const c_uint32_t inlen, - c_uint8_t *out, c_uint32_t *outlen) -{ - c_uint32_t n; - c_uint32_t len = inlen; - c_uint8_t tmp[AES_BLOCK_SIZE]; - const c_uint8_t *iv = ivec; - - c_uint32_t rk[RKLENGTH(MAX_KEY_BITS)]; - int nrounds; - - d_assert(key, return CORE_ERROR, "Null param"); - d_assert(keybits >= 128, return CORE_ERROR, - "param 'keybits' must be larger than 128"); - d_assert(ivec, return CORE_ERROR, "Null param"); - d_assert(in, return CORE_ERROR, "Null param"); - d_assert(inlen, return CORE_ERROR, "param 'inlen' is zero"); - d_assert(out, return CORE_ERROR, "Null param"); - d_assert(outlen, return CORE_ERROR, "Null param"); - - if (inlen % AES_BLOCK_SIZE != 0) - { - return CORE_ERROR; - } - - *outlen = inlen; - - nrounds = aes_setup_dec(rk, key, keybits); - - if (in != out) - { - while (len >= AES_BLOCK_SIZE) - { - aes_decrypt(rk, nrounds, in, out); - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] ^= iv[n]; - iv = in; - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - - if (len) - { - aes_decrypt(rk, nrounds, in, tmp); - for(n=0; n < len; ++n) - out[n] = tmp[n] ^ iv[n]; - iv = in; - } - - memcpy(ivec, iv, AES_BLOCK_SIZE); - } - else - { - while (len >= AES_BLOCK_SIZE) - { - memcpy(tmp, in, AES_BLOCK_SIZE); - - aes_decrypt(rk, nrounds, in, out); - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] ^= ivec[n]; - memcpy(ivec, tmp, AES_BLOCK_SIZE); - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - - if (len) - { - memcpy(tmp, in, AES_BLOCK_SIZE); - aes_decrypt(rk, nrounds, tmp, out); - for(n=0; n < len; ++n) - out[n] ^= ivec[n]; - for(n=len; n < AES_BLOCK_SIZE; ++n) - out[n] = tmp[n]; - - memcpy(ivec, tmp, AES_BLOCK_SIZE); - } - } - - return CORE_OK; -} - -static void ctr128_inc(c_uint8_t *counter) -{ - c_uint32_t n = 16, c = 1; - - do { - --n; - c += counter[n]; - counter[n] = (c_uint8_t)c; - c >>= 8; - } while (n); -} - -static void ctr128_inc_aligned(c_uint8_t *counter) -{ - size_t *data, c, d, n; - const union { - long one; - char little; - } is_endian = { - 1 - }; - - if (is_endian.little || ((size_t)counter % sizeof(size_t)) != 0) { - ctr128_inc(counter); - return; - } - - data = (size_t *)counter; - c = 1; - n = 16 / sizeof(size_t); - do { - --n; - d = data[n] += c; - /* did addition carry? */ - c = ((d - c) & ~d) >> (sizeof(size_t) * 8 - 1); - } while (n); -} - -status_t aes_ctr128_encrypt(const c_uint8_t *key, - c_uint8_t *ivec, const c_uint8_t *in, const c_uint32_t inlen, - c_uint8_t *out) -{ - c_uint8_t ecount_buf[16]; - c_uint32_t len = inlen; - - c_uint32_t rk[RKLENGTH(MAX_KEY_BITS)]; - int nrounds; - - c_uint32_t n = 0; - size_t l = 0; - - d_assert(key, return CORE_ERROR, "Null param"); - d_assert(ivec, return CORE_ERROR, "Null param"); - d_assert(in, return CORE_ERROR, "Null param"); - d_assert(len, return CORE_ERROR, "param 'inlen' is zero"); - d_assert(out, return CORE_ERROR, "Null param"); - - memset(ecount_buf, 0, 16); - nrounds = aes_setup_enc(rk, key, 128); - - while (n && len) - { - *(out++) = *(in++) ^ ecount_buf[n]; - --len; - n = (n + 1) % 16; - } - - while (len >= 16) - { - aes_encrypt(rk, nrounds, ivec, ecount_buf); - ctr128_inc_aligned(ivec); - for (n = 0; n < 16; n += sizeof(size_t)) - *(size_t *)(out + n) = - *(size_t *)(in + n) ^ *(size_t *)(ecount_buf + n); - len -= 16; - out += 16; - in += 16; - n = 0; - } - if (len) - { - aes_encrypt(rk, nrounds, ivec, ecount_buf); - ctr128_inc_aligned(ivec); - while (len--) - { - out[n] = in[n] ^ ecount_buf[n]; - ++n; - } - } - return CORE_OK; - - /* low-performance for understanding the aes-ctr128 */ - while (l < len) - { - if (n == 0) - { - aes_encrypt(rk, nrounds, ivec, ecount_buf); - ctr128_inc(ivec); - } - out[l] = in[l] ^ ecount_buf[n]; - ++l; - n = (n + 1) % 16; - } - - return CORE_OK; -} diff --git a/lib/core/src/aes_cmac.c b/lib/core/src/aes_cmac.c deleted file mode 100644 index 6860ca19e..000000000 --- a/lib/core/src/aes_cmac.c +++ /dev/null @@ -1,272 +0,0 @@ -#define TRACE_MODULE _cmac -#include "core.h" -#include "core_debug.h" -#include "core_aes_cmac.h" - -#if (AES_BLOCK_SIZE != 16) -#error "Wrong AES block size" -#endif - -/* From RFC 4493 - - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + Algorithm Generate_Subkey + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + + - + Input : K (128-bit key) + - + Output : K1 (128-bit first subkey) + - + K2 (128-bit second subkey) + - +-------------------------------------------------------------------+ - + + - + Constants: const_Zero is 0x00000000000000000000000000000000 + - + const_Rb is 0x00000000000000000000000000000087 + - + Variables: L for output of AES-128 applied to 0^128 + - + + - + Step 1. L := AES-128(K, const_Zero); + - + Step 2. if MSB(L) is equal to 0 + - + then K1 := L << 1; + - + else K1 := (L << 1) XOR const_Rb; + - + Step 3. if MSB(K1) is equal to 0 + - + then K2 := K1 << 1; + - + else K2 := (K1 << 1) XOR const_Rb; + - + Step 4. return K1, K2; + - + + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ - -static status_t _generate_subkey(c_uint8_t *k1, c_uint8_t *k2, - const c_uint8_t *key) -{ - c_uint8_t zero[16] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 - }; - c_uint8_t rb[16] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x87 - }; - c_uint8_t L[16]; - - c_uint32_t rk[RKLENGTH(MAX_KEY_BITS)]; - int i, nrounds; - - /* Step 1. L := AES-128(K, const_Zero) */ - nrounds = aes_setup_enc(rk, key, 128); - aes_encrypt(rk, nrounds, zero, L); - - /* Step 2. if MSB(L) is equal to 0 */ - if ((L[0] & 0x80) == 0) - { - /* then k1 := L << 1; */ - for (i = 0; i < 15; i++) - k1[i] = ((L[i] << 1) & 0xfe) | ((L[i + 1] & 0x80) ? 1 : 0); - k1[15] = ((L[15] << 1) & 0xfe); - } - else - { - /* else k1 := (L << 1) XOR const_Rb; */ - for (i = 0; i < 15; i++) - k1[i] = (((L[i] << 1) & 0xfe) | ((L[i + 1] & 0x80) ? 1 : 0)) - ^ rb[i]; - k1[15] = ((L[15] << 1) & 0xfe) ^ rb[15]; - } - - /* Step 3. if MSB(k1) is equal to 0 */ - if ((k1[0] & 0x80) == 0) - { - /* then k2 := k2 << 1; */ - for (i = 0; i < 15; i++) - k2[i] = ((k1[i] << 1) & 0xfe) | ((k1[i + 1] & 0x80) ? 1 : 0); - k2[15] = ((k1[15] << 1) & 0xfe); - } - else - { - /* else k2 := (k2 << 1) XOR const_Rb; */ - for (i = 0; i < 15; i++) - k2[i] = (((k1[i] << 1) & 0xfe) | ((k1[i + 1] & 0x80) ? 1 : 0)) - ^ rb[i]; - k2[15] = ((k1[15] << 1) & 0xfe) ^ rb[15]; - } - - return CORE_OK; -} - -/* From RFC 4493 - - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + Algorithm AES-CMAC + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + + - + Input : K ( 128-bit key ) + - + : M ( message to be authenticated ) + - + : len ( length of the message in octets ) + - + Output : T ( message authentication code ) + - + + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + Constants: const_Zero is 0x00000000000000000000000000000000 + - + const_Bsize is 16 + - + + - + Variables: K1, K2 for 128-bit subkeys + - + M_i is the i-th block (i=1..ceil(len/const_Bsize)) + - + M_last is the last block xor-ed with K1 or K2 + - + n for number of blocks to be processed + - + r for number of octets of last block + - + flag for denoting if last block is complete or not + - + + - + Step 1. (K1,K2) := Generate_Subkey(K); + - + Step 2. n := ceil(len/const_Bsize); + - + Step 3. if n = 0 + - + then + - + n := 1; + - + flag := false; + - + else + - + if len mod const_Bsize is 0 + - + then flag := true; + - + else flag := false; + - + + - + Step 4. if flag is true + - + then M_last := M_n XOR K1; + - + else M_last := padding(M_n) XOR K2; + - + Step 5. X := const_Zero; + - + Step 6. for i := 1 to n-1 do + - + begin + - + Y := X XOR M_i; + - + X := AES-128(K,Y); + - + end + - + Y := M_last XOR X; + - + T := AES-128(K,Y); + - + Step 7. return T; + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ - -status_t aes_cmac_calculate(c_uint8_t *cmac, const c_uint8_t *key, - const c_uint8_t *msg, const c_uint32_t len) -{ - c_uint8_t x[16] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 - }; - c_uint8_t y[16], m_last[16]; - c_uint8_t k1[16], k2[16]; - int i, j, n, bs, flag; - c_uint32_t rk[RKLENGTH(MAX_KEY_BITS)]; - int nrounds; - - d_assert(cmac, return CORE_ERROR, "Null param"); - d_assert(key, return CORE_ERROR, "Null param"); - d_assert(msg, return CORE_ERROR, "Null param"); - - /* Step 1. (K1,K2) := Generate_Subkey(K); */ - _generate_subkey(k1, k2, key); - - /* Step 2. n := ceil(len/const_Bsize); */ - n = (len + 15) / AES_BLOCK_SIZE; - - /* Step 3. if n = 0 - then - n := 1; - flag := false; - else - if len mod const_Bsize is 0 - then flag := true; - else flag := false; - */ - if (n == 0) - { - n = 1; - flag = 0; - } - else - { - if (len % AES_BLOCK_SIZE == 0) - flag = 1; - else - flag = 0; - } - - /* Step 4. if flag is true - then M_last := M_n XOR K1; - else M_last := padding(M_n) XOR K2; - */ - bs = (n - 1) * AES_BLOCK_SIZE; - - if (flag) - { - for (i = 0; i < 16; i++) - m_last[i] = msg[bs + i] ^ k1[i]; - } - else - { - for (i = 0; i < len % AES_BLOCK_SIZE; i++) - m_last[i] = msg[bs + i] ^ k2[i]; - - m_last[i] = 0x80 ^ k2[i]; - - for (i = i + 1; i < AES_BLOCK_SIZE; i++) - m_last[i] = 0x00 ^ k2[i]; - } - - - /* Step 5. X := const_Zero; */ - /* Step 6. for i := 1 to n-1 do - begin - Y := X XOR M_i; - X := AES-128(K,Y); - end - Y := M_last XOR X; - T := AES-128(K,Y); - */ - - nrounds = aes_setup_enc(rk, key, 128); - - for (i = 0; i <= n - 2; i++) - { - bs = i * AES_BLOCK_SIZE; - for (j = 0; j < 16; j++) - y[j] = x[j] ^ msg[bs + j]; - aes_encrypt(rk, nrounds, y, x); - } - - bs = (n - 1) * AES_BLOCK_SIZE; - for (j = 0; j < 16; j++) - y[j] = m_last[j] ^ x[j]; - aes_encrypt(rk, nrounds, y, cmac); - - return CORE_OK; -} - -/* From RFC 4493 - - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + Algorithm Verify_MAC + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - + + - + Input : K ( 128-bit Key ) + - + : M ( message to be verified ) + - + : len ( length of the message in octets ) + - + : T' ( the received MAC to be verified ) + - + Output : INVALID or VALID + - + + - +-------------------------------------------------------------------+ - + + - + Step 1. T* := AES-CMAC(K,M,len); + - + Step 2. if T* is equal to T' + - + then + - + return VALID; + - + else + - + return INVALID; + - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ - -status_t aes_cmac_verify(c_uint8_t *cmac, const c_uint8_t *key, - const c_uint8_t *msg, const c_uint32_t len) -{ - status_t rv; - c_uint8_t cmac_calc[16]; - - rv = aes_cmac_calculate(cmac_calc, key, msg, len); - if (rv != CORE_OK) - return rv; - - if (memcmp(cmac_calc, cmac, 16) != 0) - return ERR_INVALID_CMAC; - - return CORE_OK; -} diff --git a/lib/core/src/debug.c b/lib/core/src/debug.c deleted file mode 100644 index 7656a86d0..000000000 --- a/lib/core/src/debug.c +++ /dev/null @@ -1,655 +0,0 @@ -#include "core_debug.h" -#include "core_param.h" -#include "core_file.h" -#include "core_thread.h" - -#include -#include -#include -#include - -int g_trace_mask = 1; - -int g_msg_to = D_MSG_TO_STDOUT; - -int g_console_connected = 0; -int g_syslog_connected = 0; -int g_network_connected = 0; -int g_file_connected = 0; - -int g_log_level_console = D_LOG_LEVEL_FULL; -int g_log_level_stdout = D_LOG_LEVEL_FULL; -int g_log_level_syslog = D_LOG_LEVEL_FULL; -int g_log_level_network = D_LOG_LEVEL_FULL; -int g_log_level_file = D_LOG_LEVEL_FULL; - -static int g_console_fd = -1; -static int g_network_fd = -1; -static struct sockaddr_un g_network_addr; - -static thread_id network_thread = 0; -static void *THREAD_FUNC network_main(thread_id id, void *data); -static int network_handler(const char *path); - -static file_t *g_file = NULL; - -status_t d_msg_console_init(int console_fd) -{ - d_assert(console_fd >= 0, return CORE_ERROR, - "param 'console_fd' is invalid"); - - g_console_fd = console_fd; - g_console_connected = 1; - - return CORE_OK; -} - -void d_msg_console_final() -{ - g_console_connected = 0; - g_console_fd = -1; -} - -void d_msg_syslog_init(const char *name) -{ - d_assert(name, return, ); - - openlog(name, 0, LOG_DAEMON); - g_syslog_connected = 1; -} - -void d_msg_syslog_final() -{ - g_syslog_connected = 0; - closelog(); -} - -status_t d_msg_network_init(const char *name) -{ - d_assert(name, return CORE_ERROR, ); - - g_network_fd = socket(AF_UNIX, SOCK_DGRAM, 0); - d_assert(g_network_fd >= 0, return CORE_ERROR, - "socket() failed. (%d:%s)\n", errno, strerror(errno)); - - g_network_addr.sun_family = AF_UNIX; - strcpy(g_network_addr.sun_path, name); - - return CORE_OK; -} - -status_t d_msg_network_start(const char *file) -{ - status_t rv; - - d_assert(file, return CORE_ERROR, ); - - rv = thread_create(&network_thread, NULL, network_main, (void*)file); - d_assert(rv == CORE_OK, return CORE_ERROR, - "network thread creation failed"); - - g_network_connected = 1; - d_msg_to(D_MSG_TO_NETWORK, 1); - - return CORE_OK; -} - -void d_msg_network_stop() -{ - d_msg_to(D_MSG_TO_NETWORK, 0); - g_network_connected = 0; - - if (network_thread) - thread_delete(network_thread); -} - -void d_msg_network_final() -{ - close(g_network_fd); - g_network_fd = -1; -} - -static void *THREAD_FUNC network_main(thread_id id, void *data) -{ - int ret; - char *path = data; - - ret = network_handler(path); - if (ret != 0) - { - d_error("Failed to initialize logger."); - d_error("Check file permission for `%s`", path); - } - - return NULL; -} - -static int network_handler(const char *path) -{ - status_t rv; - int ret; - size_t nbytes; - ssize_t r; - int us; - fd_set readfd; - struct timeval timer_val; - struct sockaddr_un svaddr; - file_t *file = NULL; - char g_buffer[HUGE_STRING_LEN]; - - us = socket(AF_UNIX, SOCK_DGRAM, 0); - if (us < 0) - { - d_error("socket() failed. (%d:%s)", errno, strerror(errno)); - return -1; - } - memcpy(&svaddr, &g_network_addr, sizeof(struct sockaddr_un)); - - ret = bind(us, (struct sockaddr *)&svaddr, sizeof(svaddr)); - if (ret != 0) - { - if (errno == EADDRINUSE) - { - ret = file_remove(svaddr.sun_path); - if (ret != 0) - { - d_error("unlink(`%s`) failed. (%d:%s)", - svaddr.sun_path, errno, strerror(errno)); - return -1; - } - ret = bind(us, (struct sockaddr *)&svaddr, sizeof(svaddr)); - if (ret != 0) - { - d_error("bind() failed 2. (%d:%s)", errno, strerror(errno)); - return -1; - } - } - else - { - d_error("bind() failed. (%d:%s)", errno, strerror(errno)); - return -1; - } - } - - rv = file_open(&file, path, - FILE_CREATE | FILE_WRITE| FILE_APPEND, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - if (rv != CORE_OK) - { - d_error("Cannot open log file '%s'", path); - close(us); - return -1; - } - - while (!thread_should_stop()) - { - timer_val.tv_sec = 0; - timer_val.tv_usec = 50000; - FD_ZERO(&readfd); - FD_SET(us, &readfd); - - r = select (us+1, &readfd, NULL, NULL, &timer_val); - if (r == -1) - { - if (errno == EINTR) - break; - d_error("select() error(%d: %s)", errno, strerror(errno)); - } - - if (r == 0) - continue; - - if (FD_ISSET(us, &readfd)) - { - r = read(us, g_buffer, sizeof(g_buffer)); - - if (r < 0) - { - if (errno == EINTR) - break; - d_error("read() failed. (%d:%s)", errno, strerror(errno)); - continue; - } - - if (r == 0) - continue; - - nbytes = r; - rv = file_write(file, g_buffer, &nbytes); - if (rv != CORE_OK || r != nbytes) - { - d_error("Cannot write %ld bytes to log file (%ld written)", - (long)r, (long)nbytes); - } - } - } - - file_close(file); - - close(us); - - file_remove(svaddr.sun_path); - - return 0; -} - -status_t d_msg_file_init(const char *file) -{ - status_t rv; - - d_assert(file, return CORE_ERROR, ); - - rv = file_open(&g_file, file, - FILE_CREATE | FILE_WRITE| FILE_APPEND, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - if (rv != CORE_OK) - { - d_error("CHECK PERMISSION of Installation Directory..."); - d_error("Cannot create LOG file '%s'", file); - return CORE_ERROR; - } - - g_file_connected = 1; - d_msg_to(D_MSG_TO_FILE, 1); - - return CORE_OK; -} - -void d_msg_file_final() -{ - d_msg_to(D_MSG_TO_FILE, 0); - g_file_connected = 0; - - file_close(g_file); -} - -void d_msg_to(int to, int on_off) -{ - switch (to) - { - case D_MSG_TO_CONSOLE: - g_msg_to = on_off ? - g_msg_to | D_MSG_TO_CONSOLE : - g_msg_to & ~D_MSG_TO_CONSOLE; - break; - case D_MSG_TO_STDOUT: - g_msg_to = on_off ? - g_msg_to | D_MSG_TO_STDOUT : - g_msg_to & ~D_MSG_TO_STDOUT; - break; - case D_MSG_TO_SYSLOG: - g_msg_to = on_off ? - g_msg_to | D_MSG_TO_SYSLOG : - g_msg_to & ~D_MSG_TO_SYSLOG; - break; - case D_MSG_TO_NETWORK: - g_msg_to = on_off ? - g_msg_to | D_MSG_TO_NETWORK : - g_msg_to & ~D_MSG_TO_NETWORK; - break; - case D_MSG_TO_FILE: - g_msg_to = on_off ? - g_msg_to | D_MSG_TO_FILE : - g_msg_to & ~D_MSG_TO_FILE; - break; - case D_MSG_TO_ALL: - g_msg_to = on_off ? D_MSG_TO_ALL : 0; - break; - default: - break; - } -} - -int d_msg_get_to() -{ - return g_msg_to; -} - -void d_log_set_level(int to, int level) -{ - switch (to) - { - case D_MSG_TO_CONSOLE: - g_log_level_console = level; - break; - case D_MSG_TO_STDOUT: - g_log_level_stdout = level; - break; - case D_MSG_TO_SYSLOG: - g_log_level_syslog = level; - break; - case D_MSG_TO_NETWORK: - g_log_level_network = level; - break; - case D_MSG_TO_FILE: - g_log_level_file = level; - break; - case D_MSG_TO_ALL: - g_log_level_console = level; - g_log_level_stdout = level; - g_log_level_syslog = level; - g_log_level_network = level; - g_log_level_file = level; - break; - default: - break; - } -} - -int d_log_get_level(int to) -{ - switch (to) - { - case D_MSG_TO_CONSOLE: - return g_log_level_console; - case D_MSG_TO_STDOUT: - return g_log_level_stdout; - case D_MSG_TO_SYSLOG: - return g_log_level_syslog; - case D_MSG_TO_NETWORK: - return g_log_level_network; - case D_MSG_TO_FILE: - return g_log_level_file; - default: - break; - } - - return -1; -} - -void d_log_full(int to) -{ - switch (to) - { - case D_MSG_TO_CONSOLE: - g_log_level_console = D_LOG_LEVEL_FULL; - break; - case D_MSG_TO_STDOUT: - g_log_level_stdout = D_LOG_LEVEL_FULL; - break; - case D_MSG_TO_SYSLOG: - g_log_level_syslog = D_LOG_LEVEL_FULL; - break; - case D_MSG_TO_NETWORK: - g_log_level_network = D_LOG_LEVEL_FULL; - break; - case D_MSG_TO_FILE: - g_log_level_file = D_LOG_LEVEL_FULL; - break; - case D_MSG_TO_ALL: - g_log_level_console = D_LOG_LEVEL_FULL; - g_log_level_stdout = D_LOG_LEVEL_FULL; - g_log_level_syslog = D_LOG_LEVEL_FULL; - g_log_level_network = D_LOG_LEVEL_FULL; - g_log_level_file = D_LOG_LEVEL_FULL; - break; - default: - break; - } -} - -void d_log_off(int to) -{ - switch (to) - { - case D_MSG_TO_CONSOLE: - g_log_level_console = D_LOG_LEVEL_NONE; - break; - case D_MSG_TO_STDOUT: - g_log_level_stdout = D_LOG_LEVEL_NONE; - break; - case D_MSG_TO_SYSLOG: - g_log_level_syslog = D_LOG_LEVEL_NONE; - break; - case D_MSG_TO_NETWORK: - g_log_level_network = D_LOG_LEVEL_NONE; - break; - case D_MSG_TO_FILE: - g_log_level_file = D_LOG_LEVEL_NONE; - break; - case D_MSG_TO_ALL: - g_log_level_console = D_LOG_LEVEL_NONE; - g_log_level_stdout = D_LOG_LEVEL_NONE; - g_log_level_syslog = D_LOG_LEVEL_NONE; - g_log_level_network = D_LOG_LEVEL_NONE; - g_log_level_file = D_LOG_LEVEL_NONE; - break; - default: - break; - } -} - -void d_trace_global_on() -{ - g_trace_mask = 1; -} - -void d_trace_global_off() -{ - g_trace_mask = 0; -} - -void d_trace_level(int *mod_name, int level) -{ - *mod_name = level; -} - -void d_trace_off(int *mod_name) -{ - *mod_name = 0; -} - -#define TA_NOR "\033[0m" /* all off */ -#define TA_BOLD "\033[1m" /* bold */ -#define TA_UNDER "\033[4m" /* underscore */ -#define TA_BLINK "\033[5m" /* blink */ -#define TA_REVERSE "\033[7m" /* reverse video */ -#define TA_CONCEALED "\033[8m" /* concealed */ - -#define TA_FGC_BLACK "\033[30m" /* Black */ -#define TA_FGC_RED "\033[31m" /* Red */ -#define TA_FGC_GREEN "\033[32m" /* Green */ -#define TA_FGC_YELLOW "\033[33m" /* Yellow */ -#define TA_FGC_BLUE "\033[34m" /* Blue */ -#define TA_FGC_MAGENTA "\033[35m" /* Magenta */ -#define TA_FGC_CYAN "\033[36m" /* Cyan */ -#define TA_FGC_WHITE "\033[37m" /* White */ -#define TA_FGC_DEFAULT "\033[39m" /* default */ - -#define TA_BGC_BLACK "\033[40m" /* Black */ -#define TA_BGC_RED "\033[41m" /* Red */ -#define TA_BGC_GREEN "\033[42m" /* Green */ -#define TA_BGC_YELLOW "\033[43m" /* Yellow */ -#define TA_BGC_BLUE "\033[44m" /* Blue */ -#define TA_BGC_MAGENTA "\033[45m" /* Magenta */ -#define TA_BGC_CYAN "\033[46m" /* Cyan */ -#define TA_BGC_WHITE "\033[47m" /* White */ -#define TA_BGC_DEFAULT "\033[49m" /* default */ - -#define TIME_FMT_STR "%02d/%02d %02d:%02d:%02d.%03d" -#define TIME_FMT_STR2 "%02d.%06d" -#define TIME_FMT_STR3 "%04d/%02d/%02d %02d:%02d:%02d.%03d" - -int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...) -{ - char str[HUGE_STRING_LEN+1] = {0}, fstr[HUGE_STRING_LEN+1] = {0}, *ac_str; - time_exp_t te; - size_t n; - char *lv_str[5] = {"NONE", "FATL", "ERRR", "WARN", "INFO"}; - - - va_list args; - - va_start(args, fmt); - - if (t) - { - time_exp_lt(&te, t); - } - - switch (tp) - { - case D_MSG_TYPE_RAW: - { - n = vsprintf(fstr, fmt, args); - - if (g_msg_to & D_MSG_TO_STDOUT) - { - printf("%s", fstr); - } - if (g_syslog_connected && (g_msg_to & D_MSG_TO_SYSLOG)) - { - syslog(LOG_DEBUG, "%s", fstr); - } - if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK)) - { - sendto(g_network_fd, fstr, n, 0, - (struct sockaddr *)&g_network_addr, sizeof(g_network_addr)); - } - if (g_file_connected && (g_msg_to & D_MSG_TO_FILE)) - { - size_t nbytes = n; - file_write(g_file, fstr, &nbytes); - } - if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE)) - { - if (fstr[n-1] == '\n') - { - fstr[n-1] = '\r'; fstr[n++] = '\n'; - } - write(g_console_fd, fstr, n); - } - break; - } - case D_MSG_TYPE_TRACE: - { - vsprintf(str, fmt, args); - - n = snprintf(fstr, HUGE_STRING_LEN, "["TIME_FMT_STR"] %s", - te.tm_mon + 1, te.tm_mday, te.tm_hour, - te.tm_min, te.tm_sec, te.tm_usec/1000, str); - - if (g_msg_to & D_MSG_TO_STDOUT) - { - printf("%s", fstr); - } - if (g_syslog_connected && (g_msg_to & D_MSG_TO_SYSLOG)) - { - syslog(LOG_DEBUG, "%s", fstr); - } - if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK)) - { - sendto(g_network_fd, fstr, n, 0, - (struct sockaddr *)&g_network_addr, sizeof(g_network_addr)); - } - if (g_file_connected && (g_msg_to & D_MSG_TO_FILE)) - { - size_t nbytes = n; - file_write(g_file, fstr, &nbytes); - } - if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE)) - { - if (fstr[n-1] == '\n') - { - fstr[n-1] = '\r'; fstr[n++] = '\n'; - } - write(g_console_fd, fstr, n); - } - break; - } - case D_MSG_TYPE_LOG: - { - switch(lv) - { - case D_LOG_LEVEL_INFO: ac_str = TA_FGC_WHITE; break; - case D_LOG_LEVEL_WARN: ac_str = TA_FGC_CYAN; break; - case D_LOG_LEVEL_ERROR: ac_str = TA_FGC_YELLOW; break; - case D_LOG_LEVEL_FATAL: ac_str = TA_FGC_RED; break; - default: ac_str = NULL; break; - } - - vsprintf(str, fmt, args); - - n = snprintf(fstr, HUGE_STRING_LEN, - "["TIME_FMT_STR"] %s: %s (%s:%d)", - te.tm_mon + 1, te.tm_mday, te.tm_hour, - te.tm_min, te.tm_sec, te.tm_usec/1000, - lv_str[lv], str, fn, ln); - - if ((g_msg_to & D_MSG_TO_STDOUT) && - lv <= g_log_level_stdout) - { - printf("%s%s" TA_NOR "\n", ac_str, fstr); - } - if (g_syslog_connected && (g_msg_to & D_MSG_TO_SYSLOG) && - lv <= g_log_level_syslog) - { - syslog(LOG_INFO, "[%s\n", fstr + 13); - } - if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK) && - lv <= g_log_level_network) - { - fstr[n++] = '\n'; - sendto(g_network_fd, fstr, n, 0, - (struct sockaddr *)&g_network_addr, sizeof(g_network_addr)); - } - if (g_file_connected && (g_msg_to & D_MSG_TO_FILE)) - { - size_t nbytes; - - fstr[n++] = '\n'; - nbytes = n; - file_write(g_file, fstr, &nbytes); - } - if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE) && - lv <= g_log_level_console) - { - fstr[n++] = '\r'; /* fstr[n++] = '\n'; FIXME: */ - write(g_console_fd, fstr, n); - } - break; - } - case D_MSG_TYPE_ASSERT: - { - vsprintf(str, fmt, args); - - n = snprintf(fstr, HUGE_STRING_LEN, - "[" TIME_FMT_STR "] ASSERT: %s (%s:%d)", - te.tm_mon + 1, te.tm_mday, te.tm_hour, - te.tm_min, te.tm_sec, te.tm_usec/1000, str, fn, ln); - - if (g_msg_to & D_MSG_TO_STDOUT) - { - printf(TA_BOLD TA_FGC_RED "%s" TA_NOR "\n", fstr); - } - if (g_syslog_connected && (g_msg_to & D_MSG_TO_SYSLOG)) - { - syslog(LOG_CRIT, "[%s\n", fstr + 13); - } - if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK)) - { - fstr[n++] = '\n'; - sendto(g_network_fd, fstr, n, 0, - (struct sockaddr *)&g_network_addr, sizeof(g_network_addr)); - } - if (g_file_connected && (g_msg_to & D_MSG_TO_FILE)) - { - size_t nbytes; - - fstr[n++] = '\n'; - nbytes = n; - file_write(g_file, fstr, &nbytes); - } - if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE)) - { - fstr[n++] = '\r'; /* fstr[n++] = '\n'; FIXME: */ - write(g_console_fd, fstr, n); - } - break; - } - default: - break; - } - - return CORE_OK; -} diff --git a/lib/core/src/event.c b/lib/core/src/event.c deleted file mode 100644 index 6d5c8ec7f..000000000 --- a/lib/core/src/event.c +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @file event.c - */ - -/* Core libaray */ -#define TRACE_MODULE _event -#include "core_debug.h" -#include "core_msgq.h" -#include "core_event.h" - -#define EVT_Q_DEPTH 16 - -char *EVT_NAME_UNKNOWN = "UNKNOWN"; - -msgq_id event_create(int opt) -{ - msgq_id queue_id = 0; - - /* Start threads */ - queue_id = msgq_create(EVT_Q_DEPTH, EVENT_SIZE, opt); - d_assert(queue_id != 0, return CORE_ERROR, "Message queue creation failed"); - - return queue_id; -} - -status_t event_delete(msgq_id queue_id) -{ - msgq_delete(queue_id); - - return CORE_OK; -} - -status_t event_send(msgq_id queue_id, event_t *e) -{ - status_t rv; - - d_assert(e, return -1, "Null param"); - d_assert(queue_id, return -1, "event queue isn't initialized"); - - rv = msgq_send(queue_id, (const char*)e, EVENT_SIZE); - if (rv == CORE_EAGAIN) - { - d_warn("msgq_send full"); - } - else if (rv == CORE_ERROR) - { - d_error("msgq_send failed"); - } - - return rv; -} - -status_t event_recv(msgq_id queue_id, event_t *e) -{ - status_t rv; - - d_assert(e, return -1, "Null param"); - d_assert(queue_id, return -1, "event queue isn't initialized"); - - rv = msgq_recv(queue_id, (char*)e, EVENT_SIZE); - if (rv == CORE_ERROR) - { - d_error("msgq_timedrecv failed", rv); - } - - return rv; -} - -status_t event_timedrecv(msgq_id queue_id, event_t *e, c_time_t timeout) -{ - status_t rv; - - d_assert(e, return -1, "Null param"); - d_assert(queue_id, return -1, "event queue isn't initialized"); - - rv = msgq_timedrecv(queue_id, (char*)e, EVENT_SIZE, timeout); - if (rv == CORE_ERROR) - { - d_error("msgq_timedrecv failed", rv); - } - - return rv; -} - -void* event_timer_expire_func(c_uintptr_t queue_id, c_uintptr_t param1, - c_uintptr_t param2, c_uintptr_t param3, c_uintptr_t param4, - c_uintptr_t param5, c_uintptr_t param6) -{ - event_t e; - status_t rv; - - d_assert(queue_id, return NULL, "Null param"); - event_set(&e, param1); - event_set_param1(&e, param2); - event_set_param2(&e, param3); - event_set_param3(&e, param4); - event_set_param4(&e, param5); - event_set_param5(&e, param6); - - rv = event_send(queue_id, &e); - if (rv != CORE_OK) - { - d_error("event_send error:%d", rv); - } - - return NULL; -} - -tm_block_id event_timer_create(tm_service_t *tm_service, tm_type_e type, - c_uint32_t duration, c_uintptr_t event) -{ - tm_block_id id; - - id = tm_create(tm_service, - type, duration, (expire_func_t)event_timer_expire_func); - tm_set_param1(id, event); - d_assert(id, return 0, "tm_create() failed"); - - return id; -} diff --git a/lib/core/src/fsm.c b/lib/core/src/fsm.c deleted file mode 100644 index 25899ba84..000000000 --- a/lib/core/src/fsm.c +++ /dev/null @@ -1,112 +0,0 @@ -#include "core_fsm.h" - -typedef struct _event_t { - fsm_event_t event; -} event_t; - -static event_t entry_event = { - FSM_ENTRY_SIG, -}; -static event_t exit_event = { - FSM_EXIT_SIG, -}; - -char *FSM_NAME_INIT_SIG = "INIT"; -char *FSM_NAME_ENTRY_SIG = "ENTRY"; -char *FSM_NAME_EXIT_SIG = "EXIT"; - -void fsm_init(void *s, void *_e) -{ - fsm_t *fsm = s; - event_t *e = _e; - - if (fsm->initial != NULL) - { - (*fsm->initial)(s, e); - if (fsm->initial != fsm->state) - { - if (e) - { - e->event = FSM_ENTRY_SIG; - (*fsm->state)(s, e); - } - else - { - (*fsm->state)(s, &entry_event); - } - } - } -} - -void fsm_dispatch(void *s, void *_e) -{ - fsm_t *fsm = s; - event_t *e = _e; - fsm_handler_t tmp = fsm->state; -#if OLD_FSM_DISPATCH - fsm->state = (fsm_handler_t)0; -#endif - - (*tmp)(s, e); -#if OLD_FSM_DISPATCH - if (fsm->state != NULL) -#else - if (fsm->state != tmp) -#endif - { - if (e) - { - e->event = FSM_EXIT_SIG; - (*tmp)(s, e); - } - else - { - (*tmp)(s, &exit_event); - } - if (e) - { - e->event = FSM_ENTRY_SIG; - (*fsm->state)(s, e); - } - else - { -#if OLD_FSM_DISPATCH - (*tmp)(s, &entry_event); -#else - (*fsm->state)(s, &entry_event); -#endif - } - } -#if OLD_FSM_DISPATCH - else - { - fsm->state = tmp; - } -#endif -} - -void fsm_final(void *s, void *_e) -{ - fsm_t *fsm = s; - event_t *e = _e; - - if (fsm->final != fsm->state) - { - if (e) - { - e->event = FSM_EXIT_SIG; - (*fsm->state)(s, e); - } - else - { - (*fsm->state)(s, &exit_event); - } - } - - if (fsm->final != NULL) - { - (*fsm->final)(s, e); - } - - fsm->state = fsm->initial; -} diff --git a/lib/core/src/hash.c b/lib/core/src/hash.c deleted file mode 100644 index d8e00eb18..000000000 --- a/lib/core/src/hash.c +++ /dev/null @@ -1,404 +0,0 @@ -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_time.h" -#include "core_hash.h" - -/* - * The internal form of a hash table. - * - * The table is an array indexed by the hash of the key; collisions - * are resolved by hanging a linked list of hash entries off each - * element of the array. Although this is a really simple design it - * isn't too bad given that pools have a low allocation overhead. - */ - -typedef struct hash_entry_t hash_entry_t; - -struct hash_entry_t { - hash_entry_t *next; - unsigned int hash; - const void *key; - int klen; - const void *val; -}; - -/* - * Data structure for iterating through a hash table. - * - * We keep a pointer to the next hash entry here to allow the current - * hash entry to be freed or otherwise mangled between calls to - * hash_next(). - */ -struct hash_index_t { - hash_t *ht; - hash_entry_t *this, *next; - unsigned int index; -}; - -/* - * The size of the array is always a power of two. We use the maximum - * index rather than the size so that we can use bitwise-AND for - * modular arithmetic. - * The count of hash entries may be greater depending on the chosen - * collision rate. - */ -struct hash_t { - hash_entry_t **array; - hash_index_t iterator; /* For hash_first(NULL, ...) */ - unsigned int count, max, seed; - hashfunc_t hash_func; - hash_entry_t *free; /* List of recycled entries */ -}; - -#define INITIAL_MAX 15 /* tunable == 2^n - 1 */ - - -/* - * Hash creation functions. - */ - -static hash_entry_t **alloc_array(hash_t *ht, unsigned int max) -{ - return core_calloc(1, sizeof(*ht->array) * (max + 1)); -} - -CORE_DECLARE(hash_t *) hash_make() -{ - hash_t *ht; - c_time_t now = time_now(); - - ht = core_malloc(sizeof(hash_t)); - - ht->free = NULL; - ht->count = 0; - ht->max = INITIAL_MAX; - ht->seed = (unsigned int)((now >> 32) ^ now ^ - (c_uintptr_t)ht ^ (c_uintptr_t)&now) - 1; - ht->array = alloc_array(ht, ht->max); - ht->hash_func = NULL; - - return ht; -} - -CORE_DECLARE(hash_t *) hash_make_custom(hashfunc_t hash_func) -{ - hash_t *ht = hash_make(); - ht->hash_func = hash_func; - return ht; -} - -CORE_DECLARE(void) hash_destroy(hash_t *ht) -{ - hash_entry_t *he = NULL, *next_he = NULL; - - d_assert(ht, return, "Null param"); - d_assert(ht->array, return, "Null param"); - - hash_clear(ht); - - he = ht->free; - while(he) - { - next_he = he->next; - - CORE_FREE(he); - he = next_he; - } - - CORE_FREE(ht->array); - CORE_FREE(ht); -} - -/* - * Hash iteration functions. - */ - -CORE_DECLARE(hash_index_t *) hash_next(hash_index_t *hi) -{ - hi->this = hi->next; - while (!hi->this) { - if (hi->index > hi->ht->max) - return NULL; - - hi->this = hi->ht->array[hi->index++]; - } - hi->next = hi->this->next; - return hi; -} - -CORE_DECLARE(hash_index_t *) hash_first(hash_t *ht) -{ - hash_index_t *hi; - - hi = &ht->iterator; - - hi->ht = ht; - hi->index = 0; - hi->this = NULL; - hi->next = NULL; - return hash_next(hi); -} - -CORE_DECLARE(void) hash_this(hash_index_t *hi, - const void **key, int *klen, void **val) -{ - if (key) *key = hi->this->key; - if (klen) *klen = hi->this->klen; - if (val) *val = (void *)hi->this->val; -} - -CORE_DECLARE(const void *) hash_this_key(hash_index_t *hi) -{ - const void *key; - - hash_this(hi, &key, NULL, NULL); - return key; -} - -CORE_DECLARE(int) hash_this_key_len(hash_index_t *hi) -{ - int klen; - - hash_this(hi, NULL, &klen, NULL); - return klen; -} - -CORE_DECLARE(void *) hash_this_val(hash_index_t *hi) -{ - void *val; - - hash_this(hi, NULL, NULL, &val); - return val; -} - -/* - * Expanding a hash table - */ - -static void expand_array(hash_t *ht) -{ - hash_index_t *hi; - hash_entry_t **new_array; - unsigned int new_max; - - new_max = ht->max * 2 + 1; - new_array = alloc_array(ht, new_max); - for (hi = hash_first(ht); hi; hi = hash_next(hi)) { - unsigned int i = hi->this->hash & new_max; - hi->this->next = new_array[i]; - new_array[i] = hi->this; - } - CORE_FREE(ht->array); - ht->array = new_array; - ht->max = new_max; -} - -static unsigned int hashfunc_default( - const char *char_key, int *klen, unsigned int hash) -{ - const unsigned char *key = (const unsigned char *)char_key; - const unsigned char *p; - int i; - - /* - * This is the popular `times 33' hash algorithm which is used by - * perl and also appears in Berkeley DB. This is one of the best - * known hash functions for strings because it is both computed - * very fast and distributes very well. - * - * The originator may be Dan Bernstein but the code in Berkeley DB - * cites Chris Torek as the source. The best citation I have found - * is "Chris Torek, Hash function for text in C, Usenet message - * <27038@mimsy.umd.edu> in comp.lang.c , October, 1990." in Rich - * Salz's USENIX 1992 paper about INN which can be found at - * . - * - * The magic of number 33, i.e. why it works better than many other - * constants, prime or not, has never been adequately explained by - * anyone. So I try an explanation: if one experimentally tests all - * multipliers between 1 and 256 (as I did while writing a low-level - * data structure library some time ago) one detects that even - * numbers are not useable at all. The remaining 128 odd numbers - * (except for the number 1) work more or less all equally well. - * They all distribute in an acceptable way and this way fill a hash - * table with an average percent of approx. 86%. - * - * If one compares the chi^2 values of the variants (see - * Bob Jenkins ``Hashing Frequently Asked Questions'' at - * http://burtleburtle.net/bob/hash/hashfaq.html for a description - * of chi^2), the number 33 not even has the best value. But the - * number 33 and a few other equally good numbers like 17, 31, 63, - * 127 and 129 have nevertheless a great advantage to the remaining - * numbers in the large set of possible multipliers: their multiply - * operation can be replaced by a faster operation based on just one - * shift plus either a single addition or subtraction operation. And - * because a hash function has to both distribute good _and_ has to - * be very fast to compute, those few numbers should be preferred. - * - * -- Ralf S. Engelschall - */ - - if (*klen == HASH_KEY_STRING) { - for (p = key; *p; p++) { - hash = hash * 33 + *p; - } - *klen = p - key; - } - else { - for (p = key, i = *klen; i; i--, p++) { - hash = hash * 33 + *p; - } - } - - return hash; -} - -CORE_DECLARE_NONSTD(unsigned int) core_hashfunc_default( - const char *char_key, int *klen) -{ - return hashfunc_default(char_key, klen, 0); -} - -/* - * This is where we keep the details of the hash function and control - * the maximum collision rate. - * - * If val is non-NULL it creates and initializes a new hash entry if - * there isn't already one there; it returns an updatable pointer so - * that hash entries can be removed. - */ - -static hash_entry_t **find_entry(hash_t *ht, - const void *key, int klen, const void *val) -{ - hash_entry_t **hep, *he; - unsigned int hash; - - if (ht->hash_func) - hash = ht->hash_func(key, &klen); - else - hash = hashfunc_default(key, &klen, ht->seed); - - /* scan linked list */ - for (hep = &ht->array[hash & ht->max], he = *hep; - he; hep = &he->next, he = *hep) { - if (he->hash == hash - && he->klen == klen - && memcmp(he->key, key, klen) == 0) - break; - } - if (he || !val) - return hep; - - /* add a new entry for non-NULL values */ - if ((he = ht->free) != NULL) - ht->free = he->next; - else - he = core_malloc(sizeof(*he)); - he->next = NULL; - he->hash = hash; - he->key = key; - he->klen = klen; - he->val = val; - *hep = he; - ht->count++; - return hep; -} - -CORE_DECLARE(void *) hash_get(hash_t *ht, const void *key, int klen) -{ - hash_entry_t *he; - he = *find_entry(ht, key, klen, NULL); - if (he) - return (void *)he->val; - else - return NULL; -} - -CORE_DECLARE(void) hash_set(hash_t *ht, - const void *key, int klen, const void *val) -{ - hash_entry_t **hep; - hep = find_entry(ht, key, klen, val); - if (*hep) { - if (!val) { - /* delete entry */ - hash_entry_t *old = *hep; - *hep = (*hep)->next; - old->next = ht->free; - ht->free = old; - --ht->count; - } - else { - /* replace entry */ - (*hep)->val = val; - /* check that the collision rate isn't too high */ - if (ht->count > ht->max) { - expand_array(ht); - } - } - } - /* else key not present and val==NULL */ -} - -CORE_DECLARE(void *) hash_get_or_set(hash_t *ht, - const void *key, int klen, const void *val) -{ - hash_entry_t **hep; - hep = find_entry(ht, key, klen, val); - if (*hep) { - val = (*hep)->val; - /* check that the collision rate isn't too high */ - if (ht->count > ht->max) { - expand_array(ht); - } - return (void *)val; - } - /* else key not present and val==NULL */ - return NULL; -} - -CORE_DECLARE(unsigned int) hash_count(hash_t *ht) -{ - return ht->count; -} - -CORE_DECLARE(void) hash_clear(hash_t *ht) -{ - hash_index_t *hi; - for (hi = hash_first(ht); hi; hi = hash_next(hi)) - hash_set(ht, hi->this->key, hi->this->klen, NULL); -} - -/* This is basically the following... - * for every element in hash table { - * comp elemeny.key, element.value - * } - * - * Like with table_do, the comp callback is called for each and every - * element of the hash table. - */ -CORE_DECLARE(int) hash_do(hash_do_callback_fn_t *comp, - void *rec, const hash_t *ht) -{ - hash_index_t hix; - hash_index_t *hi; - int rv, dorv = 1; - - hix.ht = (hash_t *)ht; - hix.index = 0; - hix.this = NULL; - hix.next = NULL; - - if ((hi = hash_next(&hix))) { - /* Scan the entire table */ - do { - rv = (*comp)(rec, hi->this->key, hi->this->klen, hi->this->val); - } while (rv && (hi = hash_next(hi))); - - if (rv == 0) { - dorv = 0; - } - } - return dorv; -} diff --git a/lib/core/src/misc.c b/lib/core/src/misc.c deleted file mode 100644 index 4734b9c53..000000000 --- a/lib/core/src/misc.c +++ /dev/null @@ -1,198 +0,0 @@ -#include "core_errno.h" -#include "core_lib.h" - -void *core_ascii_to_hex(char *in, int in_len, void *out, int out_len) -{ - int i = 0, j = 0, k = 0, hex; - c_uint8_t *out_p = out; - - while(i < in_len && j < out_len) - { - if (!c_isspace(in[i])) - { - hex = c_isdigit(in[i]) ? in[i] - '0' : - c_islower(in[i]) ? in[i] - 'a' + 10 : in[i] - 'A' + 10; - if ((k & 0x1) == 0) - { - out_p[j] = (hex << 4); - } - else - { - out_p[j] |= hex; - j++; - } - k++; - } - i++; - } - - return out; -} - -void *core_hex_to_ascii(void *in, int in_len, void *out, int out_len) -{ - char *p; - int i = 0, l, off = 0; - - p = out; - p[0] = 0; - - l = (in_len - off) > out_len ? out_len : in_len - off; - for (i = 0; i < l; i++) - { - p += sprintf(p, "%02X", ((char*)in)[off+i] & 0xff); - if ((i & 0x3) == 3 && (i != (l-1))) p += sprintf(p, " "); - } - - return out; -} - -void *core_uint64_to_buffer(c_uint64_t num, int size, void *buffer) -{ - int i; - c_uint8_t *buffer_p = buffer; - for (i = 0; i < size; i++) - buffer_p[i] = (num >> ((size-1-i) * 8)) & 0xff; - - return buffer; -} - -c_uint64_t core_buffer_to_uint64(void *buffer, int size) -{ - c_uint64_t num = 0; - c_uint8_t *buffer_p = buffer; - int i; - - for (i = 0; i < size; i++) - { - num |= (((c_uint64_t)buffer_p[i]) << ((size-1-i) * 8)); - } - - return num; -} - -void *core_bcd_to_buffer(c_int8_t *in, void *out, int *out_len) -{ - int i = 0; - c_uint8_t *out_p = out; - int in_len = strlen(in); - - for (i = 0; i < in_len; i++) - { - if (i & 0x01) - out_p[i>>1] = out_p[i>>1] | (((in[i] - 0x30) << 4) & 0xF0); - else - out_p[i>>1] = (in[i] - 0x30) & 0x0F; - } - - *out_len = (in_len + 1) / 2; - if (in_len & 0x01) - { - out_p[(*out_len)-1] |= 0xF0; - } - - return out; -} - -void *core_buffer_to_bcd(c_uint8_t *in, int in_len, void *out) -{ - int i = 0; - c_uint8_t *out_p = out; - - for (i = 0; i < in_len-1; i++) - { - out_p[i*2] = 0x30 + (in[i] & 0x0F); - out_p[i*2+1] = 0x30 + ((in[i] & 0xF0) >> 4); - } - - if ((in[i] & 0xF0) == 0xF0) - { - out_p[i*2] = 0x30 + (in[i] & 0x0F); - out_p[i*2+1] = 0; - } - else - { - out_p[i*2] = 0x30 + (in[i] & 0x0F); - out_p[i*2+1] = 0x30 + ((in[i] & 0xF0) >> 4); - out_p[i*2+2] = 0; - } - - return out; -} - -char *core_cpystrn(char *dst, const char *src, size_t dst_size) -{ - - char *d = dst, *end; - - if (dst_size == 0) { - return (dst); - } - - if (src) { - end = dst + dst_size - 1; - - for (; d < end; ++d, ++src) { - if (!(*d = *src)) { - return (d); - } - } - } - - *d = '\0'; /* always null terminate */ - - return (d); -} - -char *core_env_get(const char *envvar) -{ -#ifdef HAVE_GETENV - return getenv(envvar); -#else - return NULL; -#endif -} - - -status_t core_env_set(const char *envvar, const char *value) -{ -#if defined(HAVE_SETENV) - - if (0 > setenv(envvar, value, 1)) - return CORE_ENOMEM; - return CORE_OK; - -#elif defined(HAVE_PUTENV) - - char buf[HUGE_STRING_LEN]; - - if (snprintf(buf, HUGE_STRING_LEN, "%s=%s", envvar, value) < 0) - return CORE_ENOMEM; - if (0 > putenv(buf)) - return CORE_ENOMEM; - return CORE_OK; - -#else - return CORE_ENOTIMPL; -#endif -} - - -status_t core_env_delete(const char *envvar) -{ -#ifdef HAVE_UNSETENV - - unsetenv(envvar); - return CORE_OK; - -#else - /* hint: some platforms allow envvars to be unset via - * putenv("varname")... that isn't Single Unix spec, - * but if your platform doesn't have unsetenv() it is - * worth investigating and potentially adding a - * configure check to decide when to use that form of - * putenv() here - */ - return CORE_ENOTIMPL; -#endif -} diff --git a/lib/core/src/msgq.c b/lib/core/src/msgq.c deleted file mode 100644 index c880f42da..000000000 --- a/lib/core/src/msgq.c +++ /dev/null @@ -1,250 +0,0 @@ -#define TRACE_MODULE _msgq -#include "core_debug.h" -#include "core_pool.h" -#include "core_ringbuf.h" -#include "core_cond.h" -#include "core_mutex.h" -#include "core_msgq.h" -#include "core_pkbuf.h" -#include "core_list.h" - -typedef struct _msq_desc_t { - mutex_id mut_c, mut_r, mut_w; - cond_id cond; - int opt; - int qdepth, msgsize, used; - rbuf_declare_ext(rbuf); - unsigned char *pool; -} msg_desc_t; - -#define SIZE_OF_MSGQ_POOL 5 /* MME 1, SGW 2, PGW 2 */ - -pool_declare(msgqpool, msg_desc_t, SIZE_OF_MSGQ_POOL); - -status_t msgq_init(void) -{ - pool_init(&msgqpool, SIZE_OF_MSGQ_POOL); - return CORE_OK; -} - -status_t msgq_final(void) -{ - pool_final(&msgqpool); - return CORE_OK; -} - -msgq_id msgq_create(int qdepth, int msgsize, int opt) -{ - msg_desc_t *md; - int s; - status_t rv; - - if (qdepth == 0 || msgsize == 0) - return 0; - - pool_alloc_node(&msgqpool, &md); - d_assert(md != NULL, return 0, "empty msgq pool"); - - memset((void*)md, 0, sizeof(msg_desc_t)); - - rv = mutex_create(&md->mut_c, MUTEX_DEFAULT); - d_assert(rv == CORE_OK, - goto error_final, "mutex creation failed"); - rv = mutex_create(&md->mut_r, MUTEX_DEFAULT); - d_assert(rv == CORE_OK, - goto error_final, "mutex creation failed"); - - rv = mutex_create(&md->mut_w, MUTEX_DEFAULT); - d_assert(rv == CORE_OK, - goto error_final, "mutex creation failed"); - - rv = cond_create(&md->cond); - d_assert(rv == CORE_OK, - goto error_final, "mutex creation failed"); - - s = qdepth * msgsize; - md->pool = core_malloc(s); - d_assert(md->pool != NULL, - goto error_final, "can't allocate msg q buffer %d bytes", s); - - rbuf_init_ext(&(md->rbuf), s, md->pool); - - md->opt = opt; - md->qdepth = qdepth; - md->msgsize = msgsize; - md->used = 0; - - return (msgq_id)md; - -error_final: - if (md->pool) CORE_FREE(md->pool); - if (md->mut_c) mutex_delete(md->mut_c); - if (md->mut_r) mutex_delete(md->mut_r); - if (md->mut_w) mutex_delete(md->mut_w); - if (md->cond) cond_delete(md->cond); - - pool_free_node(&msgqpool, md); - - return 0; -} - -status_t msgq_delete(msgq_id id) -{ - msg_desc_t *md = (msg_desc_t*)id; - - d_assert(md != NULL, return CORE_ERROR, "param 'id' is null"); - - if (md->pool) CORE_FREE(md->pool); - if (md->mut_c) mutex_delete(md->mut_c); - if (md->mut_r) mutex_delete(md->mut_r); - if (md->mut_w) mutex_delete(md->mut_w); - if (md->cond) cond_delete(md->cond); - - pool_free_node(&msgqpool, md); - - return CORE_OK; -} - -status_t msgq_send(msgq_id id, const char *msg, int msglen) -{ - msg_desc_t *md = (msg_desc_t*)id; - int n; - - d_assert(md != NULL, return CORE_ERROR, "param 'id' is null"); - d_assert(msg != NULL, return CORE_ERROR, "param 'msg' is null"); - d_assert(msglen <= md->msgsize, return CORE_ERROR, - "'msglen' is bigger than the msg size of queue"); - - d_assert(md->pool != NULL, return CORE_ERROR, "msgq has no ring buffer"); - - mutex_lock(md->mut_w); - - n = rbuf_free_bytes(&md->rbuf); - if (n == 0) - { - mutex_unlock(md->mut_w); - return CORE_EAGAIN; - } - - n = rbuf_write(&md->rbuf, msg, msglen); - d_trace(2, "ring write. head:%d tail:%d size:%d len:%d\n", - md->rbuf.h.head, md->rbuf.h.tail, md->rbuf.h.size, msglen); - d_assert(n == msglen, - mutex_unlock(md->mut_w); return CORE_ERROR, - "msgq integrity broken n:%d len:%d", n, msglen); - - d_trace(1, "msg (%d bytes) pushed.\n", msglen); - - mutex_unlock(md->mut_w); - mutex_lock(md->mut_c); - cond_signal(md->cond); - mutex_unlock(md->mut_c); - - return CORE_OK; -} - -status_t msgq_recv(msgq_id id, char *msg, int msglen) -{ - msg_desc_t *md = (msg_desc_t*)id; - int n; - - d_assert(md != NULL, return CORE_ERROR, "param 'id' is null"); - d_assert(msg != NULL, return CORE_ERROR, "param 'msg' is null"); - d_assert(msglen >= md->msgsize, return CORE_ERROR, - "'msglen' is smaller than msgsize"); - - d_assert(md->pool != NULL, return CORE_ERROR, "msgq has no ring buffer"); - - mutex_lock(md->mut_r); - - n = rbuf_bytes(&md->rbuf); - - if (!(md->opt & MSGQ_O_NONBLOCK) && (n < md->msgsize)) - { - mutex_lock(md->mut_c); - while(rbuf_is_empty(&md->rbuf) && - cond_wait(md->cond, md->mut_c) == CORE_OK); - mutex_unlock(md->mut_c); - - n = rbuf_bytes(&md->rbuf); - - d_assert(n >= md->msgsize, - mutex_unlock(md->mut_r); return CORE_ERROR, - "msgq integrity broken"); - } - else if (n < md->msgsize) - { - mutex_unlock(md->mut_r); - return CORE_EAGAIN; - } - - n = rbuf_read(&md->rbuf, msg, msglen); - d_trace(2, "ring read. head:%d tail:%d size:%d len:%d\n", - md->rbuf.h.head, md->rbuf.h.tail, md->rbuf.h.size, msglen); - - d_assert(n == msglen, - mutex_unlock(md->mut_r); return CORE_ERROR, - "msgq integrity broken n:%d len:%d", n, msglen); - - d_trace(1, "msg (%d bytes) pop.\n", msglen); - - mutex_unlock(md->mut_r); - - return CORE_OK; -} - -status_t msgq_timedrecv(msgq_id id, char *msg, int msglen, c_time_t timeout) -{ - msg_desc_t *md = (msg_desc_t*)id; - int n; - status_t rv; - - d_assert(md != NULL, return CORE_ERROR, "param 'id' is null"); - d_assert(msg != NULL, return CORE_ERROR, "param 'msg' is null"); - d_assert(msglen >= md->msgsize, return CORE_ERROR, - "'msglen' is smaller than msgsize"); - - d_assert(md->pool != NULL, return CORE_ERROR, "msgq has no ring buffer"); - - mutex_lock(md->mut_r); - - n = rbuf_bytes(&md->rbuf); - - if (!(md->opt & MSGQ_O_NONBLOCK) && (n < md->msgsize)) - { - mutex_lock(md->mut_c); - while(rbuf_is_empty(&md->rbuf) && - (rv = cond_timedwait(md->cond, md->mut_c, timeout)) == CORE_OK); - mutex_unlock(md->mut_c); - - if (rv == CORE_TIMEUP) - { - mutex_unlock(md->mut_r); - return CORE_TIMEUP; - } - - n = rbuf_bytes(&md->rbuf); - d_assert(n >= md->msgsize, - mutex_unlock(md->mut_r); return CORE_ERROR, - "msgq integrity broken"); - } - else if (n < md->msgsize) - { - mutex_unlock(md->mut_r); - return CORE_EAGAIN; - } - - n = rbuf_read(&md->rbuf, msg, msglen); - d_trace(2, "ring read. head:%d tail:%d size:%d len:%d\n", - md->rbuf.h.head, md->rbuf.h.tail, md->rbuf.h.size, msglen); - - d_assert(n == msglen, - mutex_unlock(md->mut_r); return CORE_ERROR, - "msgq integrity broken n:%d len:%d", n, msglen); - - d_trace(1, "msg (%d bytes) pop.\n", msglen); - - mutex_unlock(md->mut_r); - - return CORE_OK; -} diff --git a/lib/core/src/ringbuf.c b/lib/core/src/ringbuf.c deleted file mode 100644 index f26b52925..000000000 --- a/lib/core/src/ringbuf.c +++ /dev/null @@ -1,170 +0,0 @@ -#define TRACE_MODULE _ringbuf -#include "core_debug.h" -#include "core_ringbuf.h" - -#define _rbuf_bytes(__h, __t, __s) \ - (((__h) < (__t)) ? (__h) + (__s) - (__t) + 1 : (__h) - (__t)) - -#define _rbuf_free_bytes(__h, __t, __s) \ - (((__h) < (__t)) ? (__t) - (__h) - 1 : (__t) + (__s) - (__h)) - -int rbuf_bytes(void *__pname) -{ - int h, t; - - struct _rbuf_header_t *ptr_h = (struct _rbuf_header_t*)__pname; - - /* Store for thread safety */ - h = ptr_h->head; t = ptr_h->tail; - - return _rbuf_bytes(h, t, ptr_h->size); -} - -int rbuf_free_bytes(void *__pname) -{ - int h, t; - - struct _rbuf_header_t *ptr_h = (struct _rbuf_header_t*)__pname; - - /* Store for thread safety */ - h = ptr_h->head; t = ptr_h->tail; - - return _rbuf_free_bytes(h, t, ptr_h->size); -} - -#define rbuf_is_empty(__pname) ((__pname)->h.head == (__pname)->h.tail) - -#define rbuf_is_full(__pname) (rbuf_free_bytes(__pname) == 0) - -int rbuf_skip_write_pos(void *__pname, int __len) -{ - /* Write operation must handle only head pointer */ - - int n, h, t; - - struct _rbuf_header_t *ptr_h = (struct _rbuf_header_t*)__pname; - - if (ptr_h == NULL) - return -1; - - t = ptr_h->tail; /* Store for thread safety with read thread */ - h = ptr_h->head; - - /* Check available buffer size */ - n = _rbuf_free_bytes(h, t, ptr_h->size); - /* If no space, return */ - if (n == 0) - return -1; - /* Determin the number of bytes to be skipped */ - n = n < __len ? n : __len; - - /* In this function, only ptr_h->head should be updated */ - ptr_h->head = (h + n) % (ptr_h->size + 1); - - return n; -} - -int rbuf_write(void *__pname, const char *__buf, int __buf_len) -{ - /* Write operation must handle only head pointer */ - - int n, h, t; - - struct _rbuf_header_t *ptr_h = (struct _rbuf_header_t*)__pname; - - if (ptr_h == NULL) - return -1; - - t = ptr_h->tail; /* Store for thread safety with read thread */ - h = ptr_h->head; - - /* Check available buffer size */ - n = _rbuf_free_bytes(h, t, ptr_h->size); - /* If no space, return */ - if (n == 0) - return -1; - /* Determin the number of bytes to be written */ - n = n < __buf_len ? n : __buf_len; - - if ((t > h) || (n < ptr_h->size - h + 1)) - { - memcpy(ptr_h->pool + h, __buf, n); - } - else - { - memcpy(ptr_h->pool + h, __buf, ptr_h->size - h + 1); - memcpy(ptr_h->pool, __buf + (ptr_h->size - h + 1), - n - (ptr_h->size - h + 1)); - } - - /* In this function, only ptr_h->head should be updated */ - ptr_h->head = (h + n) % (ptr_h->size + 1); - - return n; -} - -int rbuf_skip_read_pos(void *__pname, int __len) -{ - /* Read operation must handle only tail pointer */ - int n, h, t; - - struct _rbuf_header_t *ptr_h = (struct _rbuf_header_t*)__pname; - - if (ptr_h == NULL) - return -1; - - h = ptr_h->head; /* Store for thread safety with write thread */ - t = ptr_h->tail; - - /* Check filled buffer size */ - n = _rbuf_bytes(h, t, ptr_h->size); - /* If empty, return */ - if (n == 0) - return -1; - /* Determine the number of bytes to be skipped */ - n = n < __len ? n : __len; - - /* In this function, only ptr_h->tail should be updated */ - ptr_h->tail = (t + n) % (ptr_h->size + 1); - - return n; -} - -int rbuf_read(void *__pname, char *__buf, int __buf_len) -{ - /* Read operation must handle only tail pointer */ - - int n, h, t; - - struct _rbuf_header_t *ptr_h = (struct _rbuf_header_t*)__pname; - - if (ptr_h == NULL) - return -1; - - h = ptr_h->head; /* Store for thread safety with write thread */ - t = ptr_h->tail; - - /* Check filled buffer size */ - n = _rbuf_bytes(h, t, ptr_h->size); - /* If empty, return */ - if (n == 0) - return -1; - /* Determine the number of bytes to be read */ - n = n < __buf_len ? n : __buf_len; - - if (t < h || (n < ptr_h->size - t + 1)) - { - memcpy(__buf, ptr_h->pool + t, n); - } - else - { - memcpy(__buf, ptr_h->pool + t, ptr_h->size - t + 1); - memcpy(__buf + (ptr_h->size - t + 1), ptr_h->pool, - n - (ptr_h->size - t + 1)); - } - - /* In this function, only ptr_h->tail should be updated */ - ptr_h->tail = (t + n) % (ptr_h->size + 1); - - return n; -} diff --git a/lib/core/src/sha1.c b/lib/core/src/sha1.c deleted file mode 100644 index edd3b4fb4..000000000 --- a/lib/core/src/sha1.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * sha1.c - * - * Copyright (C) 1998, 2009 - * Paul E. Jones - * All Rights Reserved - * - ***************************************************************************** - * $Id: sha1.c 12 2009-06-22 19:34:25Z paulej $ - ***************************************************************************** - * - * Description: - * This file implements the Secure Hashing Standard as defined - * in FIPS PUB 180-1 published April 17, 1995. - * - * The Secure Hashing Standard, which uses the Secure Hashing - * Algorithm (SHA), produces a 160-bit message digest for a - * given data stream. In theory, it is highly improbable that - * two messages will produce the same message digest. Therefore, - * this algorithm can serve as a means of providing a "fingerprint" - * for a message. - * - * Portability Issues: - * SHA-1 is defined in terms of 32-bit "words". This code was - * written with the expectation that the processor has at least - * a 32-bit machine word size. If the machine word size is larger, - * the code should still function properly. One caveat to that - * is that the input functions taking characters and character - * arrays assume that only 8 bits of information are stored in each - * character. - * - * Caveats: - * SHA-1 is designed to work with messages less than 2^64 bits - * long. Although SHA-1 allows a message digest to be generated for - * messages of any number of bits less than 2^64, this - * implementation only works with messages with a length that is a - * multiple of the size of an 8-bit character. - * - */ - -#include "core_sha1.h" - -/* - * Define the circular shift macro - */ -#define SHA1CircularShift(bits,word) \ - ((((word) << (bits)) & 0xFFFFFFFF) | \ - ((word) >> (32-(bits)))) - -/* Function prototypes */ -static void SHA1ProcessMessageBlock(sha1_ctx *); -static void SHA1PadMessage(sha1_ctx *); - -/* - * sha1_init - * - * Description: - * This function will initialize the sha1_ctx in preparation - * for computing a new message digest. - * - * Parameters: - * context: [in/out] - * The context to reset. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void sha1_init(sha1_ctx *ctx) -{ - ctx->Length_Low = 0; - ctx->Length_High = 0; - ctx->Message_Block_Index = 0; - - ctx->Message_Digest[0] = 0x67452301; - ctx->Message_Digest[1] = 0xEFCDAB89; - ctx->Message_Digest[2] = 0x98BADCFE; - ctx->Message_Digest[3] = 0x10325476; - ctx->Message_Digest[4] = 0xC3D2E1F0; - - ctx->Computed = 0; - ctx->Corrupted = 0; -} - -/* - * sha1_final - * - * Description: - * This function will return the 160-bit message digest into the - * Message_Digest array within the sha1_ctx provided - * - * Parameters: - * context: [in/out] - * The context to use to calculate the SHA-1 hash. - * - * Returns: - * 1 if successful, 0 if it failed. - * - * Comments: - * - */ -#if 0 /* modifed by anoveth */ -void sha1_final(sha1_ctx *ctx) -#else -void sha1_final(sha1_ctx *ctx, c_uint8_t *digest) -#endif -{ -#if 0 /* blocked by anoveth */ - if (ctx->Corrupted) - { - return 0; - } -#endif - - if (!ctx->Computed) - { - SHA1PadMessage(ctx); - ctx->Computed = 1; - } - -#if 0 /* modified by anoveth */ - return 1; -#else - { -#if WORDS_BIGENDIAN - memcpy(digest, ctx->Message_Digest, SHA1_DIGEST_SIZE); -#else -#define ROTR(a) ((((unsigned)(a))>>8)|((a)<<24)) -#define ROTL(a) (((a)<<8)|(((unsigned)(a))>>24)) -#define SWAP32(a) (ROTL((a)&0xff00ff00)|ROTR((a)&0x00ff00ff)) - c_uint32_t n[5]; - n[0] = SWAP32(ctx->Message_Digest[0]); - n[1] = SWAP32(ctx->Message_Digest[1]); - n[2] = SWAP32(ctx->Message_Digest[2]); - n[3] = SWAP32(ctx->Message_Digest[3]); - n[4] = SWAP32(ctx->Message_Digest[4]); - - memcpy(digest, n, SHA1_DIGEST_SIZE); - } -#endif -#endif -} - -/* - * sha1_update - * - * Description: - * This function accepts an array of octets as the next portion of - * the message. - * - * Parameters: - * context: [in/out] - * The SHA-1 context to update - * message_array: [in] - * An array of characters representing the next portion of the - * message. - * length: [in] - * The length of the message in message_array - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void sha1_update(sha1_ctx *ctx, const c_uint8_t *message_array, - c_uint32_t length) -{ - if (!length) - { - return; - } - - if (ctx->Computed || ctx->Corrupted) - { - ctx->Corrupted = 1; - return; - } - - while(length-- && !ctx->Corrupted) - { - ctx->Message_Block[ctx->Message_Block_Index++] = - (*message_array & 0xFF); - - ctx->Length_Low += 8; - /* Force it to 32 bits */ - ctx->Length_Low &= 0xFFFFFFFF; - if (ctx->Length_Low == 0) - { - ctx->Length_High++; - /* Force it to 32 bits */ - ctx->Length_High &= 0xFFFFFFFF; - if (ctx->Length_High == 0) - { - /* Message is too long */ - ctx->Corrupted = 1; - } - } - - if (ctx->Message_Block_Index == 64) - { - SHA1ProcessMessageBlock(ctx); - } - - message_array++; - } -} - -/* - * SHA1ProcessMessageBlock - * - * Description: - * This function will process the next 512 bits of the message - * stored in the Message_Block array. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - * Many of the variable names in the SHAContext, especially the - * single character names, were used because those were the names - * used in the publication. - * - * - */ -static void SHA1ProcessMessageBlock(sha1_ctx *ctx) -{ - const unsigned K[] = /* Constants defined in SHA-1 */ - { - 0x5A827999, - 0x6ED9EBA1, - 0x8F1BBCDC, - 0xCA62C1D6 - }; - int t; /* Loop counter */ - unsigned temp; /* Temporary word value */ - unsigned W[80]; /* Word sequence */ - unsigned A, B, C, D, E; /* Word buffers */ - - /* - * Initialize the first 16 words in the array W - */ - for(t = 0; t < 16; t++) - { - W[t] = ((unsigned) ctx->Message_Block[t * 4]) << 24; - W[t] |= ((unsigned) ctx->Message_Block[t * 4 + 1]) << 16; - W[t] |= ((unsigned) ctx->Message_Block[t * 4 + 2]) << 8; - W[t] |= ((unsigned) ctx->Message_Block[t * 4 + 3]); - } - - for(t = 16; t < 80; t++) - { - W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - } - - A = ctx->Message_Digest[0]; - B = ctx->Message_Digest[1]; - C = ctx->Message_Digest[2]; - D = ctx->Message_Digest[3]; - E = ctx->Message_Digest[4]; - - for(t = 0; t < 20; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | ((~B) & D)) + E + W[t] + K[0]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 20; t < 40; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 40; t < 60; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 60; t < 80; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - ctx->Message_Digest[0] = - (ctx->Message_Digest[0] + A) & 0xFFFFFFFF; - ctx->Message_Digest[1] = - (ctx->Message_Digest[1] + B) & 0xFFFFFFFF; - ctx->Message_Digest[2] = - (ctx->Message_Digest[2] + C) & 0xFFFFFFFF; - ctx->Message_Digest[3] = - (ctx->Message_Digest[3] + D) & 0xFFFFFFFF; - ctx->Message_Digest[4] = - (ctx->Message_Digest[4] + E) & 0xFFFFFFFF; - - ctx->Message_Block_Index = 0; -} - -/* - * SHA1PadMessage - * - * Description: - * According to the standard, the message must be padded to an even - * 512 bits. The first padding bit must be a '1'. The last 64 - * bits represent the length of the original message. All bits in - * between should be 0. This function will pad the message - * according to those rules by filling the Message_Block array - * accordingly. It will also call SHA1ProcessMessageBlock() - * appropriately. When it returns, it can be assumed that the - * message digest has been computed. - * - * Parameters: - * context: [in/out] - * The context to pad - * - * Returns: - * Nothing. - * - * Comments: - * - */ -static void SHA1PadMessage(sha1_ctx *ctx) -{ - /* - * Check to see if the current message block is too small to hold - * the initial padding bits and length. If so, we will pad the - * block, process it, and then continue padding into a second - * block. - */ - if (ctx->Message_Block_Index > 55) - { - ctx->Message_Block[ctx->Message_Block_Index++] = 0x80; - while(ctx->Message_Block_Index < 64) - { - ctx->Message_Block[ctx->Message_Block_Index++] = 0; - } - - SHA1ProcessMessageBlock(ctx); - - while(ctx->Message_Block_Index < 56) - { - ctx->Message_Block[ctx->Message_Block_Index++] = 0; - } - } - else - { - ctx->Message_Block[ctx->Message_Block_Index++] = 0x80; - while(ctx->Message_Block_Index < 56) - { - ctx->Message_Block[ctx->Message_Block_Index++] = 0; - } - } - - /* - * Store the message length as the last 8 octets - */ - ctx->Message_Block[56] = (ctx->Length_High >> 24) & 0xFF; - ctx->Message_Block[57] = (ctx->Length_High >> 16) & 0xFF; - ctx->Message_Block[58] = (ctx->Length_High >> 8) & 0xFF; - ctx->Message_Block[59] = (ctx->Length_High) & 0xFF; - ctx->Message_Block[60] = (ctx->Length_Low >> 24) & 0xFF; - ctx->Message_Block[61] = (ctx->Length_Low >> 16) & 0xFF; - ctx->Message_Block[62] = (ctx->Length_Low >> 8) & 0xFF; - ctx->Message_Block[63] = (ctx->Length_Low) & 0xFF; - - SHA1ProcessMessageBlock(ctx); -} - -void sha1(const c_uint8_t *message, c_uint32_t len, c_uint8_t *digest) -{ - sha1_ctx ctx; - - sha1_init(&ctx); - sha1_update(&ctx, message, len); - sha1_final(&ctx, digest); -} diff --git a/lib/core/src/sha1_hmac.c b/lib/core/src/sha1_hmac.c deleted file mode 100644 index 47908473b..000000000 --- a/lib/core/src/sha1_hmac.c +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * HMAC-SHA-224/256/384/512 implementation - * Last update: 06/15/2005 - * Issue date: 06/15/2005 - * - * Copyright (C) 2005 Olivier Gay - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#include "core_sha1_hmac.h" - -void hmac_sha1_init(hmac_sha1_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size) -{ - c_uint32_t fill; - c_uint32_t num; - - c_uint8_t *key_used; - c_uint8_t key_temp[SHA1_DIGEST_SIZE]; - int i; - - if (key_size == SHA1_BLOCK_SIZE) { - key_used = key; - num = SHA1_BLOCK_SIZE; - } else { - if (key_size > SHA1_BLOCK_SIZE){ - key_used = key_temp; - num = SHA1_DIGEST_SIZE; - sha1(key, key_size, key_used); - } else { /* key_size > SHA1_BLOCK_SIZE */ - key_used = key; - num = key_size; - } - fill = SHA1_BLOCK_SIZE - num; - - memset(ctx->block_ipad + num, 0x36, fill); - memset(ctx->block_opad + num, 0x5c, fill); - } - - for (i = 0; i < num; i++) { - ctx->block_ipad[i] = key_used[i] ^ 0x36; - ctx->block_opad[i] = key_used[i] ^ 0x5c; - } - - sha1_init(&ctx->ctx_inside); - sha1_update(&ctx->ctx_inside, ctx->block_ipad, SHA1_BLOCK_SIZE); - - sha1_init(&ctx->ctx_outside); - sha1_update(&ctx->ctx_outside, ctx->block_opad, - SHA1_BLOCK_SIZE); - - /* for hmac_reinit */ - memcpy(&ctx->ctx_inside_reinit, &ctx->ctx_inside, - sizeof(sha1_ctx)); - memcpy(&ctx->ctx_outside_reinit, &ctx->ctx_outside, - sizeof(sha1_ctx)); -} - -void hmac_sha1_reinit(hmac_sha1_ctx *ctx) -{ - memcpy(&ctx->ctx_inside, &ctx->ctx_inside_reinit, - sizeof(sha1_ctx)); - memcpy(&ctx->ctx_outside, &ctx->ctx_outside_reinit, - sizeof(sha1_ctx)); -} - -void hmac_sha1_update(hmac_sha1_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len) -{ - sha1_update(&ctx->ctx_inside, message, message_len); -} - -void hmac_sha1_final(hmac_sha1_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size) -{ - c_uint8_t digest_inside[SHA1_DIGEST_SIZE]; - c_uint8_t mac_temp[SHA1_DIGEST_SIZE]; - - sha1_final(&ctx->ctx_inside, digest_inside); - sha1_update(&ctx->ctx_outside, digest_inside, SHA1_DIGEST_SIZE); - sha1_final(&ctx->ctx_outside, mac_temp); - memcpy(mac, mac_temp, mac_size); -} - -void hmac_sha1(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size) -{ - hmac_sha1_ctx ctx; - - hmac_sha1_init(&ctx, key, key_size); - hmac_sha1_update(&ctx, message, message_len); - hmac_sha1_final(&ctx, mac, mac_size); -} diff --git a/lib/core/src/sha2.c b/lib/core/src/sha2.c deleted file mode 100644 index 25ad5abee..000000000 --- a/lib/core/src/sha2.c +++ /dev/null @@ -1,822 +0,0 @@ -/* - * FIPS 180-2 SHA-224/256/384/512 implementation - * Last update: 02/02/2007 - * Issue date: 04/30/2005 - * - * Copyright (C) 2005, 2007 Olivier Gay - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if 0 -#define UNROLL_LOOPS /* Enable loops unrolling */ -#endif - -#define TRACE_MODULE _sha2 -#include "core_debug.h" -#include "core_sha2.h" - -#define SHFR(x, n) (x >> n) -#define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) -#define ROTL(x, n) ((x << n) | (x >> ((sizeof(x) << 3) - n))) -#define CH(x, y, z) ((x & y) ^ (~x & z)) -#define MAJ(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) - -#define SHA256_F1(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) -#define SHA256_F2(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) -#define SHA256_F3(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHFR(x, 3)) -#define SHA256_F4(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHFR(x, 10)) - -#define SHA512_F1(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39)) -#define SHA512_F2(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41)) -#define SHA512_F3(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHFR(x, 7)) -#define SHA512_F4(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHFR(x, 6)) - -#define UNPACK32(x, str) \ -{ \ - *((str) + 3) = (c_uint8_t) ((x) ); \ - *((str) + 2) = (c_uint8_t) ((x) >> 8); \ - *((str) + 1) = (c_uint8_t) ((x) >> 16); \ - *((str) + 0) = (c_uint8_t) ((x) >> 24); \ -} - -#define PACK32(str, x) \ -{ \ - *(x) = ((c_uint32_t) *((str) + 3) ) \ - | ((c_uint32_t) *((str) + 2) << 8) \ - | ((c_uint32_t) *((str) + 1) << 16) \ - | ((c_uint32_t) *((str) + 0) << 24); \ -} - -#define UNPACK64(x, str) \ -{ \ - *((str) + 7) = (c_uint8_t) ((x) ); \ - *((str) + 6) = (c_uint8_t) ((x) >> 8); \ - *((str) + 5) = (c_uint8_t) ((x) >> 16); \ - *((str) + 4) = (c_uint8_t) ((x) >> 24); \ - *((str) + 3) = (c_uint8_t) ((x) >> 32); \ - *((str) + 2) = (c_uint8_t) ((x) >> 40); \ - *((str) + 1) = (c_uint8_t) ((x) >> 48); \ - *((str) + 0) = (c_uint8_t) ((x) >> 56); \ -} - -#define PACK64(str, x) \ -{ \ - *(x) = ((c_uint64_t) *((str) + 7) ) \ - | ((c_uint64_t) *((str) + 6) << 8) \ - | ((c_uint64_t) *((str) + 5) << 16) \ - | ((c_uint64_t) *((str) + 4) << 24) \ - | ((c_uint64_t) *((str) + 3) << 32) \ - | ((c_uint64_t) *((str) + 2) << 40) \ - | ((c_uint64_t) *((str) + 1) << 48) \ - | ((c_uint64_t) *((str) + 0) << 56); \ -} - -/* Macros used for loops unrolling */ - -#define SHA256_SCR(i) \ -{ \ - w[i] = SHA256_F4(w[i - 2]) + w[i - 7] \ - + SHA256_F3(w[i - 15]) + w[i - 16]; \ -} - -#define SHA512_SCR(i) \ -{ \ - w[i] = SHA512_F4(w[i - 2]) + w[i - 7] \ - + SHA512_F3(w[i - 15]) + w[i - 16]; \ -} - -#define SHA256_EXP(a, b, c, d, e, f, g, h, j) \ -{ \ - t1 = wv[h] + SHA256_F2(wv[e]) + CH(wv[e], wv[f], wv[g]) \ - + sha256_k[j] + w[j]; \ - t2 = SHA256_F1(wv[a]) + MAJ(wv[a], wv[b], wv[c]); \ - wv[d] += t1; \ - wv[h] = t1 + t2; \ -} - -#define SHA512_EXP(a, b, c, d, e, f, g ,h, j) \ -{ \ - t1 = wv[h] + SHA512_F2(wv[e]) + CH(wv[e], wv[f], wv[g]) \ - + sha512_k[j] + w[j]; \ - t2 = SHA512_F1(wv[a]) + MAJ(wv[a], wv[b], wv[c]); \ - wv[d] += t1; \ - wv[h] = t1 + t2; \ -} - -c_uint32_t sha224_h0[8] = - {0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, - 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4}; - -c_uint32_t sha256_h0[8] = - {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; - -c_uint64_t sha384_h0[8] = - {0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, - 0x9159015a3070dd17ULL, 0x152fecd8f70e5939ULL, - 0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL, - 0xdb0c2e0d64f98fa7ULL, 0x47b5481dbefa4fa4ULL}; - -c_uint64_t sha512_h0[8] = - {0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, - 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, - 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, - 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL}; - -c_uint32_t sha256_k[64] = - {0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; - -c_uint64_t sha512_k[80] = - {0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, - 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, - 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, - 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, - 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, - 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, - 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, - 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, - 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, - 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, - 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, - 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, - 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, - 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, - 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, - 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, - 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, - 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, - 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, - 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, - 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, - 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, - 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, - 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, - 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, - 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, - 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, - 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, - 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, - 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, - 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, - 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, - 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, - 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, - 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, - 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, - 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, - 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, - 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, - 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL}; - -/* SHA-256 functions */ - -void sha256_transf(sha256_ctx *ctx, const c_uint8_t *message, - c_uint32_t block_nb) -{ - c_uint32_t w[64]; - c_uint32_t wv[8]; - c_uint32_t t1, t2; - const c_uint8_t *sub_block; - int i; - -#ifndef UNROLL_LOOPS - int j; -#endif - - for (i = 0; i < (int) block_nb; i++) { - sub_block = message + (i << 6); - -#ifndef UNROLL_LOOPS - for (j = 0; j < 16; j++) { - PACK32(&sub_block[j << 2], &w[j]); - } - - for (j = 16; j < 64; j++) { - SHA256_SCR(j); - } - - for (j = 0; j < 8; j++) { - wv[j] = ctx->h[j]; - } - - for (j = 0; j < 64; j++) { - t1 = wv[7] + SHA256_F2(wv[4]) + CH(wv[4], wv[5], wv[6]) - + sha256_k[j] + w[j]; - t2 = SHA256_F1(wv[0]) + MAJ(wv[0], wv[1], wv[2]); - wv[7] = wv[6]; - wv[6] = wv[5]; - wv[5] = wv[4]; - wv[4] = wv[3] + t1; - wv[3] = wv[2]; - wv[2] = wv[1]; - wv[1] = wv[0]; - wv[0] = t1 + t2; - } - - for (j = 0; j < 8; j++) { - ctx->h[j] += wv[j]; - } -#else - PACK32(&sub_block[ 0], &w[ 0]); PACK32(&sub_block[ 4], &w[ 1]); - PACK32(&sub_block[ 8], &w[ 2]); PACK32(&sub_block[12], &w[ 3]); - PACK32(&sub_block[16], &w[ 4]); PACK32(&sub_block[20], &w[ 5]); - PACK32(&sub_block[24], &w[ 6]); PACK32(&sub_block[28], &w[ 7]); - PACK32(&sub_block[32], &w[ 8]); PACK32(&sub_block[36], &w[ 9]); - PACK32(&sub_block[40], &w[10]); PACK32(&sub_block[44], &w[11]); - PACK32(&sub_block[48], &w[12]); PACK32(&sub_block[52], &w[13]); - PACK32(&sub_block[56], &w[14]); PACK32(&sub_block[60], &w[15]); - - SHA256_SCR(16); SHA256_SCR(17); SHA256_SCR(18); SHA256_SCR(19); - SHA256_SCR(20); SHA256_SCR(21); SHA256_SCR(22); SHA256_SCR(23); - SHA256_SCR(24); SHA256_SCR(25); SHA256_SCR(26); SHA256_SCR(27); - SHA256_SCR(28); SHA256_SCR(29); SHA256_SCR(30); SHA256_SCR(31); - SHA256_SCR(32); SHA256_SCR(33); SHA256_SCR(34); SHA256_SCR(35); - SHA256_SCR(36); SHA256_SCR(37); SHA256_SCR(38); SHA256_SCR(39); - SHA256_SCR(40); SHA256_SCR(41); SHA256_SCR(42); SHA256_SCR(43); - SHA256_SCR(44); SHA256_SCR(45); SHA256_SCR(46); SHA256_SCR(47); - SHA256_SCR(48); SHA256_SCR(49); SHA256_SCR(50); SHA256_SCR(51); - SHA256_SCR(52); SHA256_SCR(53); SHA256_SCR(54); SHA256_SCR(55); - SHA256_SCR(56); SHA256_SCR(57); SHA256_SCR(58); SHA256_SCR(59); - SHA256_SCR(60); SHA256_SCR(61); SHA256_SCR(62); SHA256_SCR(63); - - wv[0] = ctx->h[0]; wv[1] = ctx->h[1]; - wv[2] = ctx->h[2]; wv[3] = ctx->h[3]; - wv[4] = ctx->h[4]; wv[5] = ctx->h[5]; - wv[6] = ctx->h[6]; wv[7] = ctx->h[7]; - - SHA256_EXP(0,1,2,3,4,5,6,7, 0); SHA256_EXP(7,0,1,2,3,4,5,6, 1); - SHA256_EXP(6,7,0,1,2,3,4,5, 2); SHA256_EXP(5,6,7,0,1,2,3,4, 3); - SHA256_EXP(4,5,6,7,0,1,2,3, 4); SHA256_EXP(3,4,5,6,7,0,1,2, 5); - SHA256_EXP(2,3,4,5,6,7,0,1, 6); SHA256_EXP(1,2,3,4,5,6,7,0, 7); - SHA256_EXP(0,1,2,3,4,5,6,7, 8); SHA256_EXP(7,0,1,2,3,4,5,6, 9); - SHA256_EXP(6,7,0,1,2,3,4,5,10); SHA256_EXP(5,6,7,0,1,2,3,4,11); - SHA256_EXP(4,5,6,7,0,1,2,3,12); SHA256_EXP(3,4,5,6,7,0,1,2,13); - SHA256_EXP(2,3,4,5,6,7,0,1,14); SHA256_EXP(1,2,3,4,5,6,7,0,15); - SHA256_EXP(0,1,2,3,4,5,6,7,16); SHA256_EXP(7,0,1,2,3,4,5,6,17); - SHA256_EXP(6,7,0,1,2,3,4,5,18); SHA256_EXP(5,6,7,0,1,2,3,4,19); - SHA256_EXP(4,5,6,7,0,1,2,3,20); SHA256_EXP(3,4,5,6,7,0,1,2,21); - SHA256_EXP(2,3,4,5,6,7,0,1,22); SHA256_EXP(1,2,3,4,5,6,7,0,23); - SHA256_EXP(0,1,2,3,4,5,6,7,24); SHA256_EXP(7,0,1,2,3,4,5,6,25); - SHA256_EXP(6,7,0,1,2,3,4,5,26); SHA256_EXP(5,6,7,0,1,2,3,4,27); - SHA256_EXP(4,5,6,7,0,1,2,3,28); SHA256_EXP(3,4,5,6,7,0,1,2,29); - SHA256_EXP(2,3,4,5,6,7,0,1,30); SHA256_EXP(1,2,3,4,5,6,7,0,31); - SHA256_EXP(0,1,2,3,4,5,6,7,32); SHA256_EXP(7,0,1,2,3,4,5,6,33); - SHA256_EXP(6,7,0,1,2,3,4,5,34); SHA256_EXP(5,6,7,0,1,2,3,4,35); - SHA256_EXP(4,5,6,7,0,1,2,3,36); SHA256_EXP(3,4,5,6,7,0,1,2,37); - SHA256_EXP(2,3,4,5,6,7,0,1,38); SHA256_EXP(1,2,3,4,5,6,7,0,39); - SHA256_EXP(0,1,2,3,4,5,6,7,40); SHA256_EXP(7,0,1,2,3,4,5,6,41); - SHA256_EXP(6,7,0,1,2,3,4,5,42); SHA256_EXP(5,6,7,0,1,2,3,4,43); - SHA256_EXP(4,5,6,7,0,1,2,3,44); SHA256_EXP(3,4,5,6,7,0,1,2,45); - SHA256_EXP(2,3,4,5,6,7,0,1,46); SHA256_EXP(1,2,3,4,5,6,7,0,47); - SHA256_EXP(0,1,2,3,4,5,6,7,48); SHA256_EXP(7,0,1,2,3,4,5,6,49); - SHA256_EXP(6,7,0,1,2,3,4,5,50); SHA256_EXP(5,6,7,0,1,2,3,4,51); - SHA256_EXP(4,5,6,7,0,1,2,3,52); SHA256_EXP(3,4,5,6,7,0,1,2,53); - SHA256_EXP(2,3,4,5,6,7,0,1,54); SHA256_EXP(1,2,3,4,5,6,7,0,55); - SHA256_EXP(0,1,2,3,4,5,6,7,56); SHA256_EXP(7,0,1,2,3,4,5,6,57); - SHA256_EXP(6,7,0,1,2,3,4,5,58); SHA256_EXP(5,6,7,0,1,2,3,4,59); - SHA256_EXP(4,5,6,7,0,1,2,3,60); SHA256_EXP(3,4,5,6,7,0,1,2,61); - SHA256_EXP(2,3,4,5,6,7,0,1,62); SHA256_EXP(1,2,3,4,5,6,7,0,63); - - ctx->h[0] += wv[0]; ctx->h[1] += wv[1]; - ctx->h[2] += wv[2]; ctx->h[3] += wv[3]; - ctx->h[4] += wv[4]; ctx->h[5] += wv[5]; - ctx->h[6] += wv[6]; ctx->h[7] += wv[7]; -#endif /* !UNROLL_LOOPS */ - } -} - -void sha256(const c_uint8_t *message, c_uint32_t len, c_uint8_t *digest) -{ - sha256_ctx ctx; - - sha256_init(&ctx); - sha256_update(&ctx, message, len); - sha256_final(&ctx, digest); -} - -void sha256_init(sha256_ctx *ctx) -{ -#ifndef UNROLL_LOOPS - int i; - for (i = 0; i < 8; i++) { - ctx->h[i] = sha256_h0[i]; - } -#else - ctx->h[0] = sha256_h0[0]; ctx->h[1] = sha256_h0[1]; - ctx->h[2] = sha256_h0[2]; ctx->h[3] = sha256_h0[3]; - ctx->h[4] = sha256_h0[4]; ctx->h[5] = sha256_h0[5]; - ctx->h[6] = sha256_h0[6]; ctx->h[7] = sha256_h0[7]; -#endif /* !UNROLL_LOOPS */ - - ctx->len = 0; - ctx->tot_len = 0; -} - -void sha256_update(sha256_ctx *ctx, const c_uint8_t *message, - c_uint32_t len) -{ - c_uint32_t block_nb; - c_uint32_t new_len, rem_len, tmp_len; - const c_uint8_t *shifted_message; - - tmp_len = SHA256_BLOCK_SIZE - ctx->len; - rem_len = len < tmp_len ? len : tmp_len; - - memcpy(&ctx->block[ctx->len], message, rem_len); - - if (ctx->len + len < SHA256_BLOCK_SIZE) { - ctx->len += len; - return; - } - - new_len = len - rem_len; - block_nb = new_len / SHA256_BLOCK_SIZE; - - shifted_message = message + rem_len; - - sha256_transf(ctx, ctx->block, 1); - sha256_transf(ctx, shifted_message, block_nb); - - rem_len = new_len % SHA256_BLOCK_SIZE; - - memcpy(ctx->block, &shifted_message[block_nb << 6], - rem_len); - - ctx->len = rem_len; - ctx->tot_len += (block_nb + 1) << 6; -} - -void sha256_final(sha256_ctx *ctx, c_uint8_t *digest) -{ - c_uint32_t block_nb; - c_uint32_t pm_len; - c_uint32_t len_b; - -#ifndef UNROLL_LOOPS - int i; -#endif - - block_nb = (1 + ((SHA256_BLOCK_SIZE - 9) - < (ctx->len % SHA256_BLOCK_SIZE))); - - len_b = (ctx->tot_len + ctx->len) << 3; - pm_len = block_nb << 6; - - memset(ctx->block + ctx->len, 0, pm_len - ctx->len); - ctx->block[ctx->len] = 0x80; - UNPACK32(len_b, ctx->block + pm_len - 4); - - sha256_transf(ctx, ctx->block, block_nb); - -#ifndef UNROLL_LOOPS - for (i = 0 ; i < 8; i++) { - UNPACK32(ctx->h[i], &digest[i << 2]); - } -#else - UNPACK32(ctx->h[0], &digest[ 0]); - UNPACK32(ctx->h[1], &digest[ 4]); - UNPACK32(ctx->h[2], &digest[ 8]); - UNPACK32(ctx->h[3], &digest[12]); - UNPACK32(ctx->h[4], &digest[16]); - UNPACK32(ctx->h[5], &digest[20]); - UNPACK32(ctx->h[6], &digest[24]); - UNPACK32(ctx->h[7], &digest[28]); -#endif /* !UNROLL_LOOPS */ -} - -/* SHA-512 functions */ - -void sha512_transf(sha512_ctx *ctx, const c_uint8_t *message, - c_uint32_t block_nb) -{ - c_uint64_t w[80]; - c_uint64_t wv[8]; - c_uint64_t t1, t2; - const c_uint8_t *sub_block; - int i, j; - - for (i = 0; i < (int) block_nb; i++) { - sub_block = message + (i << 7); - -#ifndef UNROLL_LOOPS - for (j = 0; j < 16; j++) { - PACK64(&sub_block[j << 3], &w[j]); - } - - for (j = 16; j < 80; j++) { - SHA512_SCR(j); - } - - for (j = 0; j < 8; j++) { - wv[j] = ctx->h[j]; - } - - for (j = 0; j < 80; j++) { - t1 = wv[7] + SHA512_F2(wv[4]) + CH(wv[4], wv[5], wv[6]) - + sha512_k[j] + w[j]; - t2 = SHA512_F1(wv[0]) + MAJ(wv[0], wv[1], wv[2]); - wv[7] = wv[6]; - wv[6] = wv[5]; - wv[5] = wv[4]; - wv[4] = wv[3] + t1; - wv[3] = wv[2]; - wv[2] = wv[1]; - wv[1] = wv[0]; - wv[0] = t1 + t2; - } - - for (j = 0; j < 8; j++) { - ctx->h[j] += wv[j]; - } -#else - PACK64(&sub_block[ 0], &w[ 0]); PACK64(&sub_block[ 8], &w[ 1]); - PACK64(&sub_block[ 16], &w[ 2]); PACK64(&sub_block[ 24], &w[ 3]); - PACK64(&sub_block[ 32], &w[ 4]); PACK64(&sub_block[ 40], &w[ 5]); - PACK64(&sub_block[ 48], &w[ 6]); PACK64(&sub_block[ 56], &w[ 7]); - PACK64(&sub_block[ 64], &w[ 8]); PACK64(&sub_block[ 72], &w[ 9]); - PACK64(&sub_block[ 80], &w[10]); PACK64(&sub_block[ 88], &w[11]); - PACK64(&sub_block[ 96], &w[12]); PACK64(&sub_block[104], &w[13]); - PACK64(&sub_block[112], &w[14]); PACK64(&sub_block[120], &w[15]); - - SHA512_SCR(16); SHA512_SCR(17); SHA512_SCR(18); SHA512_SCR(19); - SHA512_SCR(20); SHA512_SCR(21); SHA512_SCR(22); SHA512_SCR(23); - SHA512_SCR(24); SHA512_SCR(25); SHA512_SCR(26); SHA512_SCR(27); - SHA512_SCR(28); SHA512_SCR(29); SHA512_SCR(30); SHA512_SCR(31); - SHA512_SCR(32); SHA512_SCR(33); SHA512_SCR(34); SHA512_SCR(35); - SHA512_SCR(36); SHA512_SCR(37); SHA512_SCR(38); SHA512_SCR(39); - SHA512_SCR(40); SHA512_SCR(41); SHA512_SCR(42); SHA512_SCR(43); - SHA512_SCR(44); SHA512_SCR(45); SHA512_SCR(46); SHA512_SCR(47); - SHA512_SCR(48); SHA512_SCR(49); SHA512_SCR(50); SHA512_SCR(51); - SHA512_SCR(52); SHA512_SCR(53); SHA512_SCR(54); SHA512_SCR(55); - SHA512_SCR(56); SHA512_SCR(57); SHA512_SCR(58); SHA512_SCR(59); - SHA512_SCR(60); SHA512_SCR(61); SHA512_SCR(62); SHA512_SCR(63); - SHA512_SCR(64); SHA512_SCR(65); SHA512_SCR(66); SHA512_SCR(67); - SHA512_SCR(68); SHA512_SCR(69); SHA512_SCR(70); SHA512_SCR(71); - SHA512_SCR(72); SHA512_SCR(73); SHA512_SCR(74); SHA512_SCR(75); - SHA512_SCR(76); SHA512_SCR(77); SHA512_SCR(78); SHA512_SCR(79); - - wv[0] = ctx->h[0]; wv[1] = ctx->h[1]; - wv[2] = ctx->h[2]; wv[3] = ctx->h[3]; - wv[4] = ctx->h[4]; wv[5] = ctx->h[5]; - wv[6] = ctx->h[6]; wv[7] = ctx->h[7]; - - j = 0; - - do { - SHA512_EXP(0,1,2,3,4,5,6,7,j); j++; - SHA512_EXP(7,0,1,2,3,4,5,6,j); j++; - SHA512_EXP(6,7,0,1,2,3,4,5,j); j++; - SHA512_EXP(5,6,7,0,1,2,3,4,j); j++; - SHA512_EXP(4,5,6,7,0,1,2,3,j); j++; - SHA512_EXP(3,4,5,6,7,0,1,2,j); j++; - SHA512_EXP(2,3,4,5,6,7,0,1,j); j++; - SHA512_EXP(1,2,3,4,5,6,7,0,j); j++; - } while (j < 80); - - ctx->h[0] += wv[0]; ctx->h[1] += wv[1]; - ctx->h[2] += wv[2]; ctx->h[3] += wv[3]; - ctx->h[4] += wv[4]; ctx->h[5] += wv[5]; - ctx->h[6] += wv[6]; ctx->h[7] += wv[7]; -#endif /* !UNROLL_LOOPS */ - } -} - -void sha512(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest) -{ - sha512_ctx ctx; - - sha512_init(&ctx); - sha512_update(&ctx, message, len); - sha512_final(&ctx, digest); -} - -void sha512_init(sha512_ctx *ctx) -{ -#ifndef UNROLL_LOOPS - int i; - for (i = 0; i < 8; i++) { - ctx->h[i] = sha512_h0[i]; - } -#else - ctx->h[0] = sha512_h0[0]; ctx->h[1] = sha512_h0[1]; - ctx->h[2] = sha512_h0[2]; ctx->h[3] = sha512_h0[3]; - ctx->h[4] = sha512_h0[4]; ctx->h[5] = sha512_h0[5]; - ctx->h[6] = sha512_h0[6]; ctx->h[7] = sha512_h0[7]; -#endif /* !UNROLL_LOOPS */ - - ctx->len = 0; - ctx->tot_len = 0; -} - -void sha512_update(sha512_ctx *ctx, const c_uint8_t *message, - c_uint32_t len) -{ - c_uint32_t block_nb; - c_uint32_t new_len, rem_len, tmp_len; - const c_uint8_t *shifted_message; - - tmp_len = SHA512_BLOCK_SIZE - ctx->len; - rem_len = len < tmp_len ? len : tmp_len; - - memcpy(&ctx->block[ctx->len], message, rem_len); - - if (ctx->len + len < SHA512_BLOCK_SIZE) { - ctx->len += len; - return; - } - - new_len = len - rem_len; - block_nb = new_len / SHA512_BLOCK_SIZE; - - shifted_message = message + rem_len; - - sha512_transf(ctx, ctx->block, 1); - sha512_transf(ctx, shifted_message, block_nb); - - rem_len = new_len % SHA512_BLOCK_SIZE; - - memcpy(ctx->block, &shifted_message[block_nb << 7], - rem_len); - - ctx->len = rem_len; - ctx->tot_len += (block_nb + 1) << 7; -} - -void sha512_final(sha512_ctx *ctx, c_uint8_t *digest) -{ - c_uint32_t block_nb; - c_uint32_t pm_len; - c_uint32_t len_b; - -#ifndef UNROLL_LOOPS - int i; -#endif - - block_nb = 1 + ((SHA512_BLOCK_SIZE - 17) - < (ctx->len % SHA512_BLOCK_SIZE)); - - len_b = (ctx->tot_len + ctx->len) << 3; - pm_len = block_nb << 7; - - memset(ctx->block + ctx->len, 0, pm_len - ctx->len); - ctx->block[ctx->len] = 0x80; - UNPACK32(len_b, ctx->block + pm_len - 4); - - sha512_transf(ctx, ctx->block, block_nb); - -#ifndef UNROLL_LOOPS - for (i = 0 ; i < 8; i++) { - UNPACK64(ctx->h[i], &digest[i << 3]); - } -#else - UNPACK64(ctx->h[0], &digest[ 0]); - UNPACK64(ctx->h[1], &digest[ 8]); - UNPACK64(ctx->h[2], &digest[16]); - UNPACK64(ctx->h[3], &digest[24]); - UNPACK64(ctx->h[4], &digest[32]); - UNPACK64(ctx->h[5], &digest[40]); - UNPACK64(ctx->h[6], &digest[48]); - UNPACK64(ctx->h[7], &digest[56]); -#endif /* !UNROLL_LOOPS */ -} - -/* SHA-384 functions */ - -void sha384(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest) -{ - sha384_ctx ctx; - - sha384_init(&ctx); - sha384_update(&ctx, message, len); - sha384_final(&ctx, digest); -} - -void sha384_init(sha384_ctx *ctx) -{ -#ifndef UNROLL_LOOPS - int i; - for (i = 0; i < 8; i++) { - ctx->h[i] = sha384_h0[i]; - } -#else - ctx->h[0] = sha384_h0[0]; ctx->h[1] = sha384_h0[1]; - ctx->h[2] = sha384_h0[2]; ctx->h[3] = sha384_h0[3]; - ctx->h[4] = sha384_h0[4]; ctx->h[5] = sha384_h0[5]; - ctx->h[6] = sha384_h0[6]; ctx->h[7] = sha384_h0[7]; -#endif /* !UNROLL_LOOPS */ - - ctx->len = 0; - ctx->tot_len = 0; -} - -void sha384_update(sha384_ctx *ctx, const c_uint8_t *message, - c_uint32_t len) -{ - c_uint32_t block_nb; - c_uint32_t new_len, rem_len, tmp_len; - const c_uint8_t *shifted_message; - - tmp_len = SHA384_BLOCK_SIZE - ctx->len; - rem_len = len < tmp_len ? len : tmp_len; - - memcpy(&ctx->block[ctx->len], message, rem_len); - - if (ctx->len + len < SHA384_BLOCK_SIZE) { - ctx->len += len; - return; - } - - new_len = len - rem_len; - block_nb = new_len / SHA384_BLOCK_SIZE; - - shifted_message = message + rem_len; - - sha512_transf(ctx, ctx->block, 1); - sha512_transf(ctx, shifted_message, block_nb); - - rem_len = new_len % SHA384_BLOCK_SIZE; - - memcpy(ctx->block, &shifted_message[block_nb << 7], - rem_len); - - ctx->len = rem_len; - ctx->tot_len += (block_nb + 1) << 7; -} - -void sha384_final(sha384_ctx *ctx, c_uint8_t *digest) -{ - c_uint32_t block_nb; - c_uint32_t pm_len; - c_uint32_t len_b; - -#ifndef UNROLL_LOOPS - int i; -#endif - - block_nb = (1 + ((SHA384_BLOCK_SIZE - 17) - < (ctx->len % SHA384_BLOCK_SIZE))); - - len_b = (ctx->tot_len + ctx->len) << 3; - pm_len = block_nb << 7; - - memset(ctx->block + ctx->len, 0, pm_len - ctx->len); - ctx->block[ctx->len] = 0x80; - UNPACK32(len_b, ctx->block + pm_len - 4); - - sha512_transf(ctx, ctx->block, block_nb); - -#ifndef UNROLL_LOOPS - for (i = 0 ; i < 6; i++) { - UNPACK64(ctx->h[i], &digest[i << 3]); - } -#else - UNPACK64(ctx->h[0], &digest[ 0]); - UNPACK64(ctx->h[1], &digest[ 8]); - UNPACK64(ctx->h[2], &digest[16]); - UNPACK64(ctx->h[3], &digest[24]); - UNPACK64(ctx->h[4], &digest[32]); - UNPACK64(ctx->h[5], &digest[40]); -#endif /* !UNROLL_LOOPS */ -} - -/* SHA-224 functions */ - -void sha224(const c_uint8_t *message, c_uint32_t len, - c_uint8_t *digest) -{ - sha224_ctx ctx; - - sha224_init(&ctx); - sha224_update(&ctx, message, len); - sha224_final(&ctx, digest); -} - -void sha224_init(sha224_ctx *ctx) -{ -#ifndef UNROLL_LOOPS - int i; - for (i = 0; i < 8; i++) { - ctx->h[i] = sha224_h0[i]; - } -#else - ctx->h[0] = sha224_h0[0]; ctx->h[1] = sha224_h0[1]; - ctx->h[2] = sha224_h0[2]; ctx->h[3] = sha224_h0[3]; - ctx->h[4] = sha224_h0[4]; ctx->h[5] = sha224_h0[5]; - ctx->h[6] = sha224_h0[6]; ctx->h[7] = sha224_h0[7]; -#endif /* !UNROLL_LOOPS */ - - ctx->len = 0; - ctx->tot_len = 0; -} - -void sha224_update(sha224_ctx *ctx, const c_uint8_t *message, - c_uint32_t len) -{ - c_uint32_t block_nb; - c_uint32_t new_len, rem_len, tmp_len; - const c_uint8_t *shifted_message; - - tmp_len = SHA224_BLOCK_SIZE - ctx->len; - rem_len = len < tmp_len ? len : tmp_len; - - memcpy(&ctx->block[ctx->len], message, rem_len); - - if (ctx->len + len < SHA224_BLOCK_SIZE) { - ctx->len += len; - return; - } - - new_len = len - rem_len; - block_nb = new_len / SHA224_BLOCK_SIZE; - - shifted_message = message + rem_len; - - sha256_transf(ctx, ctx->block, 1); - sha256_transf(ctx, shifted_message, block_nb); - - rem_len = new_len % SHA224_BLOCK_SIZE; - - memcpy(ctx->block, &shifted_message[block_nb << 6], - rem_len); - - ctx->len = rem_len; - ctx->tot_len += (block_nb + 1) << 6; -} - -void sha224_final(sha224_ctx *ctx, c_uint8_t *digest) -{ - c_uint32_t block_nb; - c_uint32_t pm_len; - c_uint32_t len_b; - -#ifndef UNROLL_LOOPS - int i; -#endif - - block_nb = (1 + ((SHA224_BLOCK_SIZE - 9) - < (ctx->len % SHA224_BLOCK_SIZE))); - - len_b = (ctx->tot_len + ctx->len) << 3; - pm_len = block_nb << 6; - - memset(ctx->block + ctx->len, 0, pm_len - ctx->len); - ctx->block[ctx->len] = 0x80; - UNPACK32(len_b, ctx->block + pm_len - 4); - - sha256_transf(ctx, ctx->block, block_nb); - -#ifndef UNROLL_LOOPS - for (i = 0 ; i < 7; i++) { - UNPACK32(ctx->h[i], &digest[i << 2]); - } -#else - UNPACK32(ctx->h[0], &digest[ 0]); - UNPACK32(ctx->h[1], &digest[ 4]); - UNPACK32(ctx->h[2], &digest[ 8]); - UNPACK32(ctx->h[3], &digest[12]); - UNPACK32(ctx->h[4], &digest[16]); - UNPACK32(ctx->h[5], &digest[20]); - UNPACK32(ctx->h[6], &digest[24]); -#endif /* !UNROLL_LOOPS */ -} diff --git a/lib/core/src/sha2_hmac.c b/lib/core/src/sha2_hmac.c deleted file mode 100644 index 0eacd2447..000000000 --- a/lib/core/src/sha2_hmac.c +++ /dev/null @@ -1,380 +0,0 @@ -/*- - * HMAC-SHA-224/256/384/512 implementation - * Last update: 06/15/2005 - * Issue date: 06/15/2005 - * - * Copyright (C) 2005 Olivier Gay - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#include "core_sha2_hmac.h" - -/* HMAC-SHA-224 functions */ - -void hmac_sha224_init(hmac_sha224_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size) -{ - c_uint32_t fill; - c_uint32_t num; - - c_uint8_t *key_used; - c_uint8_t key_temp[SHA224_DIGEST_SIZE]; - int i; - - if (key_size == SHA224_BLOCK_SIZE) { - key_used = key; - num = SHA224_BLOCK_SIZE; - } else { - if (key_size > SHA224_BLOCK_SIZE){ - key_used = key_temp; - num = SHA224_DIGEST_SIZE; - sha224(key, key_size, key_used); - } else { /* key_size > SHA224_BLOCK_SIZE */ - key_used = key; - num = key_size; - } - fill = SHA224_BLOCK_SIZE - num; - - memset(ctx->block_ipad + num, 0x36, fill); - memset(ctx->block_opad + num, 0x5c, fill); - } - - for (i = 0; i < num; i++) { - ctx->block_ipad[i] = key_used[i] ^ 0x36; - ctx->block_opad[i] = key_used[i] ^ 0x5c; - } - - sha224_init(&ctx->ctx_inside); - sha224_update(&ctx->ctx_inside, ctx->block_ipad, SHA224_BLOCK_SIZE); - - sha224_init(&ctx->ctx_outside); - sha224_update(&ctx->ctx_outside, ctx->block_opad, - SHA224_BLOCK_SIZE); - - /* for hmac_reinit */ - memcpy(&ctx->ctx_inside_reinit, &ctx->ctx_inside, - sizeof(sha224_ctx)); - memcpy(&ctx->ctx_outside_reinit, &ctx->ctx_outside, - sizeof(sha224_ctx)); -} - -void hmac_sha224_reinit(hmac_sha224_ctx *ctx) -{ - memcpy(&ctx->ctx_inside, &ctx->ctx_inside_reinit, - sizeof(sha224_ctx)); - memcpy(&ctx->ctx_outside, &ctx->ctx_outside_reinit, - sizeof(sha224_ctx)); -} - -void hmac_sha224_update(hmac_sha224_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len) -{ - sha224_update(&ctx->ctx_inside, message, message_len); -} - -void hmac_sha224_final(hmac_sha224_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size) -{ - c_uint8_t digest_inside[SHA224_DIGEST_SIZE]; - c_uint8_t mac_temp[SHA224_DIGEST_SIZE]; - - sha224_final(&ctx->ctx_inside, digest_inside); - sha224_update(&ctx->ctx_outside, digest_inside, SHA224_DIGEST_SIZE); - sha224_final(&ctx->ctx_outside, mac_temp); - memcpy(mac, mac_temp, mac_size); -} - -void hmac_sha224(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size) -{ - hmac_sha224_ctx ctx; - - hmac_sha224_init(&ctx, key, key_size); - hmac_sha224_update(&ctx, message, message_len); - hmac_sha224_final(&ctx, mac, mac_size); -} - -/* HMAC-SHA-256 functions */ - -void hmac_sha256_init(hmac_sha256_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size) -{ - c_uint32_t fill; - c_uint32_t num; - - c_uint8_t *key_used; - c_uint8_t key_temp[SHA256_DIGEST_SIZE]; - int i; - - if (key_size == SHA256_BLOCK_SIZE) { - key_used = key; - num = SHA256_BLOCK_SIZE; - } else { - if (key_size > SHA256_BLOCK_SIZE){ - key_used = key_temp; - num = SHA256_DIGEST_SIZE; - sha256(key, key_size, key_used); - } else { /* key_size > SHA256_BLOCK_SIZE */ - key_used = key; - num = key_size; - } - fill = SHA256_BLOCK_SIZE - num; - - memset(ctx->block_ipad + num, 0x36, fill); - memset(ctx->block_opad + num, 0x5c, fill); - } - - for (i = 0; i < num; i++) { - ctx->block_ipad[i] = key_used[i] ^ 0x36; - ctx->block_opad[i] = key_used[i] ^ 0x5c; - } - - sha256_init(&ctx->ctx_inside); - sha256_update(&ctx->ctx_inside, ctx->block_ipad, SHA256_BLOCK_SIZE); - - sha256_init(&ctx->ctx_outside); - sha256_update(&ctx->ctx_outside, ctx->block_opad, - SHA256_BLOCK_SIZE); - - /* for hmac_reinit */ - memcpy(&ctx->ctx_inside_reinit, &ctx->ctx_inside, - sizeof(sha256_ctx)); - memcpy(&ctx->ctx_outside_reinit, &ctx->ctx_outside, - sizeof(sha256_ctx)); -} - -void hmac_sha256_reinit(hmac_sha256_ctx *ctx) -{ - memcpy(&ctx->ctx_inside, &ctx->ctx_inside_reinit, - sizeof(sha256_ctx)); - memcpy(&ctx->ctx_outside, &ctx->ctx_outside_reinit, - sizeof(sha256_ctx)); -} - -void hmac_sha256_update(hmac_sha256_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len) -{ - sha256_update(&ctx->ctx_inside, message, message_len); -} - -void hmac_sha256_final(hmac_sha256_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size) -{ - c_uint8_t digest_inside[SHA256_DIGEST_SIZE]; - c_uint8_t mac_temp[SHA256_DIGEST_SIZE]; - - sha256_final(&ctx->ctx_inside, digest_inside); - sha256_update(&ctx->ctx_outside, digest_inside, SHA256_DIGEST_SIZE); - sha256_final(&ctx->ctx_outside, mac_temp); - memcpy(mac, mac_temp, mac_size); -} - -void hmac_sha256(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size) -{ - hmac_sha256_ctx ctx; - - hmac_sha256_init(&ctx, key, key_size); - hmac_sha256_update(&ctx, message, message_len); - hmac_sha256_final(&ctx, mac, mac_size); -} - -/* HMAC-SHA-384 functions */ - -void hmac_sha384_init(hmac_sha384_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size) -{ - c_uint32_t fill; - c_uint32_t num; - - c_uint8_t *key_used; - c_uint8_t key_temp[SHA384_DIGEST_SIZE]; - int i; - - if (key_size == SHA384_BLOCK_SIZE) { - key_used = key; - num = SHA384_BLOCK_SIZE; - } else { - if (key_size > SHA384_BLOCK_SIZE){ - key_used = key_temp; - num = SHA384_DIGEST_SIZE; - sha384(key, key_size, key_used); - } else { /* key_size > SHA384_BLOCK_SIZE */ - key_used = key; - num = key_size; - } - fill = SHA384_BLOCK_SIZE - num; - - memset(ctx->block_ipad + num, 0x36, fill); - memset(ctx->block_opad + num, 0x5c, fill); - } - - for (i = 0; i < num; i++) { - ctx->block_ipad[i] = key_used[i] ^ 0x36; - ctx->block_opad[i] = key_used[i] ^ 0x5c; - } - - sha384_init(&ctx->ctx_inside); - sha384_update(&ctx->ctx_inside, ctx->block_ipad, SHA384_BLOCK_SIZE); - - sha384_init(&ctx->ctx_outside); - sha384_update(&ctx->ctx_outside, ctx->block_opad, - SHA384_BLOCK_SIZE); - - /* for hmac_reinit */ - memcpy(&ctx->ctx_inside_reinit, &ctx->ctx_inside, - sizeof(sha384_ctx)); - memcpy(&ctx->ctx_outside_reinit, &ctx->ctx_outside, - sizeof(sha384_ctx)); -} - -void hmac_sha384_reinit(hmac_sha384_ctx *ctx) -{ - memcpy(&ctx->ctx_inside, &ctx->ctx_inside_reinit, - sizeof(sha384_ctx)); - memcpy(&ctx->ctx_outside, &ctx->ctx_outside_reinit, - sizeof(sha384_ctx)); -} - -void hmac_sha384_update(hmac_sha384_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len) -{ - sha384_update(&ctx->ctx_inside, message, message_len); -} - -void hmac_sha384_final(hmac_sha384_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size) -{ - c_uint8_t digest_inside[SHA384_DIGEST_SIZE]; - c_uint8_t mac_temp[SHA384_DIGEST_SIZE]; - - sha384_final(&ctx->ctx_inside, digest_inside); - sha384_update(&ctx->ctx_outside, digest_inside, SHA384_DIGEST_SIZE); - sha384_final(&ctx->ctx_outside, mac_temp); - memcpy(mac, mac_temp, mac_size); -} - -void hmac_sha384(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size) -{ - hmac_sha384_ctx ctx; - - hmac_sha384_init(&ctx, key, key_size); - hmac_sha384_update(&ctx, message, message_len); - hmac_sha384_final(&ctx, mac, mac_size); -} - -/* HMAC-SHA-512 functions */ - -void hmac_sha512_init(hmac_sha512_ctx *ctx, c_uint8_t *key, - c_uint32_t key_size) -{ - c_uint32_t fill; - c_uint32_t num; - - c_uint8_t *key_used; - c_uint8_t key_temp[SHA512_DIGEST_SIZE]; - int i; - - if (key_size == SHA512_BLOCK_SIZE) { - key_used = key; - num = SHA512_BLOCK_SIZE; - } else { - if (key_size > SHA512_BLOCK_SIZE){ - key_used = key_temp; - num = SHA512_DIGEST_SIZE; - sha512(key, key_size, key_used); - } else { /* key_size > SHA512_BLOCK_SIZE */ - key_used = key; - num = key_size; - } - fill = SHA512_BLOCK_SIZE - num; - - memset(ctx->block_ipad + num, 0x36, fill); - memset(ctx->block_opad + num, 0x5c, fill); - } - - for (i = 0; i < num; i++) { - ctx->block_ipad[i] = key_used[i] ^ 0x36; - ctx->block_opad[i] = key_used[i] ^ 0x5c; - } - - sha512_init(&ctx->ctx_inside); - sha512_update(&ctx->ctx_inside, ctx->block_ipad, SHA512_BLOCK_SIZE); - - sha512_init(&ctx->ctx_outside); - sha512_update(&ctx->ctx_outside, ctx->block_opad, - SHA512_BLOCK_SIZE); - - /* for hmac_reinit */ - memcpy(&ctx->ctx_inside_reinit, &ctx->ctx_inside, - sizeof(sha512_ctx)); - memcpy(&ctx->ctx_outside_reinit, &ctx->ctx_outside, - sizeof(sha512_ctx)); -} - -void hmac_sha512_reinit(hmac_sha512_ctx *ctx) -{ - memcpy(&ctx->ctx_inside, &ctx->ctx_inside_reinit, - sizeof(sha512_ctx)); - memcpy(&ctx->ctx_outside, &ctx->ctx_outside_reinit, - sizeof(sha512_ctx)); -} - -void hmac_sha512_update(hmac_sha512_ctx *ctx, c_uint8_t *message, - c_uint32_t message_len) -{ - sha512_update(&ctx->ctx_inside, message, message_len); -} - -void hmac_sha512_final(hmac_sha512_ctx *ctx, c_uint8_t *mac, - c_uint32_t mac_size) -{ - c_uint8_t digest_inside[SHA512_DIGEST_SIZE]; - c_uint8_t mac_temp[SHA512_DIGEST_SIZE]; - - sha512_final(&ctx->ctx_inside, digest_inside); - sha512_update(&ctx->ctx_outside, digest_inside, SHA512_DIGEST_SIZE); - sha512_final(&ctx->ctx_outside, mac_temp); - memcpy(mac, mac_temp, mac_size); -} - -void hmac_sha512(c_uint8_t *key, c_uint32_t key_size, - c_uint8_t *message, c_uint32_t message_len, - c_uint8_t *mac, c_uint32_t mac_size) -{ - hmac_sha512_ctx ctx; - - hmac_sha512_init(&ctx, key, key_size); - hmac_sha512_update(&ctx, message, message_len); - hmac_sha512_final(&ctx, mac, mac_size); -} diff --git a/lib/core/src/timer.c b/lib/core/src/timer.c deleted file mode 100644 index 2f3b90b3c..000000000 --- a/lib/core/src/timer.c +++ /dev/null @@ -1,283 +0,0 @@ -#define TRACE_MODULE _timer -#include "core_debug.h" -#include "core_timer.h" -#include "core_time.h" -#include "core_param.h" -#include "core_pool.h" - -typedef struct _tm_block_t { - lnode_t node; - - tm_service_t *tm_s; - c_uint32_t expire_time; - - expire_func_t expire_func; - c_uintptr_t param1; - c_uintptr_t param2; - c_uintptr_t param3; - c_uintptr_t param4; - c_uintptr_t param5; - c_uintptr_t param6; - - tm_type_e type; - c_uint8_t running; - c_uint32_t duration; -} tm_block_t; - -pool_declare(timer_pool, tm_block_t, MAX_NUM_OF_TIMER); - -static int _tm_cmp_func(lnode_t *pnode1, lnode_t *pnode2); -static tm_block_t *_tm_get(void); -static void _tm_free(tm_block_t *tm); - -#define _tm_add(__l, __tm) \ - list_insert_sorted(__l, __tm, _tm_cmp_func) - -#define _tm_remove(__l, __tm) \ - list_remove(__l, __tm) - -status_t tm_init(void) -{ - pool_init(&timer_pool, MAX_NUM_OF_TIMER); - return CORE_OK; -} - -status_t tm_final(void) -{ - if (pool_size(&timer_pool) != pool_avail(&timer_pool)) - d_error("%d not freed in timer_pool[%d]", - pool_size(&timer_pool) - pool_avail(&timer_pool), - pool_size(&timer_pool)); - d_trace(9, "%d not freed in timer_pool[%d]\n", - pool_size(&timer_pool) - pool_avail(&timer_pool), - pool_size(&timer_pool)); - pool_final(&timer_pool); - return CORE_OK; -} - -c_uint32_t tm_pool_avail(void) -{ - return pool_avail(&timer_pool); -} - -void tm_service_init(tm_service_t *tm_service) -{ - memset(tm_service, 0x00, sizeof(tm_service_t)); - list_init(&tm_service->active_list); - list_init(&tm_service->idle_list); - return; -} - -status_t tm_execute_tm_service(tm_service_t *p_tm_s, c_uintptr_t data) -{ - c_uint32_t cur_time; - tm_block_t *tm; - - cur_time = time_as_msec(time_now()); - tm = list_first(&(p_tm_s->active_list)); - - while(tm) - { - if(tm->expire_time < cur_time) - { - /* execute expiry function */ - tm->expire_func(data, tm->param1, tm->param2, tm->param3, - tm->param4, tm->param5, tm->param6); - - /* remove this tm_block from the active list */ - _tm_remove(&(p_tm_s->active_list), tm); - - if(tm->type == TIMER_TYPE_PERIODIC) - { - tm->expire_time = cur_time + tm->duration; - - /* add this tm_block to the active list */ - _tm_add(&(p_tm_s->active_list), tm); - } - else - { - /* add this tm_block to the idle list */ - _tm_add(&(p_tm_s->idle_list), tm); - tm->running = 0; - } - - tm = list_first(&(p_tm_s->active_list)); - } - else - { - break; - } - } - return CORE_OK; -} - -static int _tm_cmp_func(lnode_t *pnode1, lnode_t *pnode2) -{ - tm_block_t *tm1 = (tm_block_t*)pnode1; - tm_block_t *tm2 = (tm_block_t*)pnode2; - - if(tm1->expire_time < tm2->expire_time) - return -1; - else - return 1; -} - -static tm_block_t *_tm_get(void) -{ - tm_block_t *tm_b = NULL; - - /* get timer node from node pool */ - pool_alloc_node(&timer_pool, &tm_b); - - /* check for error */ - d_assert(tm_b != NULL, return NULL, "fail to get timer pool\n"); - - /* intialize timer node */ - memset((char*)tm_b, 0x00, sizeof(tm_block_t)); - return tm_b; - -} - -static void _tm_free(tm_block_t *tm) -{ - /* free tlv node to the node pool */ - pool_free_node(&timer_pool, tm); - return; - -} - -tm_block_id tm_create(tm_service_t *tm_service, - tm_type_e type, c_uint32_t duration, expire_func_t expire_func) -{ - tm_block_t *tm = NULL; - tm = _tm_get(); - - d_assert(tm, return 0, "tm_create failed\n"); - tm->tm_s = tm_service; - - _tm_add(&(tm->tm_s->idle_list), tm); - - tm->type = type; - tm->duration = duration; - tm->expire_func = expire_func; - - return (tm_block_id)tm; -} - -void tm_delete(tm_block_id id) -{ - tm_block_t *tm = (tm_block_t *)id; - - /* If running timer, pop it from active list */ - if (tm->running == 1) - _tm_remove(&(tm->tm_s->active_list), tm); - /* If not running timer, pop it from idle list */ - else - _tm_remove(&(tm->tm_s->idle_list), tm); - - _tm_free(tm); - - return; -} - -status_t tm_set_duration(tm_block_id id, c_uint32_t duration) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->duration = duration; - - return CORE_OK; -} - -status_t tm_set_param1(tm_block_id id, c_uintptr_t param) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->param1 = param; - - return CORE_OK; -} - -status_t tm_set_param2(tm_block_id id, c_uintptr_t param) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->param2 = param; - - return CORE_OK; -} - -status_t tm_set_param3(tm_block_id id, c_uintptr_t param) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->param3 = param; - - return CORE_OK; -} - -status_t tm_set_param4(tm_block_id id, c_uintptr_t param) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->param4 = param; - - return CORE_OK; -} - -status_t tm_set_param5(tm_block_id id, c_uintptr_t param) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->param5 = param; - - return CORE_OK; -} - -status_t tm_set_param6(tm_block_id id, c_uintptr_t param) -{ - tm_block_t *tm = (tm_block_t *)id; - - tm->param6 = param; - - return CORE_OK; -} - -status_t tm_start(tm_block_id id) -{ - c_uint32_t cur_time = time_as_msec(time_now()); - tm_block_t *tm = (tm_block_t *)id; - - /* If already running timer, pop it from active list for put again */ - if (tm->running == 1) - _tm_remove(&(tm->tm_s->active_list), tm); - /* If not running, tm is in idle list. pop it */ - else - _tm_remove(&(tm->tm_s->idle_list), tm); - - /* Calculate expiration */ - tm->expire_time = cur_time + tm->duration; - - /* Push tm to active list */ - _tm_add(&(tm->tm_s->active_list), tm); - - tm->running = 1; - - return CORE_OK; -} - -status_t tm_stop(tm_block_id id) -{ - tm_block_t *tm = (tm_block_t *)id; - - /* If already stopped timer, no operations needed */ - if (tm->running == 0) - return CORE_OK; - - _tm_remove(&(tm->tm_s->active_list), tm); - _tm_add(&(tm->tm_s->idle_list), tm); - - tm->running = 0; - - return CORE_OK; -} diff --git a/lib/core/src/tlv.c b/lib/core/src/tlv.c deleted file mode 100644 index e517ce8cf..000000000 --- a/lib/core/src/tlv.c +++ /dev/null @@ -1,494 +0,0 @@ -#define TRACE_MODULE _tlv -#include "core_debug.h" -#include "core_tlv.h" -#include "core_lib.h" - -pool_declare(tlv_pool, tlv_t, NUM_OF_TLV_NODE); - -/* tlv_t common functions */ -tlv_t* tlv_get(void) -{ - tlv_t *tlv = NULL; - - /* get tlv node from node pool */ - pool_alloc_node(&tlv_pool, &tlv); - - /* check for error */ - d_assert(tlv != NULL, return NULL, "fail to get tlv pool\n"); - - /* intialize tlv node */ - memset((char*)tlv, 0x00, sizeof(tlv_t)); - return tlv; -} - -void tlv_free(tlv_t *p_tlv) -{ - /* free tlv node to the node pool */ - pool_free_node(&tlv_pool, p_tlv); - return; -} - -status_t tlv_init(void) -{ - pool_init(&tlv_pool, NUM_OF_TLV_NODE); - return CORE_OK; -} - -status_t tlv_final(void) -{ - pool_final(&tlv_pool); - return CORE_OK; -} - -c_uint32_t tlv_pool_avail(void) -{ - return pool_avail(&tlv_pool); -} - -void tlv_free_all(tlv_t *root_tlv) -{ - /* free all tlv node to the node pool */ - tlv_t *p_tlv = root_tlv; - tlv_t *next = NULL; - while(p_tlv) - { - if(p_tlv->embedded != NULL) - { - tlv_free_all(p_tlv->embedded); - } - next = p_tlv->next; - tlv_free(p_tlv); - p_tlv = next; - } - return; -} - -c_uint8_t tlv_value_8(tlv_t *tlv) -{ - return (*((c_uint8_t*)(tlv->value))); -} - -c_uint16_t tlv_value_16(tlv_t *tlv) -{ - c_uint16_t c_16; - c_uint8_t *v = tlv->value; - - c_16 = ((v[0] << 8) & 0xff00) | - ((v[1] ) & 0x00ff); - - return c_16; -} - -c_uint32_t tlv_value_32(tlv_t *tlv) -{ - c_uint32_t c_32; - c_uint8_t *v = tlv->value; - - c_32 = ((v[0] << 24) & 0xff000000) | - ((v[1] << 16) & 0x00ff0000) | - ((v[2] << 8) & 0x0000ff00) | - ((v[3] ) & 0x000000ff); - - return c_32; -} - -c_uint32_t tlv_calc_length(tlv_t *p_tlv, c_uint8_t mode) -{ - tlv_t *tmp_tlv = p_tlv; - c_uint32_t length = 0; - - while(tmp_tlv) - { - /* this is length for type field */ - switch(mode) - { - case TLV_MODE_T1_L1: - length += 2; - break; - case TLV_MODE_T1_L2: - length += 3; - break; - case TLV_MODE_T1_L2_I1: - case TLV_MODE_T2_L2: - length += 4; - break; - default: - d_assert(0, return 0, "Invalid mode(%d)", mode); - break; - } - - /* this is length for type field */ - if(tmp_tlv->embedded != NULL) - { - tmp_tlv->length = tlv_calc_length(tmp_tlv->embedded, mode); - } - - /* this is length for value field */ - length += tmp_tlv->length; - - tmp_tlv = tmp_tlv->next; - } - return length; -} - -c_uint32_t tlv_calc_count(tlv_t *p_tlv) -{ - tlv_t *tmp_tlv = p_tlv; - c_uint32_t count = 0; - - while(tmp_tlv) - { - if(tmp_tlv->embedded != NULL) - { - count += tlv_calc_count(tmp_tlv->embedded); - } - else - { - count++; - } - tmp_tlv = tmp_tlv->next; - } - return count; -} - -c_uint8_t *_tlv_put_type(c_uint32_t type, c_uint8_t *pos, c_uint8_t mode) -{ - switch(mode) - { - case TLV_MODE_T1_L1: - case TLV_MODE_T1_L2: - case TLV_MODE_T1_L2_I1: - *(pos++) = type & 0xFF; - break; - case TLV_MODE_T2_L2: - *(pos++) = (type >> 8) & 0xFF; - *(pos++) = type & 0xFF; - break; - default: - d_assert(0, return 0, "Invalid mode(%d)", mode); - break; - } - return pos; -} - -c_uint8_t *_tlv_put_length(c_uint32_t length, c_uint8_t *pos, c_uint8_t mode) -{ - switch(mode) - { - case TLV_MODE_T1_L1: - *(pos++) = length & 0xFF; - break; - case TLV_MODE_T1_L2: - case TLV_MODE_T1_L2_I1: - case TLV_MODE_T2_L2: - *(pos++) = (length >> 8) & 0xFF; - *(pos++) = length & 0xFF; - break; - default: - d_assert(0, return 0, "Invalid mode(%d)", mode); - break; - } - - return pos; -} - -c_uint8_t *_tlv_put_instance(c_uint8_t instance, c_uint8_t *pos, c_uint8_t mode) -{ - switch(mode) - { - case TLV_MODE_T1_L2_I1: - *(pos++) = instance & 0xFF; - break; - default: - break; - } - - return pos; -} - -c_uint8_t *_tlv_get_element(tlv_t *p_tlv, c_uint8_t *tlvBlock, c_uint8_t mode) -{ - c_uint8_t *pos = tlvBlock; - - switch(mode) - { - case TLV_MODE_T1_L1: - p_tlv->type = *(pos++); - p_tlv->length = *(pos++); - break; - case TLV_MODE_T1_L2: - p_tlv->type = *(pos++); - p_tlv->length = *(pos++) << 8; - p_tlv->length += *(pos++); - break; - case TLV_MODE_T1_L2_I1: - p_tlv->type = *(pos++); - p_tlv->length = *(pos++) << 8; - p_tlv->length += *(pos++); - p_tlv->instance = *(pos++); - break; - case TLV_MODE_T2_L2: - p_tlv->type = *(pos++) << 8; - p_tlv->type += *(pos++); - p_tlv->length = *(pos++) << 8; - p_tlv->length += *(pos++); - break; - default: - d_assert(0, return 0, "Invalid mode(%d)", mode); - break; - } - - p_tlv->value = pos; - - return (pos + tlv_length(p_tlv)); -} - -void _tlv_alloc_buff_to_tlv( - tlv_t* head_tlv, c_uint8_t* buff, c_uint32_t buff_len) -{ - head_tlv->buff_allocated = TRUE; - head_tlv->buff_len = buff_len; - head_tlv->buff_ptr = buff; - head_tlv->buff = buff; -} - -tlv_t *tlv_find_root(tlv_t* p_tlv) -{ - tlv_t *head_tlv = p_tlv->head; - tlv_t *parentTlv; - - parentTlv = head_tlv->parent; - while(parentTlv) - { - head_tlv = parentTlv->head; - parentTlv = head_tlv->parent; - } - - return head_tlv; -} - -tlv_t *tlv_add(tlv_t *head_tlv, - c_uint32_t type, c_uint32_t length, c_uint8_t instance, c_uint8_t *value) -{ - tlv_t* curr_tlv = head_tlv; - tlv_t* new_tlv = NULL; - - new_tlv = tlv_get(); - d_assert(new_tlv, return NULL, "can't get tlv node\n"); - if(length != 0) - { - d_assert(value, return NULL, "tlv value is NULL\n"); - } - - new_tlv->type = type; - new_tlv->length = length; - new_tlv->instance = instance; - new_tlv->value = value; - - if(head_tlv != NULL && head_tlv->buff_allocated == TRUE) - { - d_assert((head_tlv->buff_ptr - head_tlv->buff + length)< - head_tlv->buff_len, tlv_free(new_tlv); return NULL, - "overflow in tlv buffer\n"); - - memcpy(head_tlv->buff_ptr, value, length); - new_tlv->value = head_tlv->buff_ptr; - head_tlv->buff_ptr += length; - } - - if(curr_tlv == NULL) - { - new_tlv->head = new_tlv; - new_tlv->tail = new_tlv; - } - else - { - head_tlv = head_tlv->head; /* in case head_tlv is not head */ - new_tlv->head = head_tlv; - head_tlv->tail->next = new_tlv; - head_tlv->tail = new_tlv; - } - return new_tlv; -} - -tlv_t *tlv_copy(c_uint8_t *buff, c_uint32_t buff_len, - c_uint32_t type, c_uint32_t length, c_uint8_t instance, c_uint8_t *value) -{ - tlv_t* new_tlv = NULL; - - new_tlv = tlv_get(); - d_assert(new_tlv, return NULL, "can't get tlv node\n"); - - new_tlv->type = type; - new_tlv->length = length; - new_tlv->instance = instance; - new_tlv->value = value; - new_tlv->head = new_tlv->tail = new_tlv; - - _tlv_alloc_buff_to_tlv(new_tlv, buff, buff_len); - - memcpy(new_tlv->buff_ptr, value, length); - new_tlv->value = new_tlv->buff_ptr; - new_tlv->buff_ptr += length; - - return new_tlv; -} - -tlv_t *tlv_embed(tlv_t *parent_tlv, - c_uint32_t type, c_uint32_t length, c_uint8_t instance, c_uint8_t *value) -{ - tlv_t* new_tlv = NULL, *root_tlv = NULL; - - d_assert(parent_tlv, return NULL, "parent tlv is NULL\n"); - - new_tlv = tlv_get(); - d_assert(new_tlv, return NULL, "can't get tlv node\n"); - - new_tlv->type = type; - new_tlv->length = length; - new_tlv->instance = instance; - new_tlv->value = value; - - root_tlv = tlv_find_root(parent_tlv); - - if(root_tlv->buff_allocated == TRUE) - { - d_assert((root_tlv->buff_ptr - root_tlv->buff + length)buff_len, - tlv_free(new_tlv); return NULL, "overflow in tlv buffer\n"); - - memcpy(root_tlv->buff_ptr, value, length); - new_tlv->value = root_tlv->buff_ptr; - root_tlv->buff_ptr += length; - } - - if(parent_tlv->embedded == NULL) - { - parent_tlv->embedded = new_tlv->head = new_tlv->tail = new_tlv; - new_tlv->parent = parent_tlv; - } - else - { - new_tlv->head = parent_tlv->embedded; - parent_tlv->embedded->tail->next = new_tlv; - parent_tlv->embedded->tail = new_tlv; - } - - return new_tlv; -} - -c_uint32_t tlv_render(tlv_t *root_tlv, - c_uint8_t *blk, c_uint32_t length, c_uint8_t mode) -{ - tlv_t* curr_tlv = root_tlv; - c_uint8_t* pos = blk; - c_uint32_t embedded_len = 0; - - while(curr_tlv) - { - pos = _tlv_put_type(curr_tlv->type, pos, mode); - - if(curr_tlv->embedded == NULL) - { - pos = _tlv_put_length(curr_tlv->length, pos, mode); - pos = _tlv_put_instance(curr_tlv->instance, pos, mode); - - if((pos - blk) + tlv_length(curr_tlv) > length) - { - d_assert(FALSE, ;, - "tlv_t encoding error:overflow for given buff length\n"); - memcpy((char*)pos, (char*)curr_tlv->value, length - (pos-blk)); - pos += length - (pos-blk); - - return (pos - blk); - } - - memcpy((char*)pos, (char*)curr_tlv->value, curr_tlv->length); - pos += curr_tlv->length; - } - else - { - embedded_len = tlv_calc_length(curr_tlv->embedded, mode); - pos = _tlv_put_length(embedded_len, pos, mode); - pos = _tlv_put_instance(curr_tlv->instance, pos, mode); - tlv_render(curr_tlv->embedded, - pos, length - (c_uint32_t)(pos-blk), mode); - pos += embedded_len; - } - curr_tlv = curr_tlv->next; - } - - return (pos - blk); -} - -/* tlv_t parsing functions */ -tlv_t *tlv_parse_block(c_uint32_t length, c_uint8_t *blk, c_uint8_t mode) -{ - c_uint8_t* pos = blk; - - tlv_t* root_tlv = NULL; - tlv_t* prev_tlv = NULL; - tlv_t* curr_tlv = NULL; - - root_tlv = curr_tlv = tlv_get(); - - d_assert(curr_tlv, return NULL, "can't get tlv node\n"); - - pos = _tlv_get_element(curr_tlv, pos, mode); - - d_assert(pos != NULL, tlv_free_all(root_tlv); return NULL, - "tlvGetElement Failed\n"); - - while(pos - blk < length) - { - prev_tlv = curr_tlv; - - curr_tlv = tlv_get(); - d_assert(curr_tlv, tlv_free_all(root_tlv); return NULL, - "can't get tlv node\n"); - prev_tlv->next = curr_tlv; - - pos = _tlv_get_element(curr_tlv, pos, mode); - d_assert(pos != NULL, tlv_free_all(root_tlv); return NULL, - "tlvGetElement Failed\n"); - } - - d_assert(length == (pos - blk), - tlv_free_all(root_tlv); return NULL, - "total size is not equal to sum of each tlv. %d %d", - length, pos - blk); - - return root_tlv; -} - -tlv_t *tlv_parse_embedded_block(tlv_t* p_tlv, c_uint8_t mode) -{ - p_tlv->embedded = tlv_parse_block(p_tlv->length, p_tlv->value, mode); - - return p_tlv->embedded; -} - -/* tlv operation-related function */ -tlv_t *tlv_find(tlv_t* p_tlv, c_uint32_t type) -{ - tlv_t *tmp_tlv = p_tlv, *embed_tlv = NULL; - while(tmp_tlv) - { - if(tmp_tlv->type == type) - { - return tmp_tlv; - } - - if(tmp_tlv->embedded != NULL) - { - embed_tlv = tlv_find(tmp_tlv->embedded, type); - if(embed_tlv != NULL) - { - return embed_tlv; - } - } - tmp_tlv = tmp_tlv->next; - } - - /* tlv for the designated type doesn't exist */ - return NULL; -} diff --git a/lib/core/src/tlv_msg.c b/lib/core/src/tlv_msg.c deleted file mode 100644 index 9f0e786a9..000000000 --- a/lib/core/src/tlv_msg.c +++ /dev/null @@ -1,594 +0,0 @@ -#define TRACE_MODULE _tlv_msg - -#include "core_debug.h" -#include "core_tlv_msg.h" - -tlv_desc_t tlv_desc_more1 = { TLV_MORE, "More", 0, 1, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more2 = { TLV_MORE, "More", 0, 2, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more3 = { TLV_MORE, "More", 0, 3, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more4 = { TLV_MORE, "More", 0, 4, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more5 = { TLV_MORE, "More", 0, 5, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more6 = { TLV_MORE, "More", 0, 6, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more7 = { TLV_MORE, "More", 0, 7, 0, 0, { NULL } }; -tlv_desc_t tlv_desc_more8 = { TLV_MORE, "More", 0, 8, 0, 0, { NULL } }; - -static tlv_t* _tlv_add_leaf( - tlv_t *parent_tlv, tlv_t *tlv, tlv_desc_t *desc, void *msg) -{ - switch (desc->ctype) - { - case TLV_UINT8: - case TLV_INT8: - { - tlv_uint8_t *v = (tlv_uint8_t *)msg; - - d_trace2(25, "V_1B:%02x", v->u8); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 1, desc->instance, (c_uint8_t*)&v->u8); - else - tlv = tlv_add(tlv, - desc->type, 1, desc->instance, (c_uint8_t*)&v->u8); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - case TLV_UINT16: - { - tlv_uint16_t *v = (tlv_uint16_t *)msg; - - d_trace2(25, "V_2B:%04x", v->u16); - - v->u16 = htons(v->u16); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 2, desc->instance, (c_uint8_t*)&v->u16); - else - tlv = tlv_add(tlv, - desc->type, 2, desc->instance, (c_uint8_t*)&v->u16); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - case TLV_UINT24: - case TLV_INT24: - { - tlv_uint24_t *v = (tlv_uint24_t *)msg; - - d_trace2(25, "V_3B:%06x", v->u24); - - v->u24 = v->u24 << 8; - v->u24 = htonl(v->u24); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 3, desc->instance, (c_uint8_t*)&v->u24); - else - tlv = tlv_add(tlv, - desc->type, 3, desc->instance, (c_uint8_t*)&v->u24); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - case TLV_UINT32: - case TLV_INT32: - { - tlv_uint32_t *v = (tlv_uint32_t *)msg; - - d_trace2(25, "V_4B:%08x", v->u32); - - v->u32 = htonl(v->u32); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 4, desc->instance, (c_uint8_t*)&v->u32); - else - tlv = tlv_add(tlv, - desc->type, 4, desc->instance, (c_uint8_t*)&v->u32); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - case TLV_FIXED_STR: - { - tlv_octet_t *v = (tlv_octet_t *)msg; - - d_trace2(25, "V_FSTR: ", v->data); - d_trace_hex(25, v->data, v->len); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, desc->length, desc->instance, v->data); - else - tlv = tlv_add(tlv, - desc->type, desc->length, desc->instance, v->data); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - case TLV_VAR_STR: - { - tlv_octet_t *v = (tlv_octet_t *)msg; - - d_assert(v->len > 0, return NULL, "Length is zero"); - - d_trace2(25, "V_VSTR: ", v->data); - d_trace_hex(25, v->data, v->len); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, v->len, desc->instance, v->data); - else - tlv = tlv_add(tlv, - desc->type, v->len, desc->instance, v->data); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - case TLV_NULL: - { - d_trace2(25, "V_NULL" ); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 0, desc->instance, NULL); - else - tlv = tlv_add(tlv, - desc->type, 0, desc->instance, NULL); - d_assert(tlv, return NULL, "Can't add TLV"); - break; - } - default: - { - d_assert(0, return NULL, "Unknown class %d", desc->ctype); - break; - } - } - - return tlv; -} - -static c_uint32_t _tlv_add_compound(tlv_t **root, tlv_t *parent_tlv, - tlv_desc_t *parent_desc, void *msg, int depth) -{ - tlv_presence_t *presence_p; - tlv_desc_t *desc = NULL, *next_desc = NULL; - tlv_t *tlv = NULL, *emb_tlv = NULL; - c_uint8_t *p = msg; - c_uint32_t offset = 0, count = 0; - int i, j, r; - char indent[17] = " "; /* 16 spaces */ - - d_assert(root, return 0, "Null param"); - d_assert(parent_desc, return 0, "Null param"); - d_assert(msg, return 0, "Null param"); - - d_assert(depth <= 8, return 0, "Too deep recursion"); - indent[depth*2] = 0; - - *root = NULL; - - for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL; - i++, desc = parent_desc->child_descs[i]) - { - next_desc = parent_desc->child_descs[i+1]; - if (next_desc != NULL && next_desc->ctype == TLV_MORE) - { - int offset2 = offset; - for (j = 0; j < next_desc->length; j++) - { - presence_p = (tlv_presence_t *)(p + offset2); - - if (*presence_p == 0) - break; - - if (desc->ctype == TLV_COMPOUND) - { - d_trace2(25, "\nBUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ", - indent, i, desc->name, desc->type, desc->instance, - desc->vsize, p + offset2); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 0, desc->instance, NULL); - else - tlv = tlv_add(tlv, desc->type, 0, desc->instance, NULL); - - r = _tlv_add_compound(&emb_tlv, tlv, desc, - p + offset2 + sizeof(tlv_presence_t), depth + 1); - d_assert(r > 0 && emb_tlv, return 0, - "Can't build compound TLV"); - count += 1 + r; - } - else - { - d_trace2(25, "\nBUILD %sL#%d [%s] T:%d L:%d I:%d " - "(cls:%d vsz:%d) off:%p ", - indent, i, desc->name, desc->type, desc->length, - desc->instance, desc->ctype, desc->vsize, - p + offset2); - - tlv = _tlv_add_leaf(parent_tlv, tlv, desc, p + offset2); - d_assert(tlv, return 0, "Can't build leaf TLV"); - count++; - } - - if (*root == NULL) - *root = tlv; - - offset2 += desc->vsize; - } - offset += desc->vsize * next_desc->length; - i++; - } - else - { - presence_p = (tlv_presence_t *)(p + offset); - - if (*presence_p) - { - if (desc->ctype == TLV_COMPOUND) - { - d_trace2(25, "\nBUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ", - indent, i, desc->name, desc->type, desc->instance, - desc->vsize, p + offset); - - if (parent_tlv) - tlv = tlv_embed(parent_tlv, - desc->type, 0, desc->instance, NULL); - else - tlv = tlv_add(tlv, desc->type, 0, desc->instance, NULL); - - r = _tlv_add_compound(&emb_tlv, tlv, desc, - p + offset + sizeof(tlv_presence_t), depth + 1); - d_assert(r > 0 && emb_tlv, return 0, - "Can't build compound TLV"); - count += 1 + r; - } - else - { - d_trace2(25, "\nBUILD %sL#%d [%s] T:%d L:%d I:%d " - "(cls:%d vsz:%d) off:%p ", - indent, i, desc->name, desc->type, desc->length, - desc->instance, desc->ctype, desc->vsize, - p + offset); - - tlv = _tlv_add_leaf(parent_tlv, tlv, desc, p + offset); - d_assert(tlv, return 0, "Can't build leaf TLV"); - count++; - } - - if (*root == NULL) - *root = tlv; - } - offset += desc->vsize; - } - } - - return count; -} - -status_t tlv_build_msg(pkbuf_t **pkbuf, tlv_desc_t *desc, void *msg, int mode) -{ - tlv_t *root = NULL; - c_uint32_t r, length, rendlen; - - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(desc, return CORE_ERROR, "Null param"); - d_assert(msg, return CORE_ERROR, "Null param"); - - d_assert(desc->ctype == TLV_MESSAGE, return CORE_ERROR, - "Not TLV message descriptor"); - d_assert(desc->child_descs[0], return CORE_ERROR, - "TLV message descriptor has no members"); - - d_trace2(25, "\n"); - d_trace2(25, "[GTP] Build %s\n", desc->name); - - r = _tlv_add_compound(&root, NULL, desc, msg, 0); - d_assert(r > 0 && root, tlv_free_all(root); return CORE_ERROR, - "Can't build TLV message"); - - length = tlv_calc_length(root, mode); - *pkbuf = pkbuf_alloc(TLV_MAX_HEADROOM, length); - d_assert(*pkbuf, tlv_free_all(root); return CORE_ENOMEM, - "pkbuf_alloc() failed"); - (*pkbuf)->len = length; - - rendlen = tlv_render(root, (*pkbuf)->payload, length, mode); - d_assert(rendlen == length, - pkbuf_free(*pkbuf); tlv_free_all(root); return CORE_ERROR, - "Error while render TLV (%d != %d)", length, rendlen); - - tlv_free_all(root); - - return CORE_OK; -} - -static tlv_desc_t* _tlv_find_desc(c_uint8_t *desc_index, - c_uint32_t *tlv_offset, tlv_desc_t *parent_desc, tlv_t *tlv) -{ - tlv_desc_t *prev_desc = NULL, *desc = NULL; - int i, offset = 0; - - d_assert(parent_desc, return NULL, "Null param"); - d_assert(tlv, return NULL, "Null param"); - - d_trace2(25, "_tlv_find_desc:T(%d), I(%d) - ", tlv->type, tlv->instance); - - for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL; - i++, desc = parent_desc->child_descs[i]) - { - d_trace2(25, "%d, ", desc->type); - - if (desc->type == tlv->type && desc->instance == tlv->instance) - { - *desc_index = i; - *tlv_offset = offset; - break; - } - - if (desc->ctype == TLV_MORE) - { - d_assert(prev_desc && prev_desc->ctype != TLV_MORE, - return NULL, "Invalid previous tlv_desc_t"); - offset += prev_desc->vsize * (desc->length - 1); - } - else - { - offset += desc->vsize; - } - - prev_desc = desc; - } - - d_trace2(25, "\n"); - - return desc; -} - -static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv) -{ - d_assert(msg, return CORE_ERROR, "Null param"); - d_assert(desc, return CORE_ERROR, "Null param"); - d_assert(tlv, return CORE_ERROR, "Null param"); - - switch (desc->ctype) - { - case TLV_UINT8: - case TLV_INT8: - { - tlv_uint8_t *v = (tlv_uint8_t *)msg; - - if (tlv->length != 1) - { - d_error("Invalid TLV length %d. It should be 1", tlv->length); - return CORE_ERROR; - } - v->u8 = *(c_uint8_t*)(tlv->value); - d_trace2(25, "V_1B:%02x", v->u8); - break; - } - case TLV_UINT16: - case TLV_INT16: - { - tlv_uint16_t *v = (tlv_uint16_t *)msg; - - if (tlv->length != 2) - { - d_error("Invalid TLV length %d. It should be 2", tlv->length); - return CORE_ERROR; - } - v->u16 = ((((c_uint8_t*)tlv->value)[0]<< 8)&0xff00) | - ((((c_uint8_t*)tlv->value)[1] )&0x00ff); - d_trace2(25, "V_2B:%02x", v->u16); - break; - } - case TLV_UINT24: - case TLV_INT24: - { - tlv_uint24_t *v = (tlv_uint24_t *)msg; - - if (tlv->length != 3) - { - d_error("Invalid TLV length %d. It should be 3", tlv->length); - return CORE_ERROR; - } - v->u24 = ((((c_uint8_t*)tlv->value)[0]<<16)&0x00ff0000) | - ((((c_uint8_t*)tlv->value)[1]<< 8)&0x0000ff00) | - ((((c_uint8_t*)tlv->value)[2] )&0x000000ff); - d_trace2(25, "V_3B:%06x", v->u24); - break; - } - case TLV_UINT32: - case TLV_INT32: - { - tlv_uint32_t *v = (tlv_uint32_t *)msg; - - if (tlv->length != 4) - { - d_error("Invalid TLV length %d. It should be 4", tlv->length); - return CORE_ERROR; - } - v->u32 = ((((c_uint8_t*)tlv->value)[0]<<24)&0xff000000) | - ((((c_uint8_t*)tlv->value)[1]<<16)&0x00ff0000) | - ((((c_uint8_t*)tlv->value)[2]<< 8)&0x0000ff00) | - ((((c_uint8_t*)tlv->value)[3] )&0x000000ff); - d_trace2(25, "V_4B:%08x", v->u32); - break; - } - case TLV_FIXED_STR: - { - tlv_octet_t *v = (tlv_octet_t *)msg; - - if (tlv->length != desc->length) - { - d_error("Invalid TLV length %d. It should be %d", - tlv->length, desc->length); - return CORE_ERROR; - } - - v->data = tlv->value; - v->len = tlv->length; - - d_trace2(25, "V_FSTR: ", v->data); - d_trace_hex(25, v->data, v->len); - break; - } - case TLV_VAR_STR: - { - tlv_octet_t *v = (tlv_octet_t *)msg; - - v->data = tlv->value; - v->len = tlv->length; - - d_trace2(25, "V_VSTR: ", v->data); - d_trace_hex(25, v->data, v->len); - break; - } - case TLV_NULL: - { - if (tlv->length != 0) - { - d_error("Invalid TLV length %d. It should be 0", tlv->length); - return CORE_ERROR; - } - break; - } - default: - d_assert(0, return CORE_ERROR, "Unknown TLV class"); - break; - } - - return CORE_OK; -} - -static status_t _tlv_parse_compound(void *msg, tlv_desc_t *parent_desc, - tlv_t *parent_tlv, int depth, int mode) -{ - status_t rv; - tlv_presence_t *presence_p = (tlv_presence_t *)msg; - tlv_desc_t *desc = NULL, *next_desc = NULL; - tlv_t *tlv = NULL, *emb_tlv = NULL; - c_uint8_t *p = msg; - c_uint32_t offset = 0; - c_uint8_t index = 0; - int i = 0, j; - char indent[17] = " "; /* 16 spaces */ - - d_assert(msg, return CORE_ERROR, "Null param"); - d_assert(parent_desc, return CORE_ERROR, "Null param"); - d_assert(parent_tlv, return CORE_ERROR, "Null param"); - - d_assert(depth <= 8, return 0, "Too deep recursion"); - indent[depth*2] = 0; - - tlv = parent_tlv; - while(tlv) - { - desc = _tlv_find_desc(&index, &offset, parent_desc, tlv); - if (desc == NULL) - { - d_error("Unexpected TLV type:%d", tlv->type); - return CORE_ERROR; - } - - presence_p = (tlv_presence_t *)(p + offset); - - /* Multiple of the same type TLV may be included */ - next_desc = parent_desc->child_descs[index+1]; - if (next_desc != NULL && next_desc->ctype == TLV_MORE) - { - for (j = 0; j < next_desc->length; j++) - { - presence_p = (tlv_presence_t *)(p + offset + desc->vsize * j); - if (*presence_p == 0) - { - offset += desc->vsize * j; - break; - } - } - if (j == next_desc->length) - { - d_fatal("Multiple of the same type TLV need more room"); - tlv = tlv->next; - continue; - } - } - - if (desc->ctype == TLV_COMPOUND) - { - emb_tlv = tlv_parse_embedded_block(tlv, mode); - if (emb_tlv == NULL) - { - d_error("Error while parse TLV"); - return CORE_ERROR; - } - - d_trace2(25, "\nPARSE %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ", - indent, i++, desc->name, desc->type, desc->instance, - desc->vsize, p + offset); - - offset += sizeof(tlv_presence_t); - - rv = _tlv_parse_compound( - p + offset, desc, emb_tlv, depth + 1, mode); - if (rv != CORE_OK) - { - d_error("Can't parse compound TLV"); - return CORE_ERROR; - } - - *presence_p = 1; - } - else - { - d_trace2(25, "\nPARSE %sL#%d [%s] T:%d L:%d I:%d " - "(cls:%d vsz:%d) off:%p ", - indent, i++, desc->name, desc->type, desc->length, - desc->instance, desc->ctype, desc->vsize, p + offset); - - rv = _tlv_parse_leaf(p + offset, desc, tlv); - if (rv != CORE_OK) - { - d_error("Can't parse leaf TLV"); - return CORE_ERROR; - } - - *presence_p = 1; - } - - tlv = tlv->next; - } - d_trace2(25, "\n"); - - return CORE_OK; -} - -status_t tlv_parse_msg(void *msg, tlv_desc_t *desc, pkbuf_t *pkbuf, int mode) -{ - status_t rv; - tlv_t *root; - - d_assert(msg, return CORE_ERROR, "Null param"); - d_assert(desc, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); - - d_assert(desc->ctype == TLV_MESSAGE, return CORE_ERROR, - "Not TLV message descriptor"); - d_assert(desc->child_descs[0], return CORE_ERROR, - "TLV message descriptor has no members"); - - d_trace2(25, "\n"); - d_trace2(25, "[GTP] Parse %s\n", desc->name); - - root = tlv_parse_block(pkbuf->len, pkbuf->payload, mode); - if (root == NULL) - { - d_error("Can't parse TLV message"); - return CORE_ERROR; - } - - rv = _tlv_parse_compound(msg, desc, root, 0, mode); - - tlv_free_all(root); - - return rv; -} - diff --git a/lib/core/src/unix/atomic.c b/lib/core/src/unix/atomic.c deleted file mode 100644 index e46f162ea..000000000 --- a/lib/core/src/unix/atomic.c +++ /dev/null @@ -1,238 +0,0 @@ -#define TRACE_MODULE _atomic - -#include "core_atomic.h" -#include "core_mutex.h" -#include "core_debug.h" - -#if HAVE_ATOMIC_BUILTINS == 1 - -status_t atomic_init() -{ - return CORE_OK; -} - -status_t atomic_final() -{ - return CORE_OK; -} - -c_uint32_t atomic_read32(volatile c_uint32_t *mem) -{ - return *mem; -} - -void atomic_set32(volatile c_uint32_t *mem, c_uint32_t val) -{ - *mem = val; -} - -c_uint32_t atomic_add32(volatile c_uint32_t *mem, c_uint32_t val) -{ - return __sync_fetch_and_add(mem, val); -} - -void atomic_sub32(volatile c_uint32_t *mem, c_uint32_t val) -{ - __sync_fetch_and_sub(mem, val); -} - -c_uint32_t atomic_inc32(volatile c_uint32_t *mem) -{ - return __sync_fetch_and_add(mem, 1); -} - -int atomic_dec32(volatile c_uint32_t *mem) -{ - return __sync_sub_and_fetch(mem, 1); -} - -c_uint32_t atomic_cas32(volatile c_uint32_t *mem, c_uint32_t with, - c_uint32_t cmp) -{ - return __sync_val_compare_and_swap(mem, cmp, with); -} - -c_uint32_t atomic_xchg32(volatile c_uint32_t *mem, c_uint32_t val) -{ - __sync_synchronize(); - - return __sync_lock_test_and_set(mem, val); -} - -void* atomic_casptr(void *volatile *mem, void *with, const void *cmp) -{ - return (void*) __sync_val_compare_and_swap(mem, (void *)cmp, with); -} - -void* atomic_xchgptr(void *volatile *mem, void *with) -{ - __sync_synchronize(); - - return (void*) __sync_lock_test_and_set(mem, with); -} - -#else - -#define DECLARE_MUTEX_LOCKED(name, mem) \ - mutex_id name = mutex_hash(mem) -#define MUTEX_UNLOCK(name) \ - d_assert(mutex_unlock(name) == CORE_OK,,); - -#define NUM_ATOMIC_HASH 7 -static mutex_id hash_mutex[NUM_ATOMIC_HASH]; - -/* shift by 2 to get rid of alignment issues */ -#define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH) - -status_t atomic_init() -{ - int i; - status_t rv; - - for (i = 0; i < NUM_ATOMIC_HASH; i++) - { - rv = mutex_create(&hash_mutex[i], MUTEX_DEFAULT); - if (rv != CORE_OK) - { - return rv; - } - } - - return CORE_OK; -} - -status_t atomic_final() -{ - status_t rv; - int i; - - for (i = 0; i < NUM_ATOMIC_HASH; i++) - { - rv = mutex_delete(hash_mutex[i]); - if (rv != CORE_OK) - { - return rv; - } - } - - return CORE_OK; -} - -static CORE_INLINE mutex_id mutex_hash(volatile c_uint32_t *mem) -{ - mutex_id id = hash_mutex[ATOMIC_HASH(mem)]; - - d_assert(mutex_lock(id) == CORE_OK, return (mutex_id)NULL,); - - return id; -} - -c_uint32_t atomic_read32(volatile c_uint32_t *mem) -{ - return *mem; -} - -void atomic_set32(volatile c_uint32_t *mem, c_uint32_t val) -{ - DECLARE_MUTEX_LOCKED(mutex, mem); - - *mem = val; - - MUTEX_UNLOCK(mutex); -} - -c_uint32_t atomic_add32(volatile c_uint32_t *mem, c_uint32_t val) -{ - c_uint32_t old_value; - DECLARE_MUTEX_LOCKED(mutex, mem); - - old_value = *mem; - *mem += val; - - MUTEX_UNLOCK(mutex); - - return old_value; -} - -void atomic_sub32(volatile c_uint32_t *mem, c_uint32_t val) -{ - DECLARE_MUTEX_LOCKED(mutex, mem); - *mem -= val; - MUTEX_UNLOCK(mutex); -} - -c_uint32_t atomic_inc32(volatile c_uint32_t *mem) -{ - return atomic_add32(mem, 1); -} - -int atomic_dec32(volatile c_uint32_t *mem) -{ - c_uint32_t new; - DECLARE_MUTEX_LOCKED(mutex, mem); - - (*mem)--; - new = *mem; - - MUTEX_UNLOCK(mutex); - - return new; -} - -c_uint32_t atomic_cas32(volatile c_uint32_t *mem, c_uint32_t with, - c_uint32_t cmp) -{ - c_uint32_t prev; - DECLARE_MUTEX_LOCKED(mutex, mem); - - prev = *mem; - if (prev == cmp) { - *mem = with; - } - - MUTEX_UNLOCK(mutex); - - return prev; -} - -c_uint32_t atomic_xchg32(volatile c_uint32_t *mem, c_uint32_t val) -{ - c_uint32_t prev; - DECLARE_MUTEX_LOCKED(mutex, mem); - - prev = *mem; - *mem = val; - - MUTEX_UNLOCK(mutex); - - return prev; -} - -void* atomic_casptr(void *volatile *mem, void *with, const void *cmp) -{ - void *prev; - DECLARE_MUTEX_LOCKED(mutex, *mem); - - prev = *(void **)mem; - if (prev == cmp) { - *mem = with; - } - - MUTEX_UNLOCK(mutex); - - return prev; -} - -void* atomic_xchgptr(void *volatile *mem, void *with) -{ - void *prev; - DECLARE_MUTEX_LOCKED(mutex, *mem); - - prev = *(void **)mem; - *mem = with; - - MUTEX_UNLOCK(mutex); - - return prev; -} -#endif diff --git a/lib/core/src/unix/cond.c b/lib/core/src/unix/cond.c deleted file mode 100644 index be0f110cf..000000000 --- a/lib/core/src/unix/cond.c +++ /dev/null @@ -1,103 +0,0 @@ -#include "core.h" -#include "core_cond.h" -#include "core_arch_mutex.h" -#include "core_pool.h" -#include "core_param.h" -#include "core_general.h" -#include "core_debug.h" - -typedef struct _cond_t { - pthread_cond_t cond; -} cond_t; - -pool_declare(cond_pool, cond_t, MAX_NUM_OF_COND); - -status_t cond_init(void) -{ - pool_init(&cond_pool, MAX_NUM_OF_COND); - return CORE_OK; -} - -status_t cond_final(void) -{ - pool_final(&cond_pool); - return CORE_OK; -} - -status_t cond_create(cond_id *id) -{ - cond_t *new_cond = NULL; - status_t rv; - - pool_alloc_node(&cond_pool, &new_cond); - d_assert(new_cond, return CORE_ENOMEM, "cond_pool(%d) is not enough\n", - MAX_NUM_OF_COND); - - if ((rv = pthread_cond_init(&new_cond->cond, NULL))) - { - return rv; - } - - *id = (cond_id)new_cond; - return CORE_OK; -} - -status_t cond_wait(cond_id id, mutex_id mid) -{ - status_t rv; - cond_t *cond = (cond_t *)id; - mutex_t *mutex = (mutex_t *)mid; - - rv = pthread_cond_wait(&cond->cond, &mutex->mutex); - return rv; -} - -status_t cond_timedwait(cond_id id, - mutex_id mid, c_time_t timeout) -{ - status_t rv; - c_time_t then; - struct timespec abstime; - cond_t *cond = (cond_t *)id; - mutex_t *mutex = (mutex_t *)mid; - - then = time_now() + timeout; - abstime.tv_sec = time_sec(then); - abstime.tv_nsec = time_usec(then) * 1000; /* nanoseconds */ - - rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime); - if (ETIMEDOUT == rv) - { - return CORE_TIMEUP; - } - return rv; -} - - -status_t cond_signal(cond_id id) -{ - status_t rv; - cond_t *cond = (cond_t *)id; - - rv = pthread_cond_signal(&cond->cond); - return rv; -} - -status_t cond_broadcast(cond_id id) -{ - status_t rv; - cond_t *cond = (cond_t *)id; - - rv = pthread_cond_broadcast(&cond->cond); - return rv; -} - -status_t cond_delete(cond_id id) -{ - status_t rv; - cond_t *cond = (cond_t *)id; - - rv = pthread_cond_destroy(&cond->cond); - pool_free_node(&cond_pool, cond); - return rv; -} diff --git a/lib/core/src/unix/errorcodes.c b/lib/core/src/unix/errorcodes.c deleted file mode 100644 index d702a73c2..000000000 --- a/lib/core/src/unix/errorcodes.c +++ /dev/null @@ -1,421 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core.h" -#include "core_lib.h" - -#include "core_arch_network.h" - -static char *stuffbuffer(char *buf, size_t bufsize, const char *s) -{ - strncpy(buf,s,bufsize); - return buf; -} - -static char *core_error_string(status_t statcode) -{ - switch (statcode) { - case CORE_ENOPOOL: - return "A new pool could not be created."; - case CORE_EBADDATE: - return "An invalid date has been provided"; - case CORE_EINVALSOCK: - return "An invalid socket was returned"; - case CORE_ENOPROC: - return "No process was provided and one was required."; - case CORE_ENOTIME: - return "No time was provided and one was required."; - case CORE_ENODIR: - return "No directory was provided and one was required."; - case CORE_ENOLOCK: - return "No lock was provided and one was required."; - case CORE_ENOPOLL: - return "No poll structure was provided and one was required."; - case CORE_ENOSOCKET: - return "No socket was provided and one was required."; - case CORE_ENOTHREAD: - return "No thread was provided and one was required."; - case CORE_ENOTHDKEY: - return "No thread key structure was provided and one was required."; - case CORE_ENOSHMAVAIL: - return "No shared memory is currently available"; - case CORE_EDSOOPEN: - return "DSO load failed"; - case CORE_EBADIP: - return "The specified IP address is invalid."; - case CORE_EBADMASK: - return "The specified network mask is invalid."; - - case CORE_INCHILD: - return - "Your code just forked, and you are currently executing in the " - "child process"; - case CORE_INPARENT: - return - "Your code just forked, and you are currently executing in the " - "parent process"; - case CORE_DETACH: - return "The specified thread is detached"; - case CORE_NOTDETACH: - return "The specified thread is not detached"; - case CORE_CHILD_DONE: - return "The specified child process is done executing"; - case CORE_CHILD_NOTDONE: - return "The specified child process is not done executing"; - case CORE_TIMEUP: - return "The timeout specified has expired"; - case CORE_INCOMPLETE: - return "Partial results are valid but processing is incomplete"; - case CORE_BADCH: - return "Bad character specified on command line"; - case CORE_BADARG: - return "Missing parameter for the specified command line option"; - case CORE_EOF: - return "End of file found"; - case CORE_NOTFOUND: - return "Could not find specified socket in poll list."; - case CORE_ANONYMOUS: - return "Shared memory is implemented anonymously"; - case CORE_FILEBASED: - return "Shared memory is implemented using files"; - case CORE_KEYBASED: - return "Shared memory is implemented using a key system"; - case CORE_EINIT: - return - "There is no error, this value signifies an initialized " - "error code"; - case CORE_ENOTIMPL: - return "This function has not been implemented on this platform"; - case CORE_EMISMATCH: - return "passwords do not match"; - case CORE_EABSOLUTE: - return "The given path is absolute"; - case CORE_ERELATIVE: - return "The given path is relative"; - case CORE_EINCOMPLETE: - return "The given path is incomplete"; - case CORE_EABOVEROOT: - return "The given path was above the root path"; - case CORE_EBADPATH: - return "The given path is misformatted or contained invalid characters"; - case CORE_EPATHWILD: - return "The given path contained wildcard characters"; - case CORE_EPROC_UNKNOWN: - return "The process is not recognized."; - case CORE_EGENERAL: - return "Internal error"; - default: - return "Error string not specified yet"; - } -} - - -#ifdef OS2 -#include - -int core_canonical_error(status_t err); - -static char *core_os_strerror(char* buf, size_t bufsize, int err) -{ - char result[200]; - unsigned char message[HUGE_STRING_LEN]; - ULONG len; - char *pos; - int c; - - if (err >= 10000 && err < 12000) { /* socket error codes */ - return stuffbuffer(buf, bufsize, - strerror(core_canonical_error(err+OS_START_SYSERR))); - } - else if (DosGetMessage(NULL, 0, message, HUGE_STRING_LEN, err, - "OSO001.MSG", &len) == 0) { - len--; - message[len] = 0; - pos = result; - - if (len >= sizeof(result)) - len = sizeof(result) - 1; - - for (c=0; c= 0) { - buf[i] = (char) msg[i]; - } else { - buf[i] = '?'; - } - } -#endif -#endif - - if (!len) { - for (i = 0; gaErrorList[i].msg; ++i) { - if (gaErrorList[i].code == errcode) { - core_cpystrn(buf, gaErrorList[i].msg, bufsize); - len = strlen(buf); - break; - } - } - } - - if (len) { - /* FormatMessage put the message in the buffer, but it may - * have embedded a newline (\r\n), and possible more than one. - * Remove the newlines replacing them with a space. This is not - * as visually perfect as moving all the remaining message over, - * but more efficient. - */ - i = len; - while (i) { - i--; - if ((buf[i] == '\r') || (buf[i] == '\n')) - buf[i] = ' '; - } - } - else { - /* Windows didn't provide us with a message. Even stuff like * WSAECONNREFUSED won't get a message. - */ - core_snprintf(buf, bufsize, "Unrecognized Win32 error code %d", errcode); - } - - return buf; -} - -#else -/* On Unix, core_os_strerror() handles error codes from the resolver - * (h_errno). - */ -static char *core_os_strerror(char* buf, size_t bufsize, int err) -{ -#ifdef HAVE_HSTRERROR - return stuffbuffer(buf, bufsize, hstrerror(err)); -#else /* HAVE_HSTRERROR */ - const char *msg; - - switch(err) { - case HOST_NOT_FOUND: - msg = "Unknown host"; - break; -#if defined(NO_DATA) - case NO_DATA: -#if defined(NO_ADDRESS) && (NO_DATA != NO_ADDRESS) - case NO_ADDRESS: -#endif - msg = "No address for host"; - break; -#elif defined(NO_ADDRESS) - case NO_ADDRESS: - msg = "No address for host"; - break; -#endif /* NO_DATA */ - default: - msg = "Unrecognized resolver error"; - } - return stuffbuffer(buf, bufsize, msg); -#endif /* HAVE_STRERROR */ -} -#endif - -#if defined(HAVE_STRERROR_R) && defined(STRERROR_R_RC_INT) && !defined(BEOS) -/* AIX and Tru64 style */ -static char *native_strerror(status_t statcode, char *buf, - size_t bufsize) -{ - if (strerror_r(statcode, buf, bufsize) < 0) { - return stuffbuffer(buf, bufsize, - "CORE does not understand this error code"); - } - else { - return buf; - } -} -#elif defined(HAVE_STRERROR_R) -/* glibc style */ - -/* BeOS has the function available, but it doesn't provide - * the prototype publically (doh!), so to avoid a build warning - * we add a suitable prototype here. - */ -#if defined(BEOS) -const char *strerror_r(status_t, char *, size_t); -#endif - -static char *native_strerror(status_t statcode, char *buf, - size_t bufsize) -{ - const char *msg; - - buf[0] = '\0'; - msg = strerror_r(statcode, buf, bufsize); - if (buf[0] == '\0') { /* libc didn't use our buffer */ - return stuffbuffer(buf, bufsize, msg); - } - else { - return buf; - } -} -#else -/* plain old strerror(); - * thread-safe on some platforms (e.g., Solaris, OS/390) - */ -static char *native_strerror(status_t statcode, char *buf, - size_t bufsize) -{ -#ifdef _WIN32_WCE - static char err[32]; - sprintf(err, "Native Error #%d", statcode); - return stuffbuffer(buf, bufsize, err); -#else - const char *err = strerror(statcode); - if (err) { - return stuffbuffer(buf, bufsize, err); - } else { - return stuffbuffer(buf, bufsize, - "CORE does not understand this error code"); - } -#endif -} -#endif - -char * core_strerror(status_t statcode, char *buf, - size_t bufsize) -{ - if (statcode < OS_START_ERROR) { - return native_strerror(statcode, buf, bufsize); - } - else if (statcode < OS_START_USERERR) { - return stuffbuffer(buf, bufsize, core_error_string(statcode)); - } - else if (statcode < OS_START_EAIERR) { - return stuffbuffer(buf, bufsize, "CORE does not understand this error code"); - } - else if (statcode < OS_START_SYSERR) { -#if defined(HAVE_GAI_STRERROR) - statcode -= OS_START_EAIERR; -#if defined(NEGATIVE_EAI) - statcode = -statcode; -#endif - return stuffbuffer(buf, bufsize, gai_strerror(statcode)); -#else - return stuffbuffer(buf, bufsize, "CORE does not understand this error code"); -#endif - } - else { - return core_os_strerror(buf, bufsize, statcode - OS_START_SYSERR); - } -} - diff --git a/lib/core/src/unix/file.c b/lib/core/src/unix/file.c deleted file mode 100644 index 44c232964..000000000 --- a/lib/core/src/unix/file.c +++ /dev/null @@ -1,1101 +0,0 @@ -#include "core_arch_file.h" -#include "core.h" -#include "core_errno.h" -#include "core_general.h" -#include "core_debug.h" -#include "core_pool.h" - -pool_declare(file_pool, file_t, MAX_NUM_OF_FILE); - -status_t file_init(void) -{ - pool_init(&file_pool, MAX_NUM_OF_FILE); - return CORE_OK; -} - -status_t file_final(void) -{ - pool_final(&file_pool); - return CORE_OK; -} - -#if !defined(OS2) && !defined(WIN32) -mode_t unix_perms2mode(file_perms_t perms) -{ - mode_t mode = 0; - - if (perms & FILE_USETID) - mode |= S_ISUID; - if (perms & FILE_UREAD) - mode |= S_IRUSR; - if (perms & FILE_UWRITE) - mode |= S_IWUSR; - if (perms & FILE_UEXECUTE) - mode |= S_IXUSR; - - if (perms & FILE_GSETID) - mode |= S_ISGID; - if (perms & FILE_GREAD) - mode |= S_IRGRP; - if (perms & FILE_GWRITE) - mode |= S_IWGRP; - if (perms & FILE_GEXECUTE) - mode |= S_IXGRP; - -#ifdef S_ISVTX - if (perms & FILE_WSTICKY) - mode |= S_ISVTX; -#endif - if (perms & FILE_WREAD) - mode |= S_IROTH; - if (perms & FILE_WWRITE) - mode |= S_IWOTH; - if (perms & FILE_WEXECUTE) - mode |= S_IXOTH; - - return mode; -} - -file_perms_t unix_mode2perms(mode_t mode) -{ - file_perms_t perms = 0; - - if (mode & S_ISUID) - perms |= FILE_USETID; - if (mode & S_IRUSR) - perms |= FILE_UREAD; - if (mode & S_IWUSR) - perms |= FILE_UWRITE; - if (mode & S_IXUSR) - perms |= FILE_UEXECUTE; - - if (mode & S_ISGID) - perms |= FILE_GSETID; - if (mode & S_IRGRP) - perms |= FILE_GREAD; - if (mode & S_IWGRP) - perms |= FILE_GWRITE; - if (mode & S_IXGRP) - perms |= FILE_GEXECUTE; - -#ifdef S_ISVTX - if (mode & S_ISVTX) - perms |= FILE_WSTICKY; -#endif - if (mode & S_IROTH) - perms |= FILE_WREAD; - if (mode & S_IWOTH) - perms |= FILE_WWRITE; - if (mode & S_IXOTH) - perms |= FILE_WEXECUTE; - - return perms; -} -#endif - -status_t file_open(file_t **new, - const char *fname, c_int32_t flag, file_perms_t perm) -{ - os_file_t fd; - int oflags = 0; - - d_assert(fname, return CORE_ERROR,); - - if ((flag & FILE_READ) && (flag & FILE_WRITE)) - { - oflags = O_RDWR; - } - else if (flag & FILE_READ) - { - oflags = O_RDONLY; - } - else if (flag & FILE_WRITE) - { - oflags = O_WRONLY; - } - else - { - return CORE_EACCES; - } - - if (flag & FILE_CREATE) - { - oflags |= O_CREAT; - if (flag & FILE_EXCL) - { - oflags |= O_EXCL; - } - } - if ((flag & FILE_EXCL) && !(flag & FILE_CREATE)) - { - return CORE_EACCES; - } - - if (flag & FILE_APPEND) - { - oflags |= O_APPEND; - } - if (flag & FILE_TRUNCATE) - { - oflags |= O_TRUNC; - } -#ifdef O_BINARY - if (flag & FILE_BINARY) - { - oflags |= O_BINARY; - } -#endif - - if (perm == FILE_OS_DEFAULT) - { - fd = open(fname, oflags, 0666); - } - else - { - fd = open(fname, oflags, unix_perms2mode(perm)); - } - if (fd < 0) - { - return errno; - } - - pool_alloc_node(&file_pool, &(*new)); - d_assert((*new), return CORE_ENOMEM, "file_pool(%d) is not enough\n", - MAX_NUM_OF_FILE); - - (*new)->flags = flag; - (*new)->filedes = fd; - - strcpy((*new)->fname, fname); - - (*new)->timeout = -1; - (*new)->eof_hit = 0; - (*new)->filePtr = 0; - - return CORE_OK; -} - -status_t file_close(file_t *file) -{ - status_t rv = CORE_OK; - - d_assert(file, return CORE_ERROR,); - - if (close(file->filedes) == 0) - { - file->filedes = -1; - - /* Only the parent process should delete the file! */ - if (file->flags & FILE_DELONCLOSE) - { - unlink(file->fname); - } - } - else - { - /* Are there any error conditions other than EINTR or EBADF? */ - rv = errno; - } - - pool_free_node(&file_pool, file); - - return rv; -} - -status_t file_remove(const char *path) -{ - d_assert(path, return CORE_ERROR,); - - if (unlink(path) == 0) - { - return CORE_OK; - } - else - { - return errno; - } -} - -static status_t file_transfer_contents( - const char *from_path, const char *to_path, - c_int32_t flags, file_perms_t to_perms) -{ - file_t *s, *d; - status_t status; - file_info_t finfo; - file_perms_t perms; - - d_assert(from_path, return CORE_ERROR,); - d_assert(to_path, return CORE_ERROR,); - - /* Open source file. */ - status = file_open(&s, from_path, FILE_READ, FILE_OS_DEFAULT); - if (status) - return status; - - /* Maybe get its permissions. */ - if (to_perms == FILE_SOURCE_PERMS) - { - status = file_info_get(&finfo, FILE_INFO_PROT, s); - if (status != CORE_OK && status != CORE_INCOMPLETE) - { - file_close(s); /* toss any error */ - return status; - } - perms = finfo.protection; - } - else - perms = to_perms; - - /* Open dest file. */ - status = file_open(&d, to_path, flags, perms); - if (status) - { - file_close(s); /* toss any error */ - return status; - } - -#if BUFSIZ > FILE_DEFAULT_BUFSIZE -#define COPY_BUFSIZ BUFSIZ -#else -#define COPY_BUFSIZ FILE_DEFAULT_BUFSIZE -#endif - - /* Copy bytes till the cows come home. */ - while (1) - { - char buf[COPY_BUFSIZ]; - size_t bytes_this_time = sizeof(buf); - status_t read_err; - status_t write_err; - - /* Read 'em. */ - read_err = file_read(s, buf, &bytes_this_time); - if (read_err && !STATUS_IS_EOF(read_err)) - { - file_close(s); /* toss any error */ - file_close(d); /* toss any error */ - return read_err; - } - - /* Write 'em. */ - write_err = file_write_full(d, buf, bytes_this_time, NULL); - if (write_err) - { - file_close(s); /* toss any error */ - file_close(d); /* toss any error */ - return write_err; - } - - if (read_err && STATUS_IS_EOF(read_err)) - { - status = file_close(s); - if (status) - { - file_close(d); /* toss any error */ - return status; - } - - /* return the results of this close: an error, or success */ - return file_close(d); - } - } - /* NOTREACHED */ -} - -status_t file_rename(const char *from_path, const char *to_path) -{ - d_assert(from_path, return CORE_ERROR,); - d_assert(to_path, return CORE_ERROR,); - - if (rename(from_path, to_path) != 0) - { - return errno; - } - return CORE_OK; -} - -status_t file_link(const char *from_path, const char *to_path) -{ - d_assert(from_path, return CORE_ERROR,); - d_assert(to_path, return CORE_ERROR,); - - if (link(from_path, to_path) == -1) - { - return errno; - } - - return CORE_OK; -} - -status_t file_copy( - const char *from_path, const char *to_path, file_perms_t perms) -{ - return file_transfer_contents(from_path, to_path, - (FILE_WRITE | FILE_CREATE | FILE_TRUNCATE), perms); -} - -status_t file_append( - const char *from_path, const char *to_path, file_perms_t perms) -{ - return file_transfer_contents(from_path, to_path, - (FILE_WRITE | FILE_CREATE | FILE_APPEND), perms); -} - -status_t file_eof(file_t *fptr) -{ - d_assert(fptr, return CORE_ERROR,); - - if (fptr->eof_hit == 1) - { - return CORE_EOF; - } - return CORE_OK; -} - -status_t file_read(file_t *thefile, void *buf, size_t *nbytes) -{ - ssize_t rv; - size_t bytes_read; - - d_assert(thefile, return CORE_ERROR,); - d_assert(nbytes, return CORE_ERROR,); - - if (*nbytes <= 0) - { - *nbytes = 0; - return CORE_OK; - } - - bytes_read = 0; - - do - { - rv = read(thefile->filedes, buf, *nbytes); - } while (rv == -1 && errno == EINTR); - *nbytes = bytes_read; - if (rv == 0) - { - thefile->eof_hit = TRUE; - return CORE_EOF; - } - if (rv > 0) - { - *nbytes += rv; - return CORE_OK; - } - return errno; -} - -status_t file_write( - file_t *thefile, const void *buf, size_t *nbytes) -{ - size_t rv; - - d_assert(thefile, return CORE_ERROR,); - d_assert(buf, return CORE_ERROR,); - d_assert(nbytes, return CORE_ERROR,); - - do - { - rv = write(thefile->filedes, buf, *nbytes); - } while (rv == (size_t)-1 && errno == EINTR); - - if (rv == (size_t)-1) - { - (*nbytes) = 0; - return errno; - } - *nbytes = rv; - return CORE_OK; -} -status_t file_writev(file_t *thefile, - const struct iovec *vec, size_t nvec, size_t *nbytes) -{ -#ifdef HAVE_WRITEV - status_t rv; - ssize_t bytes; - - d_assert(thefile, return CORE_ERROR,); - d_assert(vec, return CORE_ERROR,); - d_assert(nvec, return CORE_ERROR,); - d_assert(nbytes, return CORE_ERROR,); - - if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) - { - *nbytes = 0; - rv = errno; - } - else - { - *nbytes = bytes; - rv = CORE_OK; - } - return rv; -#else - /** - * The problem with trying to output the entire iovec is that we cannot - * maintain the behaviour that a real writev would have. If we iterate - * over the iovec one at a time, we lose the atomic properties of - * writev(). The other option is to combine the entire iovec into one - * buffer that we could then send in one call to write(). This is not - * reasonable since we do not know how much data an iovec could contain. - * - * The only reasonable option, that maintains the semantics of a real - * writev(), is to only write the first iovec. Callers of file_writev() - * must deal with partial writes as they normally would. If you want to - * ensure an entire iovec is written, use file_writev_full(). - */ - - *nbytes = vec[0].iov_len; - return file_write(thefile, vec[0].iov_base, nbytes); -#endif -} - -status_t file_read_full(file_t *thefile, void *buf, - size_t nbytes, size_t *bytes_read) -{ - status_t status; - size_t total_read = 0; - - d_assert(thefile, return CORE_ERROR,); - d_assert(buf, return CORE_ERROR,); - - do { - size_t amt = nbytes; - - status = file_read(thefile, buf, &amt); - buf = (char *)buf + amt; - nbytes -= amt; - total_read += amt; - } while (status == CORE_OK && nbytes > 0); - - if (bytes_read != NULL) - *bytes_read = total_read; - - return status; -} -status_t file_write_full(file_t *thefile, - const void *buf, size_t nbytes, size_t *bytes_written) -{ - status_t status; - size_t total_written = 0; - - d_assert(thefile, return CORE_ERROR,); - d_assert(buf, return CORE_ERROR,); - - do { - size_t amt = nbytes; - - status = file_write(thefile, buf, &amt); - buf = (char *)buf + amt; - nbytes -= amt; - total_written += amt; - } while (status == CORE_OK && nbytes > 0); - - if (bytes_written != NULL) - *bytes_written = total_written; - - return status; -} - -status_t file_writev_full(file_t *thefile, - const struct iovec *vec, size_t nvec, size_t *bytes_written) -{ - status_t rv = CORE_OK; - size_t i; - size_t amt = 0; - size_t total = 0; - - d_assert(thefile, return CORE_ERROR,); - d_assert(vec, return CORE_ERROR,); - d_assert(nvec, return CORE_ERROR,); - d_assert(bytes_written, return CORE_ERROR,); - - for (i = 0; i < nvec; i++) - { - total += vec[i].iov_len; - } - - rv = file_writev(thefile, vec, nvec, &amt); - - if (bytes_written != NULL) - *bytes_written = amt; - - if (rv != CORE_OK || (amt == total)) - { - return rv; - } - - for (i = 0; i < nvec && amt; i++) - { - if (amt >= vec[i].iov_len) - { - amt -= vec[i].iov_len; - } - else - { - break; - } - } - - if (amt) - { - rv = file_write_full(thefile, (const char *)vec[i].iov_base + amt, - vec[i].iov_len - amt, NULL); - } - - for (; i < nvec && rv == CORE_OK; i++) - { - rv = file_write_full(thefile, vec[i].iov_base, - vec[i].iov_len, &amt); - } - - if (bytes_written != NULL) - *bytes_written = total; - - return rv; -} - -status_t file_putc(char ch, file_t *thefile) -{ - size_t nbytes = 1; - - d_assert(thefile, return CORE_ERROR,); - - return file_write(thefile, &ch, &nbytes); -} -status_t file_getc(char *ch, file_t *thefile) -{ - size_t nbytes = 1; - - d_assert(thefile, return CORE_ERROR,); - - return file_read(thefile, ch, &nbytes); -} - -status_t file_gets(char *str, int len, file_t *thefile) -{ - status_t rv = CORE_OK; /* get rid of gcc warning */ - size_t nbytes; - const char *str_start = str; - char *final = str + len - 1; - - d_assert(str, return CORE_ERROR,); - d_assert(thefile, return CORE_ERROR,); - - if (len <= 1) - { - /* sort of like fgets(), which returns NULL and stores no bytes - */ - return CORE_OK; - } - - while (str < final) - { /* leave room for trailing '\0' */ - nbytes = 1; - rv = file_read(thefile, str, &nbytes); - if (rv != CORE_OK) - { - break; - } - if (*str == '\n') - { - ++str; - break; - } - ++str; - } - - /* We must store a terminating '\0' if we've stored any chars. We can - * get away with storing it if we hit an error first. - */ - *str = '\0'; - if (str > str_start) - { - /* we stored chars; don't report EOF or any other errors; - * the app will find out about that on the next call - */ - return CORE_OK; - } - return rv; -} - -status_t file_puts(const char *str, file_t *thefile) -{ - d_assert(str, return CORE_ERROR,); - d_assert(thefile, return CORE_ERROR,); - - return file_write_full(thefile, str, strlen(str), NULL); -} - -status_t file_sync(file_t *thefile) -{ - status_t rv = CORE_OK; - - d_assert(thefile, return CORE_ERROR,); - - if (fsync(thefile->filedes)) - { - rv = get_os_error(); - } - - return rv; -} - -status_t file_seek(file_t *thefile, - seek_where_t where, off_t *offset) -{ - off_t rv; - - d_assert(thefile, return CORE_ERROR,); - d_assert(offset, return CORE_ERROR,); - - thefile->eof_hit = 0; - - rv = lseek(thefile->filedes, *offset, where); - if (rv == -1) - { - *offset = -1; - return errno; - } - else - { - *offset = rv; - return CORE_OK; - } -} - -status_t file_name_get(const char **fname, file_t *thefile) -{ - d_assert(fname, return CORE_ERROR,); - d_assert(thefile, return CORE_ERROR,); - - *fname = thefile->fname; - return CORE_OK; -} - -status_t file_perms_set(const char *fname, file_perms_t perms) -{ - mode_t mode = unix_perms2mode(perms); - - d_assert(fname, return CORE_ERROR,); - - if (chmod(fname, mode) == -1) - return errno; - return CORE_OK; -} - -status_t file_attrs_set(const char *fname, - file_attrs_t attributes, file_attrs_t attr_mask) -{ - status_t status; - file_info_t finfo; - - d_assert(fname, return CORE_ERROR,); - - /* Don't do anything if we can't handle the requested attributes */ - if (!(attr_mask & (ATTR_READONLY | ATTR_EXECUTABLE))) - return CORE_OK; - - status = file_stat(&finfo, fname, FILE_INFO_PROT); - if (status) - return status; - - /* ### TODO: should added bits be umask'd? */ - if (attr_mask & ATTR_READONLY) - { - if (attributes & ATTR_READONLY) - { - finfo.protection &= ~FILE_UWRITE; - finfo.protection &= ~FILE_GWRITE; - finfo.protection &= ~FILE_WWRITE; - } - else - { - /* ### umask this! */ - finfo.protection |= FILE_UWRITE; - finfo.protection |= FILE_GWRITE; - finfo.protection |= FILE_WWRITE; - } - } - - if (attr_mask & ATTR_EXECUTABLE) - { - if (attributes & ATTR_EXECUTABLE) - { - /* ### umask this! */ - finfo.protection |= FILE_UEXECUTE; - finfo.protection |= FILE_GEXECUTE; - finfo.protection |= FILE_WEXECUTE; - } - else - { - finfo.protection &= ~FILE_UEXECUTE; - finfo.protection &= ~FILE_GEXECUTE; - finfo.protection &= ~FILE_WEXECUTE; - } - } - - return file_perms_set(fname, finfo.protection); -} - -status_t file_mtime_set(const char *fname, c_time_t mtime) -{ - status_t status; - file_info_t finfo; - - d_assert(fname, return CORE_ERROR,); - - status = file_stat(&finfo, fname, FILE_INFO_ATIME); - if (status) - { - return status; - } - -#ifdef HAVE_UTIMES - { - struct timeval tvp[2]; - - tvp[0].tv_sec = time_sec(finfo.atime); - tvp[0].tv_usec = time_usec(finfo.atime); - tvp[1].tv_sec = time_sec(mtime); - tvp[1].tv_usec = time_usec(mtime); - - if (utimes(fname, tvp) == -1) - { - return errno; - } - } -#elif defined(HAVE_UTIME) - { - struct utimbuf buf; - - buf.actime = (time_t) (finfo.atime / USEC_PER_SEC); - buf.modtime = (time_t) (mtime / USEC_PER_SEC); - - if (utime(fname, &buf) == -1) - { - return errno; - } - } -#else - return CORE_ENOTIMPL; -#endif - - return CORE_OK; -} - -status_t dir_make(const char *path, file_perms_t perm) -{ - mode_t mode = unix_perms2mode(perm); - - d_assert(path, return CORE_ERROR,); - - if (mkdir(path, mode) == 0) - { - return CORE_OK; - } - else - { - return errno; - } -} - -#define PATH_SEPARATOR '/' - -/* Remove trailing separators that don't affect the meaning of PATH. */ -static void path_canonicalize (char *dir) -{ - d_assert(dir, return,); - - /* At some point this could eliminate redundant components. For - * now, it just makes sure there is no trailing slash. */ - size_t len = strlen (dir); - size_t orig_len = len; - - while ((len > 0) && (dir[len - 1] == PATH_SEPARATOR)) - len--; - - if (len != orig_len) - dir[len] = 0; -} - -/* Remove one component off the end of PATH. */ -void path_remove_last_component (char *dir, const char *path) -{ - int i; - int len = 0; - - d_assert(dir, return,); - d_assert(path, return,); - - strcpy(dir, path); - path_canonicalize (dir); - for (i = (strlen(dir) - 1); i >= 0; i--) { - if (path[i] == PATH_SEPARATOR) - break; - } - - len = (i < 0) ? 0 : i; - dir[len] = 0; -} - -status_t dir_make_recursive(const char *path, file_perms_t perm) -{ - status_t err = 0; - - d_assert(path, return CORE_ERROR,); - - err = dir_make(path, perm); /* Try to make PATH right out */ - - if (err == EEXIST) /* It's OK if PATH exists */ - return CORE_OK; - - if (err == ENOENT) /* Missing an intermediate dir */ - { - char dir[MAX_DIRNAME_SIZE]; - - path_remove_last_component(dir, path); - /* If there is no path left, give up. */ - if (dir[0] == '\0') - { - return err; - } - - err = dir_make_recursive(dir, perm); - - if (!err) - err = dir_make (path, perm); - } - - return err; -} -status_t dir_remove(const char *path) -{ - d_assert(path, return CORE_ERROR,); - - if (rmdir(path) == 0) - { - return CORE_OK; - } - else { - return errno; - } -} - -static filetype_e filetype_from_mode(mode_t mode) -{ - filetype_e type; - - switch (mode & S_IFMT) - { - case S_IFREG: - type = FILE_REG; break; - case S_IFDIR: - type = FILE_DIR; break; - case S_IFLNK: - type = FILE_LNK; break; - case S_IFCHR: - type = FILE_CHR; break; - case S_IFBLK: - type = FILE_BLK; break; -#if defined(S_IFFIFO) - case S_IFFIFO: - type = FILE_PIPE; break; -#endif -#if !defined(BEOS) && defined(S_IFSOCK) - case S_IFSOCK: - type = FILE_SOCK; break; -#endif - - default: - /* Work around missing S_IFxxx values above - * for Linux et al. - */ -#if !defined(S_IFFIFO) && defined(S_ISFIFO) - if (S_ISFIFO(mode)) - { - type = FILE_PIPE; - } - else -#endif -#if !defined(BEOS) && !defined(S_IFSOCK) && defined(S_ISSOCK) - if (S_ISSOCK(mode)) - { - type = FILE_SOCK; - } else -#endif - type = FILE_UNKFILE; - } - return type; -} - -static void fill_out_finfo(file_info_t *finfo, struct_stat *info, - c_int32_t wanted) -{ - d_assert(finfo, return,); - d_assert(info, return,); - - finfo->valid = FILE_INFO_MIN | FILE_INFO_IDENT | FILE_INFO_NLINK - | FILE_INFO_OWNER | FILE_INFO_PROT; - finfo->protection = unix_mode2perms(info->st_mode); - finfo->filetype = filetype_from_mode(info->st_mode); - finfo->user = info->st_uid; - finfo->group = info->st_gid; - finfo->size = info->st_size; - finfo->device = info->st_dev; - finfo->nlink = info->st_nlink; - - /* Check for overflow if storing a 64-bit st_ino in a 32-bit - * ino_t for LFS builds: */ - if (sizeof(ino_t) >= sizeof(info->st_ino) - || (ino_t)info->st_ino == info->st_ino) - { - finfo->inode = info->st_ino; - } else - { - finfo->valid &= ~FILE_INFO_INODE; - } - - time_ansi_put(&finfo->atime, info->st_atime); -#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - finfo->atime += info->st_atim.tv_nsec / TIME_C(1000); -#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC) - finfo->atime += info->st_atimensec / TIME_C(1000); -#elif defined(HAVE_STRUCT_STAT_ST_ATIME_N) - finfo->ctime += info->st_atime_n / TIME_C(1000); -#endif - - time_ansi_put(&finfo->mtime, info->st_mtime); -#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - finfo->mtime += info->st_mtim.tv_nsec / TIME_C(1000); -#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) - finfo->mtime += info->st_mtimensec / TIME_C(1000); -#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N) - finfo->ctime += info->st_mtime_n / TIME_C(1000); -#endif - - time_ansi_put(&finfo->ctime, info->st_ctime); -#ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC - finfo->ctime += info->st_ctim.tv_nsec / TIME_C(1000); -#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC) - finfo->ctime += info->st_ctimensec / TIME_C(1000); -#elif defined(HAVE_STRUCT_STAT_ST_CTIME_N) - finfo->ctime += info->st_ctime_n / TIME_C(1000); -#endif - -#ifdef HAVE_STRUCT_STAT_ST_BLOCKS -#ifdef DEV_BSIZE - finfo->csize = (off_t)info->st_blocks * (off_t)DEV_BSIZE; -#else - finfo->csize = (off_t)info->st_blocks * (off_t)512; -#endif - finfo->valid |= FILE_INFO_CSIZE; -#endif -} - - -status_t file_info_get(file_info_t *finfo, - c_int32_t wanted, file_t *thefile) -{ - struct_stat info; - - d_assert(finfo, return CORE_ERROR,); - d_assert(thefile, return CORE_ERROR,); - - if (fstat(thefile->filedes, &info) == 0) - { - strcpy(finfo->fname, thefile->fname); - fill_out_finfo(finfo, &info, wanted); - return (wanted & ~finfo->valid) ? CORE_INCOMPLETE : CORE_OK; - } - else { - return errno; - } -} - -status_t file_trunc(file_t *fp, off_t offset) -{ - d_assert(fp, return CORE_ERROR,); - - if (ftruncate(fp->filedes, offset) == -1) - { - return errno; - } - return file_seek(fp, FILE_SET, &offset); -} - -c_int32_t file_flags_get(file_t *f) -{ - d_assert(f, return CORE_ERROR,); - - return f->flags; -} - -status_t file_stat(file_info_t *finfo, - const char *fname, c_int32_t wanted) -{ - struct_stat info; - int srv; - - d_assert(finfo, return CORE_ERROR,); - d_assert(fname, return CORE_ERROR,); - - if (wanted & FILE_INFO_LINK) - srv = lstat(fname, &info); - else - srv = stat(fname, &info); - - if (srv == 0) - { - strcpy(finfo->fname, fname); - fill_out_finfo(finfo, &info, wanted); - if (wanted & FILE_INFO_LINK) - wanted &= ~FILE_INFO_LINK; - return (wanted & ~finfo->valid) ? CORE_INCOMPLETE : CORE_OK; - } - else - { -#if !defined(ENOENT) || !defined(ENOTDIR) -#error ENOENT || ENOTDIR not defined; please see the -#error comments at this line in the source for a workaround. - /* - * If ENOENT || ENOTDIR is not defined in one of the your OS's - * include files, CORE cannot report a good reason why the stat() - * of the file failed; there are cases where it can fail even though - * the file exists. This opens holes in Apache, for example, because - * it becomes possible for someone to get a directory listing of a - * directory even though there is an index (eg. index.html) file in - * it. If you do not have a problem with this, delete the above - * #error lines and start the compile again. If you need to do this, - * please submit a bug report to http://www.apache.org/bug_report.html - * letting us know that you needed to do this. Please be sure to - * include the operating system you are using. - */ - /* WARNING: All errors will be handled as not found - */ -#if !defined(ENOENT) - return CORE_ENOENT; -#else - /* WARNING: All errors but not found will be handled as not directory - */ - if (errno != ENOENT) - return CORE_ENOENT; - else - return errno; -#endif -#else /* All was defined well, report the usual: */ - return errno; -#endif - } -} - -status_t temp_dir_get(char *temp_dir) -{ - d_assert(temp_dir, return CORE_ERROR,); - - strcpy(temp_dir, "/tmp"); - return CORE_OK; -} - diff --git a/lib/core/src/unix/mutex.c b/lib/core/src/unix/mutex.c deleted file mode 100644 index 9fd4c7a25..000000000 --- a/lib/core/src/unix/mutex.c +++ /dev/null @@ -1,117 +0,0 @@ -#define TRACE_MODULE _mutex - -#include "core.h" -#include "core_arch_mutex.h" -#include "core_errno.h" -#include "core_param.h" -#include "core_general.h" -#include "core_debug.h" -#include "core_pool.h" - -pool_declare(mutex_pool, mutex_t, MAX_NUM_OF_MUTEX); - -status_t mutex_init(void) -{ - pool_init_wo_lock(&mutex_pool, MAX_NUM_OF_MUTEX); - return CORE_OK; -} - -status_t mutex_final(void) -{ - if (pool_size(&mutex_pool) != pool_avail(&mutex_pool)) - d_error("%d not freed in mutex_pool[%d]", - pool_size(&mutex_pool) - pool_avail(&mutex_pool), - pool_size(&mutex_pool)); - d_trace(9, "%d not freed in mutex_pool[%d]\n", - pool_size(&mutex_pool) - pool_avail(&mutex_pool), - pool_size(&mutex_pool)); - pool_final(&mutex_pool); - return CORE_OK; -} - -status_t mutex_create(mutex_id *id, unsigned int flags) -{ - mutex_t *new_mutex; - status_t rv; - - pool_alloc_node(&mutex_pool, &new_mutex); - d_assert(new_mutex, return CORE_ENOMEM, - "mutex_pool(%d) is not enough" - "(new_mutex=%p, mut:%p, avail:%d,size:%d,head:%d,tail:%d \n", - MAX_NUM_OF_MUTEX, - new_mutex, mutex_pool.mut, - mutex_pool.avail, mutex_pool.size, - mutex_pool.head, mutex_pool.tail); - - if (flags & MUTEX_NESTED) - { - pthread_mutexattr_t mattr; - - rv = pthread_mutexattr_init(&mattr); - if (rv) return rv; - - rv = pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE); - if (rv) - { - pthread_mutexattr_destroy(&mattr); - return rv; - } - - rv = pthread_mutex_init(&new_mutex->mutex, &mattr); - - pthread_mutexattr_destroy(&mattr); - } else - rv = pthread_mutex_init(&new_mutex->mutex, NULL); - - if (rv) - { - return rv; - } - - *id = (mutex_id)new_mutex; - return CORE_OK; -} - -status_t mutex_lock(mutex_id id) -{ - status_t rv; - mutex_t *mutex = (mutex_t *)id; - - rv = pthread_mutex_lock(&mutex->mutex); - return rv; -} - -status_t mutex_trylock(mutex_id id) -{ - status_t rv; - mutex_t *mutex = (mutex_t *)id; - - rv = pthread_mutex_trylock(&mutex->mutex); - if (rv) - { - return (rv == EBUSY) ? CORE_EBUSY : rv; - } - - return CORE_OK; -} - -status_t mutex_unlock(mutex_id id) -{ - status_t rv; - mutex_t *mutex = (mutex_t *)id; - - rv = pthread_mutex_unlock(&mutex->mutex); - - return rv; -} - -status_t mutex_delete(mutex_id id) -{ - status_t rv; - mutex_t *mutex = (mutex_t *)id; - - rv = pthread_mutex_destroy(&mutex->mutex); - pool_free_node(&mutex_pool, mutex); - - return rv; -} diff --git a/lib/core/src/unix/pkbuf.c b/lib/core/src/unix/pkbuf.c deleted file mode 100644 index f9f8d5661..000000000 --- a/lib/core/src/unix/pkbuf.c +++ /dev/null @@ -1,658 +0,0 @@ -#define TRACE_MODULE _pkbuf - -#include "core.h" -#include "core_pkbuf.h" -#include "core_errno.h" -#include "core_lib.h" -#include "core_debug.h" -#include "core_pool.h" - -#define MAX_NUM_OF_CLBUF (8192 + 4096 + 2048 + 1024 + 512 + 128) -#define MAX_NUM_OF_PKBUF (8192 + 4096 + 2048 + 1024 + 512 + 128) - -pool_declare(clbuf_pool, clbuf_t, MAX_NUM_OF_CLBUF); -pool_declare(pkbuf_pool, pkbuf_t, MAX_NUM_OF_PKBUF); - -#undef BOUNDARY -#define BOUNDARY SIZEOF_VOIDP - -#define SIZEOF_CLUSTER_128 CORE_ALIGN(128+MAX_SIZEOF_HEADROOM, BOUNDARY) -#define SIZEOF_CLUSTER_256 CORE_ALIGN(256+MAX_SIZEOF_HEADROOM, BOUNDARY) -#define SIZEOF_CLUSTER_512 CORE_ALIGN(512+MAX_SIZEOF_HEADROOM, BOUNDARY) -#define SIZEOF_CLUSTER_1024 CORE_ALIGN(1024+MAX_SIZEOF_HEADROOM, BOUNDARY) -#define SIZEOF_CLUSTER_2048 CORE_ALIGN(2048+MAX_SIZEOF_HEADROOM, BOUNDARY) -#define SIZEOF_CLUSTER_8192 CORE_ALIGN(8192+MAX_SIZEOF_HEADROOM, BOUNDARY) - -#define MAX_NUM_OF_CLUSTER_128 8192 -#define MAX_NUM_OF_CLUSTER_256 4096 -#define MAX_NUM_OF_CLUSTER_512 2048 -#define MAX_NUM_OF_CLUSTER_1024 1024 -#define MAX_NUM_OF_CLUSTER_2048 512 -#define MAX_NUM_OF_CLUSTER_8192 128 - -typedef c_uint8_t cluster_128_t[SIZEOF_CLUSTER_128]; -typedef c_uint8_t cluster_256_t[SIZEOF_CLUSTER_256]; -typedef c_uint8_t cluster_512_t[SIZEOF_CLUSTER_512]; -typedef c_uint8_t cluster_1024_t[SIZEOF_CLUSTER_1024]; -typedef c_uint8_t cluster_2048_t[SIZEOF_CLUSTER_2048]; -typedef c_uint8_t cluster_8192_t[SIZEOF_CLUSTER_8192]; - -pool_declare(cluster_128_pool, cluster_128_t, MAX_NUM_OF_CLUSTER_128); -pool_declare(cluster_256_pool, cluster_256_t, MAX_NUM_OF_CLUSTER_256); -pool_declare(cluster_512_pool, cluster_512_t, MAX_NUM_OF_CLUSTER_512); -pool_declare(cluster_1024_pool, cluster_1024_t, MAX_NUM_OF_CLUSTER_1024); -pool_declare(cluster_2048_pool, cluster_2048_t, MAX_NUM_OF_CLUSTER_2048); -pool_declare(cluster_8192_pool, cluster_8192_t, MAX_NUM_OF_CLUSTER_8192); - -static mutex_id mutex; - -status_t pkbuf_init(void) -{ - mutex_create(&mutex, MUTEX_DEFAULT); - - pool_init(&clbuf_pool, MAX_NUM_OF_CLBUF); - pool_init(&pkbuf_pool, MAX_NUM_OF_PKBUF); - - pool_init(&cluster_128_pool, MAX_NUM_OF_CLUSTER_128); - pool_init(&cluster_256_pool, MAX_NUM_OF_CLUSTER_256); - pool_init(&cluster_512_pool, MAX_NUM_OF_CLUSTER_512); - pool_init(&cluster_1024_pool, MAX_NUM_OF_CLUSTER_1024); - pool_init(&cluster_2048_pool, MAX_NUM_OF_CLUSTER_2048); - pool_init(&cluster_8192_pool, MAX_NUM_OF_CLUSTER_8192); - - return CORE_OK; -} -status_t pkbuf_final(void) -{ - pkbuf_show(); - - pool_final(&clbuf_pool); - pool_final(&pkbuf_pool); - - pool_final(&cluster_128_pool); - pool_final(&cluster_256_pool); - pool_final(&cluster_512_pool); - pool_final(&cluster_1024_pool); - pool_final(&cluster_2048_pool); - pool_final(&cluster_8192_pool); - - mutex_delete(mutex); - - return CORE_OK; -} - -void pkbuf_show(void) -{ - if (pool_used(&pkbuf_pool)) - d_error("%d not freed in pkbuf_pool[%d]", - pool_used(&pkbuf_pool), pool_size(&pkbuf_pool)); - d_trace(9, "%d not freed in pkbuf_pool[%d]\n", - pool_used(&pkbuf_pool), pool_size(&pkbuf_pool)); - - if (pool_used(&clbuf_pool)) - d_error("%d not freed in clbuf_pool[%d]", - pool_used(&clbuf_pool), pool_size(&clbuf_pool)); - d_trace(9, "%d not freed in clbuf_pool[%d]\n", - pool_used(&clbuf_pool), pool_size(&clbuf_pool)); - - if (pool_used(&cluster_128_pool)) - d_error("%d not freed in cluster128_pool[%d]", - pool_used(&cluster_128_pool), pool_size(&cluster_128_pool)); - d_trace(9, "%d not freed in cluster128_pool[%d]\n", - pool_used(&cluster_128_pool), pool_size(&cluster_128_pool)); - - if (pool_used(&cluster_256_pool)) - d_error("%d not freed in cluster256_pool[%d]", - pool_used(&cluster_256_pool), pool_size(&cluster_256_pool)); - d_trace(9, "%d not freed in cluster256_pool[%d]\n", - pool_used(&cluster_256_pool), pool_size(&cluster_256_pool)); - - if (pool_used(&cluster_512_pool)) - d_error("%d not freed in cluster512_pool[%d]", - pool_used(&cluster_512_pool), pool_size(&cluster_512_pool)); - d_trace(9, "%d not freed in cluster512_pool[%d]\n", - pool_used(&cluster_512_pool), pool_size(&cluster_512_pool)); - - if (pool_used(&cluster_1024_pool)) - d_error("%d not freed in cluster1024_pool[%d]", - pool_used(&cluster_1024_pool), pool_size(&cluster_1024_pool)); - d_trace(9, "%d not freed in cluster1024_pool[%d]\n", - pool_used(&cluster_1024_pool), pool_size(&cluster_1024_pool)); - - if (pool_used(&cluster_2048_pool)) - d_error("%d not freed in cluster2048_pool[%d]", - pool_used(&cluster_2048_pool), pool_size(&cluster_2048_pool)); - d_trace(9, "%d not freed in cluster2048_pool[%d]\n", - pool_used(&cluster_2048_pool), pool_size(&cluster_2048_pool)); - - if (pool_used(&cluster_8192_pool)) - d_error("%d not freed in cluster8192_pool[%d]", - pool_used(&cluster_8192_pool), pool_size(&cluster_8192_pool)); - d_trace(9, "%d not freed in cluster8192_pool[%d]\n", - pool_used(&cluster_8192_pool), pool_size(&cluster_8192_pool)); -} - -static clbuf_t* clbuf_alloc(c_uint16_t length); -static void clbuf_free(clbuf_t *clbuf); - -static clbuf_t* clbuf_alloc(c_uint16_t length) -{ - clbuf_t *clbuf = NULL; - c_uint8_t *cluster = NULL; - - pool_alloc_node(&clbuf_pool, &clbuf); - d_assert(clbuf, return NULL, "No more free clbuf. "); - - if (length <= 128) - { - pool_alloc_node(&cluster_128_pool, &cluster); - clbuf->size = SIZEOF_CLUSTER_128; - } - else if (length <= 256) - { - pool_alloc_node(&cluster_256_pool, &cluster); - clbuf->size = SIZEOF_CLUSTER_256; - } - else if (length <= 512) - { - pool_alloc_node(&cluster_512_pool, &cluster); - clbuf->size = SIZEOF_CLUSTER_512; - } - else if (length <= 1024) - { - pool_alloc_node(&cluster_1024_pool, &cluster); - clbuf->size = SIZEOF_CLUSTER_1024; - } - else if (length <= 2048) - { - pool_alloc_node(&cluster_2048_pool, &cluster); - clbuf->size = SIZEOF_CLUSTER_2048; - } - else if (length <= 8192) - { - pool_alloc_node(&cluster_8192_pool, &cluster); - clbuf->size = SIZEOF_CLUSTER_8192; - } - - d_assert(cluster, pool_free_node(&clbuf_pool, clbuf); return NULL, - "No more free cluster. length:%d requested", length); - - clbuf->ref = 0; - clbuf->cluster = cluster; - - return clbuf; -} - -static void clbuf_free(clbuf_t *clbuf) -{ - d_assert(clbuf, return, "Null param"); - d_assert(clbuf->cluster, return, "clbuf has no cluster"); - - switch (clbuf->size) - { - case SIZEOF_CLUSTER_128: - pool_free_node(&cluster_128_pool, clbuf->cluster); - break; - case SIZEOF_CLUSTER_256: - pool_free_node(&cluster_256_pool, clbuf->cluster); - break; - case SIZEOF_CLUSTER_512: - pool_free_node(&cluster_512_pool, clbuf->cluster); - break; - case SIZEOF_CLUSTER_1024: - pool_free_node(&cluster_1024_pool, clbuf->cluster); - break; - case SIZEOF_CLUSTER_2048: - pool_free_node(&cluster_2048_pool, clbuf->cluster); - break; - case SIZEOF_CLUSTER_8192: - pool_free_node(&cluster_8192_pool, clbuf->cluster); - break; - default: - d_assert(0, return, "clbuf has invalid size %d", clbuf->size); - break; - } - - pool_free_node(&clbuf_pool, clbuf); - - return; -} - -pkbuf_t* pkbuf_alloc(c_uint16_t headroom, c_uint16_t length) -{ - pkbuf_t *np = NULL, *pnp, *ret; - clbuf_t *clbuf = NULL; - c_uint16_t rem_length; - - d_assert(headroom <= MAX_SIZEOF_HEADROOM, return NULL, - "Max size of headroom is %d, but %d requested", - MAX_SIZEOF_HEADROOM, headroom); - - clbuf = clbuf_alloc(length); - d_assert(clbuf, return NULL, "Can't allocate clbuf(length:%d)", length); - - pool_alloc_node(&pkbuf_pool, &np); - d_assert(np, clbuf_free(clbuf); return NULL, "No more free pkbuf"); - ret = np; - - np->next = NULL; - np->clbuf = clbuf; - np->payload = (void*)CORE_ALIGN((c_uintptr_t)(clbuf->cluster + headroom), - BOUNDARY); - np->tot_len = length; - np->len = c_min(length, clbuf->size - (np->payload - clbuf->cluster)); - np->flags = 0; - clbuf->ref = 1; - - pnp = np; - rem_length = length - np->len; - - while (rem_length > 0) - { - clbuf = clbuf_alloc(rem_length); - d_assert(clbuf, break, "Can't allocate clbuf"); - - pool_alloc_node(&pkbuf_pool, &np); - d_assert(np, clbuf_free(clbuf); break, "No more free pkbuf"); - - /* Chaining */ - pnp->next = np; - - np->next = NULL; - np->clbuf = clbuf; - np->payload = clbuf->cluster; - np->tot_len = rem_length; - np->len = c_min(rem_length, clbuf->size); - np->flags = 0; - clbuf->ref = 1; - - pnp = np; - rem_length -= np->len; - } - - /* Abnormal break */ - if (rem_length > 0) - { - if (ret) - pkbuf_free(ret); - ret = NULL; - } - - return ret; -} - -status_t pkbuf_header(pkbuf_t *pkbuf, c_int16_t increment) -{ - clbuf_t *clbuf; - - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->clbuf, return CORE_ERROR, "pkbuf has no clbuf"); - d_assert(pkbuf->clbuf->cluster, return CORE_ERROR, "clbuf has no cluster"); - - clbuf = pkbuf->clbuf; - - /* No change */ - if (increment == 0) - return CORE_OK; - - if (increment > 0) - { - if (pkbuf->payload - clbuf->cluster < increment) - return CORE_ERROR; - } - else - { - if (pkbuf->len < -increment) - return CORE_ERROR; - } - - pkbuf->payload -= increment; - pkbuf->tot_len += increment; - pkbuf->len += increment; - - return CORE_OK; -} - -void pkbuf_free(pkbuf_t *pkbuf) -{ - pkbuf_t *p, *q; - - d_assert(pkbuf, return, "Null param"); - - p = pkbuf; - while (p) - { - d_assert(p->clbuf, return, "param 'pkbuf' has no clbuf"); - - q = p->next; - - mutex_lock(mutex); - p->clbuf->ref--; - mutex_unlock(mutex); - - if (p->clbuf->ref == 0) - clbuf_free(p->clbuf); - - pool_free_node(&pkbuf_pool, p); - - p = q; - } - - return; -} - -void pkbuf_join(pkbuf_t *h, pkbuf_t *t) -{ - pkbuf_t *p; - - d_assert(h, return, "Null param"); - d_assert(t, return, "Null param"); - - /* proceed to last pbuf of chain */ - for (p = h; p->next != NULL; p = p->next) - { - /* add total length of second chain to all totals of first chain */ - p->tot_len += t->tot_len; - } - - d_assert(p->tot_len == p->len, return, - "p->tot_len(%d) == p->len(%d) (of last pbuf in chain)", - p->tot_len, p->len); - - d_assert(p->next == NULL, return, "p->next == NULL"); - - /* add total length of second chain to last pbuf total of first chain */ - p->tot_len += t->tot_len; - - /* chain last pbuf of head (p) with first of tail (t) */ - p->next = t; - - /* p->next now references t, but the caller will drop its reference to t, - * so netto there is no change to the reference count of t. */ -} - -pkbuf_t* pkbuf_copy(pkbuf_t *pkbuf) -{ - pkbuf_t *p, *np, *pnp = NULL, *ret = NULL; - - d_assert(pkbuf, return NULL, "Null param"); - - p = pkbuf; - - while (p) - { - pool_alloc_node(&pkbuf_pool, &np); - d_assert(np, break, "No more free pkbuf. "); - if (ret == NULL) ret = np; - - if (pnp) - pnp->next = np; - - np->next = NULL; - np->clbuf = p->clbuf; - np->payload = p->payload; - np->tot_len = p->tot_len; - np->len = p->len; - np->flags = p->flags; - - mutex_lock(mutex); - p->clbuf->ref++; - mutex_unlock(mutex); - - pnp = np; - p = p->next; - } - - /* Abnormal break */ - if (p) - { - if (ret) - pkbuf_free(ret); - ret = NULL; - } - - return ret; -} - -pkbuf_t* pkbuf_copy_partial(pkbuf_t *pkbuf, c_uint16_t offset, c_uint16_t len) -{ - pkbuf_t *p, *np, *pnp = NULL, *ret = NULL; - c_uint16_t copied = 0, bytes = 0, skipped = 0; - - d_assert(pkbuf, return NULL, "Null param"); - - if (pkbuf->tot_len < offset + len) - return NULL; - - p = pkbuf; - - while (p) - { - bytes += p->len; - - if (bytes > offset) - { - pool_alloc_node(&pkbuf_pool, &np); - d_assert(np, break, "No more free pkbuf. "); - - /* First block */ - if (ret == NULL) - { - ret = np; - np->payload = p->payload + (offset - skipped); - np->tot_len = len; - np->len = p->len - (offset - skipped); - } - else - { - np->payload = p->payload; - np->tot_len = pnp->tot_len - pnp->len; - np->len = p->len; - } - - np->next = NULL; - np->flags = p->flags; - np->clbuf = p->clbuf; - - mutex_lock(mutex); - p->clbuf->ref++; - mutex_unlock(mutex); - - if (pnp) - pnp->next = np; - pnp = np; - - copied += np->len; - - /* Check the last block */ - if (copied >= len) - { - np->len -= copied - len; - break; - } - } - - skipped += p->len; - - p = p->next; - } - - /* Abnormal break */ - if (copied < len) - { - if (ret) - pkbuf_free(ret); - ret = NULL; - } - - return ret; -} - -status_t pkbuf_tobuf(pkbuf_t *pkbuf, void *buf, c_uint16_t *buflen) -{ - pkbuf_t *p; - c_uint16_t copied = 0; - - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(buf, return CORE_ERROR, "Null param"); - d_assert(buflen, return CORE_ERROR, "Null param"); - - if (pkbuf->tot_len > *buflen) - return CORE_ERROR; - - *buflen = 0; - - p = pkbuf; - - while (p) - { - d_assert(p->clbuf, return CORE_ERROR, "pkbuf has no clbuf"); - d_assert(p->clbuf->cluster, return CORE_ERROR, "clbuf has no cluster"); - - memcpy(buf + copied, p->payload, p->len); - copied += p->len; - - p = p->next; - } - - d_assert(copied == pkbuf->tot_len, return CORE_ERROR, - "Copy length isn't same with total length"); - - *buflen = copied; - - return CORE_OK;; -} - -status_t pkbuf_tobuf_partial(pkbuf_t *pkbuf, void *buf, c_uint16_t *buflen, - c_uint16_t offset, c_uint16_t len) -{ - - return CORE_OK; -} - -void *core_malloc(size_t size) -{ - c_uint16_t headroom = 0; - pkbuf_t *p = NULL; - - d_assert(size, return NULL, "if size == 0, then returns NULL"); - headroom = sizeof(pkbuf_t *); - p = pkbuf_alloc(headroom, size); - d_assert(p, return NULL, "pkbuf_alloc failed(headroom:%d, size:%d)", - headroom, size); - d_assert(p->next == NULL, pkbuf_free(p);return NULL, - "core_malloc should not be fragmented"); - - memcpy(p->payload - headroom, &p, headroom); - - return p->payload; -} - -status_t core_free(void *ptr) -{ - c_uint16_t headroom = sizeof(pkbuf_t *); - pkbuf_t *p = NULL; - - if (!ptr) - return CORE_OK; - - memcpy(&p, ptr - headroom, headroom); - d_assert(p, return CORE_ERROR, "Null param"); - - pkbuf_free(p); - - return CORE_OK; -} - -void *core_calloc(size_t nmemb, size_t size) -{ - void *ptr = NULL; - - ptr = core_malloc(nmemb * size); - d_assert(ptr, return NULL, "nmeb = %d, sizeo = %d", nmemb, size); - - memset(ptr, 0, nmemb * size); - return ptr; -} - -void *core_realloc(void *ptr, size_t size) -{ - c_uint16_t headroom = sizeof(pkbuf_t *); - pkbuf_t *p = NULL; - - if (!ptr) - { - return core_malloc(size); - } - - memcpy(&p, ptr - headroom, headroom); - d_assert(p, return NULL, "Null param"); - - if (!size) - { - pkbuf_free(p); - return NULL; - } - - d_assert(p->clbuf, return NULL, "Null param"); - if (size >= (p->clbuf->size - headroom)) - { - void *new = NULL; - - new = core_malloc(size); - d_assert(new, return NULL, "Null param"); - memcpy(new, ptr, p->len); - - pkbuf_free(p); - - return new; - } - else - { - p->tot_len = size; - p->len = c_min(size, p->clbuf->size - (p->payload - p->clbuf->cluster)); - return ptr; - } -} - -char *core_strdup(const char *s) -{ - char *res; - size_t len; - - if (s == NULL) - return NULL; - - len = strlen(s) + 1; - res = core_memdup(s, len); - return res; -} - -char *core_strndup(const char *s, size_t n) -{ - char *res; - const char *end; - - if (s == NULL) - return NULL; - - end = memchr(s, '\0', n); - if (end != NULL) - n = end - s; - res = core_malloc(n + 1); - memcpy(res, s, n); - res[n] = '\0'; - return res; -} - -void *core_memdup(const void *m, size_t n) -{ - void *res; - - if (m == NULL) - return NULL; - - res = core_malloc(n); - memcpy(res, m, n); - return res; -} diff --git a/lib/core/src/unix/rand.c b/lib/core/src/unix/rand.c deleted file mode 100644 index c4afe2e18..000000000 --- a/lib/core/src/unix/rand.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "core_errno.h" - -#define DEV_RANDOM "/dev/urandom" - -status_t core_generate_random_bytes(c_uint8_t *buf, int length) -{ - int fd = -1; - - /* On BSD/OS 4.1, /dev/random gives out 8 bytes at a time, then - * gives EOF, so reading 'length' bytes may require opening the - * device several times. */ - do { - int rc; - - if (fd == -1) - if ((fd = open(DEV_RANDOM, O_RDONLY)) == -1) - return errno; - - do { - rc = read(fd, buf, length); - } while (rc == -1 && errno == EINTR); - - if (rc < 0) { - int errnum = errno; - close(fd); - return errnum; - } - else if (rc == 0) { - close(fd); - fd = -1; /* force open() again */ - } - else { - buf += rc; - length -= rc; - } - } while (length > 0); - - close(fd); - - return CORE_OK; -} diff --git a/lib/core/src/unix/rwlock.c b/lib/core/src/unix/rwlock.c deleted file mode 100644 index 0416234da..000000000 --- a/lib/core/src/unix/rwlock.c +++ /dev/null @@ -1,102 +0,0 @@ -#include "core.h" -#include "core_rwlock.h" -#include "core_pool.h" -#include "core_debug.h" -#include "core_general.h" -#include "core_param.h" - -typedef struct _rwlock_t { - pthread_rwlock_t rwlock; -} rwlock_t; - -pool_declare(rwlock_pool, rwlock_t, MAX_NUM_OF_RWLOCK); - -status_t rwlock_init(void) -{ - pool_init(&rwlock_pool, MAX_NUM_OF_RWLOCK); - return CORE_OK; -} - -status_t rwlock_final(void) -{ - pool_final(&rwlock_pool); - return CORE_OK; -} - -status_t rwlock_create(rwlock_id *id) -{ - rwlock_t *new_rwlock; - status_t stat; - - pool_alloc_node(&rwlock_pool, &new_rwlock); - d_assert(new_rwlock, return CORE_ENOMEM, "rwlock_pool(%d) is not enough\n", - MAX_NUM_OF_RWLOCK); - - if ((stat = pthread_rwlock_init(&new_rwlock->rwlock, NULL))) - { - return stat; - } - - *id = (rwlock_id)new_rwlock; - return CORE_OK; -} - -status_t rwlock_rdlock(rwlock_id id) -{ - status_t stat; - rwlock_t *rwlock = (rwlock_t *)id; - - stat = pthread_rwlock_rdlock(&rwlock->rwlock); - return stat; -} - -status_t rwlock_tryrdlock(rwlock_id id) -{ - status_t stat; - rwlock_t *rwlock = (rwlock_t *)id; - - stat = pthread_rwlock_tryrdlock(&rwlock->rwlock); - /* Normalize the return code. */ - if (stat == EBUSY) - stat = CORE_EBUSY; - return stat; -} - -status_t rwlock_wrlock(rwlock_id id) -{ - status_t stat; - rwlock_t *rwlock = (rwlock_t *)id; - - stat = pthread_rwlock_wrlock(&rwlock->rwlock); - return stat; -} - -status_t rwlock_trywrlock(rwlock_id id) -{ - status_t stat; - rwlock_t *rwlock = (rwlock_t *)id; - - stat = pthread_rwlock_trywrlock(&rwlock->rwlock); - /* Normalize the return code. */ - if (stat == EBUSY) - stat = CORE_EBUSY; - return stat; -} - -status_t rwlock_unlock(rwlock_id id) -{ - status_t stat; - rwlock_t *rwlock = (rwlock_t *)id; - - stat = pthread_rwlock_unlock(&rwlock->rwlock); - return stat; -} - -status_t rwlock_delete(rwlock_id id) -{ - status_t stat; - rwlock_t *rwlock = (rwlock_t *)id; - - stat = pthread_rwlock_destroy(&rwlock->rwlock); - return stat; -} diff --git a/lib/core/src/unix/sctp.c b/lib/core/src/unix/sctp.c deleted file mode 100644 index d48fc39eb..000000000 --- a/lib/core/src/unix/sctp.c +++ /dev/null @@ -1,430 +0,0 @@ -#define TRACE_MODULE _sctp - -#include "core_debug.h" -#include "core_arch_network.h" - -#if HAVE_NETINET_SCTP_H -#include -#endif - -static status_t subscribe_to_events(sock_id id); -static status_t set_paddrparams(sock_id id, c_uint32_t spp_hbinterval); -static status_t set_rtoinfo(sock_id id, - c_uint32_t srto_initial, c_uint32_t srto_min, c_uint32_t srto_max); -static status_t set_initmsg(sock_id id, - c_uint32_t sinit_num_ostreams, c_uint32_t sinit_max_instreams, - c_uint32_t sinit_max_attempts, c_uint32_t sinit_max_init_timeo); - -static int sctp_num_ostreams = -1; - -void sctp_set_num_ostreams(int sctp_streams) -{ - sctp_num_ostreams = sctp_streams; -} - -status_t sctp_socket(sock_id *new, int family, int type) -{ - status_t rv; - - rv = sock_socket(new, family, type, IPPROTO_SCTP); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - rv = subscribe_to_events(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - /* heartbit interval : 5 secs */ - rv = set_paddrparams(*new, 5000); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - /* - * RTO info - * - * initial : 3 secs - * min : 1 sec - * max : 5 secs - */ - rv = set_rtoinfo(*new, 3000, 1000, 5000); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - /* - * INITMSG - * - * max number of input streams : 65535 - * max attemtps : 4 - * max initial timeout : 8 secs - */ - rv = set_initmsg(*new, sctp_num_ostreams, 65535, 4, 8000); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; -} - -status_t sctp_server(sock_id *new, int type, c_sockaddr_t *sa_list) -{ - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - addr = sa_list; - while(addr) - { - rv = sctp_socket(new, addr->c_sa_family, type); - if (rv == CORE_OK) - { - d_assert(sock_setsockopt(*new, SOCK_O_REUSEADDR, 1) == CORE_OK, - return CORE_ERROR, - "setsockopt [%s]:%d failed(%d:%s)", - CORE_ADDR(addr, buf), CORE_PORT(addr), - errno, strerror(errno)); - - if (sock_bind(*new, addr) == CORE_OK) - { - d_trace(1, "sctp_server() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - rv = sock_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("sctp_server() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - rv = sock_listen(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; -} - -status_t sctp_client(sock_id *new, int type, c_sockaddr_t *sa_list) -{ - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - addr = sa_list; - while(addr) - { - rv = sctp_socket(new, addr->c_sa_family, type); - if (rv == CORE_OK) - { - if (sock_connect(*new, addr) == CORE_OK) - { - d_trace(1, "sctp_client() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - rv = sock_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("sctp_client() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} - -status_t sctp_connect(sock_id id, c_sockaddr_t *sa_list) -{ - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - d_assert(id, return CORE_ERROR,); - - addr = sa_list; - while(addr) - { - if (sock_connect(id, addr) == CORE_OK) - { - d_trace(1, "sctp_connect() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("sctp_connect() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} - -int core_sctp_sendmsg(sock_id id, const void *msg, size_t len, - c_sockaddr_t *to, c_uint32_t ppid, c_uint16_t stream_no) -{ - sock_t *sock = (sock_t *)id; - int size; - socklen_t addrlen = 0; - - d_assert(id, return -1, ); - - if (to) - addrlen = sockaddr_len(to); - - size = sctp_sendmsg(sock->fd, msg, len, - to ? &to->sa : NULL, addrlen, - htonl(ppid), - 0, /* flags */ - stream_no, - 0, /* timetolive */ - 0); /* context */ - if (size < 0) - { - d_error("sctp_sendmsg(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -int core_sctp_recvmsg(sock_id id, void *msg, size_t len, - c_sockaddr_t *from, sctp_info_t *sinfo, int *msg_flags) -{ - sock_t *sock = (sock_t *)id; - int size; - socklen_t addrlen = sizeof(struct sockaddr_storage); - - int flags = 0; - struct sctp_sndrcvinfo sndrcvinfo; - - d_assert(id, return -1,); - - size = sctp_recvmsg(sock->fd, msg, len, - from ? &from->sa : NULL, from ? &addrlen : NULL, - &sndrcvinfo, &flags); - if (size < 0) - { - d_error("sctp_recvmsg(%d) failed(%d:%s)", - size, errno, strerror(errno)); - return size; - } - - if (msg_flags) - { - *msg_flags = flags; - } - - if (sinfo) - { - sinfo->ppid = ntohl(sndrcvinfo.sinfo_ppid); - sinfo->stream_no = sndrcvinfo.sinfo_stream; - } - - return size; -} - -int core_sctp_recvdata(sock_id id, void *msg, size_t len, - c_sockaddr_t *from, sctp_info_t *sinfo) -{ - int size; - int flags = 0; - - do - { - size = core_sctp_recvmsg(id, msg, len, from, sinfo, &flags); - if (size < 0) - { - d_error("core_sctp_recvdata(%d) failed(%d:%s)", - size, errno, strerror(errno)); - return size; - } - - if (flags & MSG_NOTIFICATION) - { - /* Nothing */ - } - else if (flags & MSG_EOR) - { - break; - } - else - { - d_assert(0, return -1,); - } - - } while(1); - - return size; -} - -static status_t subscribe_to_events(sock_id id) -{ - sock_t *sock = (sock_t *)id; - struct sctp_event_subscribe event; - - d_assert(id, return CORE_ERROR,); - - memset(&event, 0, sizeof(event)); - event.sctp_data_io_event = 1; - event.sctp_association_event = 1; - event.sctp_send_failure_event = 1; - event.sctp_shutdown_event = 1; - - if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_EVENTS, - &event, sizeof( event)) != 0 ) - { - d_error("Unable to subscribe to SCTP events: (%d:%s)", - errno, strerror( errno )); - return CORE_ERROR; - } - - return CORE_OK; -} - -static status_t set_paddrparams(sock_id id, c_uint32_t spp_hbinterval) -{ - sock_t *sock = (sock_t *)id; - struct sctp_paddrparams heartbeat; - socklen_t socklen; - - d_assert(id, return CORE_ERROR,); - - memset(&heartbeat, 0, sizeof(heartbeat)); - socklen = sizeof(heartbeat); - if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, - &heartbeat, &socklen) != 0 ) - { - d_error("getsockopt for SCTP_PEER_ADDR failed(%d:%s)", - errno, strerror(errno)); - return CORE_ERROR; - } - - d_trace(3,"Old spp _flags = 0x%x hbinter = %d pathmax = %d\n", - heartbeat.spp_flags, - heartbeat.spp_hbinterval, - heartbeat.spp_pathmaxrxt); - - heartbeat.spp_hbinterval = spp_hbinterval; - - if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, - &heartbeat, sizeof( heartbeat)) != 0 ) - { - d_error("setsockopt for SCTP_PEER_ADDR_PARAMS failed(%d:%s)", - errno, strerror(errno)); - return CORE_ERROR; - } - - d_trace(3,"New spp _flags = 0x%x hbinter = %d pathmax = %d\n", - heartbeat.spp_flags, - heartbeat.spp_hbinterval, - heartbeat.spp_pathmaxrxt); - - return CORE_OK; -} - -static status_t set_rtoinfo(sock_id id, - c_uint32_t srto_initial, c_uint32_t srto_min, c_uint32_t srto_max) -{ - sock_t *sock = (sock_t *)id; - struct sctp_rtoinfo rtoinfo; - socklen_t socklen; - - d_assert(id, return CORE_ERROR,); - - memset(&rtoinfo, 0, sizeof(rtoinfo)); - socklen = sizeof(rtoinfo); - if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_RTOINFO, - &rtoinfo, &socklen) != 0 ) - { - d_error("getsockopt for SCTP_RTOINFO failed(%d:%s)", - errno, strerror( errno )); - return CORE_ERROR; - } - - d_trace(3,"Old RTO (initial:%d max:%d min:%d)\n", - rtoinfo.srto_initial, - rtoinfo.srto_max, - rtoinfo.srto_min); - - rtoinfo.srto_initial = srto_initial; - rtoinfo.srto_min = srto_min; - rtoinfo.srto_max = srto_max; - - if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_RTOINFO, - &rtoinfo, sizeof(rtoinfo)) != 0 ) - { - d_error("setsockopt for SCTP_RTOINFO failed(%d:%s)", - errno, strerror( errno )); - return CORE_ERROR; - } - d_trace(3,"New RTO (initial:%d max:%d min:%d)\n", - rtoinfo.srto_initial, - rtoinfo.srto_max, - rtoinfo.srto_min); - - return CORE_OK; -} - -static status_t set_initmsg(sock_id id, - c_uint32_t sinit_num_ostreams, c_uint32_t sinit_max_instreams, - c_uint32_t sinit_max_attempts, c_uint32_t sinit_max_init_timeo) -{ - sock_t *sock = (sock_t *)id; - struct sctp_initmsg initmsg; - socklen_t socklen; - - d_assert(id, return CORE_ERROR,); - d_assert(sinit_num_ostreams > 1, return CORE_ERROR, - "Invalid SCTP number of output streams = %d\n", sctp_num_ostreams); - - memset(&initmsg, 0, sizeof(initmsg)); - socklen = sizeof(initmsg); - if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_INITMSG, - &initmsg, &socklen) != 0 ) - { - d_error("getsockopt for SCTP_INITMSG failed(%d:%s)", - errno, strerror( errno )); - return CORE_ERROR; - } - - d_trace(3,"Old INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)\n", - initmsg.sinit_num_ostreams, - initmsg.sinit_max_instreams, - initmsg.sinit_max_attempts, - initmsg.sinit_max_init_timeo); - - initmsg.sinit_num_ostreams = sinit_num_ostreams; - initmsg.sinit_max_instreams = sinit_max_instreams; - initmsg.sinit_max_attempts = sinit_max_attempts; - initmsg.sinit_max_init_timeo = sinit_max_init_timeo; - - if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_INITMSG, - &initmsg, sizeof(initmsg)) != 0 ) - { - d_error("setsockopt for SCTP_INITMSG failed(%d:%s)", - errno, strerror( errno )); - return CORE_ERROR; - } - - d_trace(3,"New INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)\n", - initmsg.sinit_num_ostreams, - initmsg.sinit_max_instreams, - initmsg.sinit_max_attempts, - initmsg.sinit_max_init_timeo); - - return CORE_OK; -} diff --git a/lib/core/src/unix/semaphore.c b/lib/core/src/unix/semaphore.c deleted file mode 100644 index 7a4f95b6f..000000000 --- a/lib/core/src/unix/semaphore.c +++ /dev/null @@ -1,96 +0,0 @@ -#include "core.h" -#include "core_arch_semaphore.h" -#include "core_errno.h" -#include "core_param.h" -#include "core_general.h" -#include "core_debug.h" -#include "core_pool.h" - -pool_declare(semaphore_pool, semaphore_t, MAX_NUM_OF_SEMAPHORE); - -status_t semaphore_init(void) -{ - pool_init(&semaphore_pool, MAX_NUM_OF_SEMAPHORE); - return CORE_OK; -} - -status_t semaphore_final(void) -{ - pool_final(&semaphore_pool); - return CORE_OK; -} - -status_t semaphore_create(semaphore_id *id, c_uint32_t value) -{ - semaphore_t *new_semaphore; - c_time_t now = time_now(); - char semname[64]; - - pool_alloc_node(&semaphore_pool, &new_semaphore); - d_assert(new_semaphore, return CORE_ENOMEM, - "semaphore_pool(%d) is not enough\n", - MAX_NUM_OF_SEMAPHORE); - - sprintf(semname, "/CoRe%" C_UINT64_T_HEX_FMT, now); - - new_semaphore->semaphore = sem_open(semname, O_CREAT | O_EXCL, 0644, value); - if (new_semaphore->semaphore == (sem_t *)SEM_FAILED) - { - return CORE_ERROR; - } - - sem_unlink(semname); - - *id = (semaphore_id)new_semaphore; - return CORE_OK; -} - -status_t semaphore_wait(semaphore_id id) -{ - status_t rv; - semaphore_t *semaphore = (semaphore_t *)id; - - rv = sem_wait(semaphore->semaphore); - return rv; -} - -#if HAVE_SEM_TIMEDWAIT -status_t semaphore_timedwait(semaphore_id id, c_time_t timeout) -{ - status_t rv; - c_time_t then; - struct timespec abstime; - semaphore_t *semaphore = (semaphore_t *)id; - - then = time_now() + timeout; - abstime.tv_sec = time_sec(then); - abstime.tv_nsec = time_usec(then) * 1000; /* nanosesemaphores */ - - rv = sem_timedwait(semaphore->semaphore, &abstime); - if (rv == -1 && ETIMEDOUT == errno) - { - return CORE_TIMEUP; - } - return rv; -} -#endif - -status_t semaphore_post(semaphore_id id) -{ - status_t rv; - semaphore_t *semaphore = (semaphore_t *)id; - - rv = sem_post(semaphore->semaphore); - return rv; -} - -status_t semaphore_delete(semaphore_id id) -{ - status_t rv; - semaphore_t *semaphore = (semaphore_t *)id; - - rv = sem_close(semaphore->semaphore); - pool_free_node(&semaphore_pool, semaphore); - - return rv; -} diff --git a/lib/core/src/unix/signal.c b/lib/core/src/unix/signal.c deleted file mode 100644 index 6c6e24eaf..000000000 --- a/lib/core/src/unix/signal.c +++ /dev/null @@ -1,296 +0,0 @@ -#include "core.h" -#include "core_signal.h" - -CORE_DECLARE(status_t) core_kill(pid_t pid, int signum) -{ -#ifdef OS2 - /* SIGTERM's don't work too well in OS/2 (only affects other EMX - * programs). CGIs may not be, esp. REXX scripts, so use a native - * call instead - */ - if (signum == SIGTERM) { - return APR_FROM_OS_ERROR(DosSendSignalException(pid, - XCPT_SIGNAL_BREAK)); - } -#endif /* OS2 */ - - if (kill(pid, signum) == -1) { - return errno; - } - - return CORE_OK; -} - -#if HAVE_SIGACTION - -#if defined(__NetBSD__) || defined(DARWIN) -static void avoid_zombies(int signo) -{ - int exit_status; - - while (waitpid(-1, &exit_status, WNOHANG) > 0) { - /* do nothing */ - } -} -#endif /* DARWIN */ - -/* - * Replace standard signal() with the more reliable sigaction equivalent - * from W. Richard Stevens' "Advanced Programming in the UNIX Environment" - * (the version that does not automatically restart system calls). - */ -core_sigfunc_t *core_signal(int signo, core_sigfunc_t *func) -{ - struct sigaction act, oact; - - act.sa_handler = func; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; -#ifdef SA_INTERRUPT /* SunOS */ - act.sa_flags |= SA_INTERRUPT; -#endif -#if defined(__osf__) && defined(__alpha) - /* XXX jeff thinks this should be enabled whenever SA_NOCLDWAIT is defined */ - - /* this is required on Tru64 to cause child processes to - * disappear gracefully - XPG4 compatible - */ - if ((signo == SIGCHLD) && (func == SIG_IGN)) - { - act.sa_flags |= SA_NOCLDWAIT; - } -#endif -#if defined(__NetBSD__) || defined(DARWIN) - /* ignoring SIGCHLD or leaving the default disposition doesn't avoid zombies, - * and there is no SA_NOCLDWAIT flag, so catch the signal and reap status in - * the handler to avoid zombies - */ - if ((signo == SIGCHLD) && (func == SIG_IGN)) - { - act.sa_handler = avoid_zombies; - } -#endif - if (sigaction(signo, &act, &oact) < 0) - return SIG_ERR; - return oact.sa_handler; -} - -#endif - -static void remove_sync_sigs(sigset_t *sig_mask) -{ -#ifdef SIGABRT - sigdelset(sig_mask, SIGABRT); -#endif -#ifdef SIGBUS - sigdelset(sig_mask, SIGBUS); -#endif -#ifdef SIGEMT - sigdelset(sig_mask, SIGEMT); -#endif -#ifdef SIGFPE - sigdelset(sig_mask, SIGFPE); -#endif -#ifdef SIGILL - sigdelset(sig_mask, SIGILL); -#endif -#ifdef SIGIOT - sigdelset(sig_mask, SIGIOT); -#endif -#ifdef SIGPIPE - sigdelset(sig_mask, SIGPIPE); -#endif -#ifdef SIGSEGV - sigdelset(sig_mask, SIGSEGV); -#endif -#ifdef SIGSYS - sigdelset(sig_mask, SIGSYS); -#endif -#ifdef SIGTRAP - sigdelset(sig_mask, SIGTRAP); -#endif -#ifdef SIGCHLD - sigdelset(sig_mask, SIGCHLD); -#endif -#ifdef SIGWINCH - sigdelset(sig_mask, SIGWINCH); -#endif - -/* the rest of the signals removed from the mask in this function - * absolutely must be removed; you cannot block synchronous signals - * (requirement of pthreads API) - * - * SIGUSR2 is being removed from the mask for the convenience of - * Purify users (Solaris, HP-UX, SGI) since Purify uses SIGUSR2 - */ -#ifdef SIGUSR2 - sigdelset(sig_mask, SIGUSR2); -#endif -} - -status_t signal_thread(int (*signal_handler)(int signum)) -{ - sigset_t sig_mask; - int (*sig_func)(int signum) = (int (*)(int))signal_handler; - - /* This thread will be the one responsible for handling signals */ - sigfillset(&sig_mask); - - /* On certain platforms, sigwait() returns EINVAL if any of various - * unblockable signals are included in the mask. This was first - * observed on AIX and Tru64. - */ -#ifdef SIGKILL - sigdelset(&sig_mask, SIGKILL); -#endif -#ifdef SIGSTOP - sigdelset(&sig_mask, SIGSTOP); -#endif -#ifdef SIGCONT - sigdelset(&sig_mask, SIGCONT); -#endif -#ifdef SIGWAITING - sigdelset(&sig_mask, SIGWAITING); -#endif - - /* no synchronous signals should be in the mask passed to sigwait() */ - remove_sync_sigs(&sig_mask); - - /* On AIX (4.3.3, at least), sigwait() won't wake up if the high- - * order bit of the second word of flags is turned on. sigdelset() - * returns an error when trying to turn this off, so we'll turn it - * off manually. - * - * Note that the private fields differ between 32-bit and 64-bit - * and even between _ALL_SOURCE and !_ALL_SOURCE. Except that on - * AIX 4.3 32-bit builds and 64-bit builds use the same definition. - * - * Applicable AIX fixes such that this is no longer needed: - * - * APAR IY23096 for AIX 51B, fix included in AIX 51C, and - * APAR IY24162 for 43X. - */ -#if defined(_AIX) -#if defined(__64BIT__) && defined(_AIXVERSION_510) -#ifdef _ALL_SOURCE - sig_mask.ss_set[3] &= 0x7FFFFFFF; -#else /* not _ALL_SOURCE */ - sig_mask.__ss_set[3] &= 0x7FFFFFFF; -#endif -#else /* not 64-bit build, or 64-bit build on 4.3 */ -#ifdef _ALL_SOURCE - sig_mask.hisigs &= 0x7FFFFFFF; -#else /* not _ALL_SOURCE */ - sig_mask.__hisigs &= 0x7FFFFFFF; -#endif -#endif -#endif /* _AIX */ - - while (1) { -#if HAVE_SIGWAIT - int signal_received; - - if (sigwait(&sig_mask, &signal_received) != 0) - { - /* handle sigwait() error here */ - } - - if (sig_func(signal_received) == 1) - { - return CORE_OK; - } -#elif HAVE_SIGSUSPEND - sigsuspend(&sig_mask); -#else -#error No sigwait() and no sigsuspend() -#endif - } -} - -status_t signal_init(void) -{ - sigset_t sig_mask; - int rv; - - /* All threads should mask out signals to be handled by - * the thread doing sigwait(). - * - * No thread should ever block synchronous signals. - * See the Solaris man page for pthread_sigmask() for - * some information. Solaris chooses to knock out such - * processes when a blocked synchronous signal is - * delivered, skipping any registered signal handler. - * AIX doesn't call a signal handler either. At least - * one level of linux+glibc does call the handler even - * when the synchronous signal is blocked. - */ - sigfillset(&sig_mask); - remove_sync_sigs(&sig_mask); - -#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS - if ((rv = sigprocmask(SIG_SETMASK, &sig_mask, NULL)) != 0) { - rv = errno; - } -#else - if ((rv = pthread_sigmask(SIG_SETMASK, &sig_mask, NULL)) != 0) { -#ifdef HAVE_ZOS_PTHREADS - rv = errno; -#endif - } -#endif - return rv; -} - -status_t signal_block(int signum) -{ -#if HAVE_SIGACTION - sigset_t sig_mask; - int rv; - - sigemptyset(&sig_mask); - - sigaddset(&sig_mask, signum); - -#if defined(SIGPROCMASK_SETS_THREAD_MASK) - if ((rv = sigprocmask(SIG_BLOCK, &sig_mask, NULL)) != 0) { - rv = errno; - } -#else - if ((rv = pthread_sigmask(SIG_BLOCK, &sig_mask, NULL)) != 0) { -#ifdef HAVE_ZOS_PTHREADS - rv = errno; -#endif - } -#endif - return rv; -#else - return CORE_ENOTIMPL; -#endif -} - -status_t signal_unblock(int signum) -{ -#if HAVE_SIGACTION - sigset_t sig_mask; - int rv; - - sigemptyset(&sig_mask); - - sigaddset(&sig_mask, signum); - -#if defined(SIGPROCMASK_SETS_THREAD_MASK) - if ((rv = sigprocmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) { - rv = errno; - } -#else - if ((rv = pthread_sigmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) { -#ifdef HAVE_ZOS_PTHREADS - rv = errno; -#endif - } -#endif - return rv; -#else - return CORE_ENOTIMPL; -#endif -} diff --git a/lib/core/src/unix/sockaddr.c b/lib/core/src/unix/sockaddr.c deleted file mode 100644 index ac8b70624..000000000 --- a/lib/core/src/unix/sockaddr.c +++ /dev/null @@ -1,545 +0,0 @@ -#define TRACE_MODULE _sockaddr - -#include "core_debug.h" -#include "core_lib.h" -#include "core_pkbuf.h" - -#include "core_arch_network.h" - -status_t core_getaddrinfo(c_sockaddr_t **sa_list, - int family, const char *hostname, c_uint16_t port, int flags) -{ - *sa_list = NULL; - return core_addaddrinfo(sa_list, family, hostname, port, flags); -} - -status_t core_freeaddrinfo(c_sockaddr_t *sa_list) -{ - c_sockaddr_t *next = NULL, *addr = NULL; - - addr = sa_list; - while(addr) - { - next = addr->next; - CORE_FREE(addr); - addr = next; - } - - return CORE_OK; -} - -status_t core_addaddrinfo(c_sockaddr_t **sa_list, - int family, const char *hostname, c_uint16_t port, int flags) -{ - int rc; - char service[NI_MAXSERV]; - struct addrinfo hints, *ai, *ai_list; - c_sockaddr_t *prev; - char buf[CORE_ADDRSTRLEN]; - - d_assert(sa_list, return CORE_ERROR,); - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = family; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = flags; - - snprintf(service, sizeof(service), "%u", port); - - rc = getaddrinfo(hostname, service, &hints, &ai_list); - if (rc != 0) - { - d_error("getaddrinfo(%d:%s:%d:0x%x) failed(%d:%s)", - family, hostname, port, flags, errno, strerror(errno)); - return CORE_ERROR; - } - - prev = NULL; - if (*sa_list) - { - prev = *sa_list; - while(prev->next) prev = prev->next; - } - for (ai = ai_list; ai; ai = ai->ai_next) - { - c_sockaddr_t *new; - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) - continue; - - new = core_calloc(1, sizeof(c_sockaddr_t)); - memcpy(&new->sa, ai->ai_addr, ai->ai_addrlen); - new->c_sa_port = htons(port); - d_trace(3, "addr:%s, port:%d\n", CORE_ADDR(new, buf), port); - - if (!prev) - *sa_list = new; - else - prev->next = new; - - prev = new; - } - - freeaddrinfo(ai_list); - - if (prev == NULL) - { - d_error("core_getaddrinfo(%d:%s:%d:%d) failed(%d:%s)", - family, hostname, port, flags, errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} - -status_t core_filteraddrinfo(c_sockaddr_t **sa_list, int family) -{ - c_sockaddr_t *addr = NULL, *prev = NULL, *next = NULL; - - d_assert(sa_list, return CORE_ERROR,); - - prev = NULL; - addr = *sa_list; - while(addr) - { - next = addr->next; - - if (addr->c_sa_family != family) - { - if (prev) - prev->next = addr->next; - else - *sa_list = addr->next; - CORE_FREE(addr); - - } - else - { - prev = addr; - } - - addr = next; - } - - return CORE_OK; -} - -status_t core_copyaddrinfo(c_sockaddr_t **dst, const c_sockaddr_t *src) -{ - c_sockaddr_t *d; - const c_sockaddr_t *s; - - for (*dst = d = NULL, s = src; s; s = s->next) - { - if (!d) - { - d = core_calloc(1, sizeof *s); - *dst = memcpy(d, s, sizeof *s); - } - else - { - d->next = core_calloc(1, sizeof(c_sockaddr_t)); - d = memcpy(d->next, s, sizeof *s); - } - } - return CORE_OK; -} - -status_t core_sortaddrinfo(c_sockaddr_t **sa_list, int family) -{ - c_sockaddr_t *head = NULL, *addr = NULL, *new = NULL, *old = NULL; - - d_assert(sa_list, return CORE_ERROR,); - - old = *sa_list; - while(old) - { - addr = old; - - old = old->next; - - if (head == NULL || addr->c_sa_family == family) - { - addr->next = head; - head = addr; - } - else - { - new = head; - while(new->next != NULL && new->next->c_sa_family != family) - { - new = new->next; - } - addr->next = new->next; - new->next = addr; - } - } - - *sa_list = head; - - return CORE_OK; -} - -c_sockaddr_t *core_link_local_addr_by_dev(const char *dev) -{ - struct ifaddrs *iflist, *cur; - int rc; - - d_assert(dev, return NULL,); - - rc = getifaddrs(&iflist); - if (rc != 0) - { - d_error("getifaddrs failed(%d:%s)", errno, strerror(errno)); - return NULL; - } - - for (cur = iflist; cur != NULL; cur = cur->ifa_next) - { - c_sockaddr_t *addr = NULL; - - if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */ - continue; - - if (strcmp(dev, cur->ifa_name) != 0) - continue; - - if (cur->ifa_addr->sa_family == AF_INET) - continue; - - addr = (c_sockaddr_t *)cur->ifa_addr; - if (!IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr)) - continue; - - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, return NULL,); - memcpy(&addr->sa, cur->ifa_addr, sockaddr_len(cur->ifa_addr)); - - freeifaddrs(iflist); - return addr; - } - - freeifaddrs(iflist); - return NULL; -} - -const char *core_inet_ntop(void *sa, char *buf, int buflen) -{ - int family; - c_sockaddr_t *sockaddr = NULL; - - d_assert(buf, return NULL,); - sockaddr = sa; - d_assert(sockaddr, return NULL,); - - family = sockaddr->c_sa_family; - switch(family) - { - case AF_INET: - d_assert(buflen >= INET_ADDRSTRLEN, return NULL,); - return inet_ntop(family, - &sockaddr->sin.sin_addr, buf, INET_ADDRSTRLEN); - case AF_INET6: - d_assert(buflen >= CORE_ADDRSTRLEN, return NULL,); - return inet_ntop(family, - &sockaddr->sin6.sin6_addr, buf, INET6_ADDRSTRLEN); - default: - d_assert(0, return NULL, "Unknown family(%d)", family); - } -} - -status_t core_inet_pton(int family, const char *src, void *sa) -{ - c_sockaddr_t *dst = NULL; - - d_assert(src, return CORE_ERROR,); - dst = sa; - d_assert(dst, return CORE_ERROR,); - - dst->c_sa_family = family; - switch(family) - { - case AF_INET: - return inet_pton(family, src, &dst->sin.sin_addr) == 1 ? - CORE_OK : CORE_ERROR; - case AF_INET6: - return inet_pton(family, src, &dst->sin6.sin6_addr) == 1 ? - CORE_OK : CORE_ERROR; - default: - d_assert(0, return CORE_ERROR, "Unknown family(%d)", family); - } -} - -socklen_t sockaddr_len(const void *sa) -{ - const c_sockaddr_t *sockaddr = sa; - - d_assert(sa, return 0,); - - switch(sockaddr->c_sa_family) - { - case AF_INET: - return sizeof(struct sockaddr_in); - case AF_INET6: - return sizeof(struct sockaddr_in6); - default: - d_assert(0, return 0, "Unknown family(%d)", sockaddr->c_sa_family); - } -} - -int sockaddr_is_equal(void *p, void *q) -{ - c_sockaddr_t *a, *b; - - a = p; - d_assert(a, return 0,); - b = q; - d_assert(b, return 0,); - - if (a->c_sa_family != b->c_sa_family) - return 0; - - if (a->c_sa_family == AF_INET && memcmp( - &a->sin.sin_addr, &b->sin.sin_addr, sizeof(struct in_addr)) == 0) - return 1; - else if (a->c_sa_family == AF_INET6 && memcmp( - &a->sin6.sin6_addr, &b->sin6.sin6_addr, sizeof(struct in6_addr)) == 0) - return 1; - else - d_assert(0, return 0, "Unknown family(%d)", a->c_sa_family); - - return 0; -} - -static status_t parse_network(ipsubnet_t *ipsub, const char *network) -{ - /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */ - int shift; - char *s, *t; - int octet; - char buf[sizeof "255.255.255.255"]; - - if (strlen(network) < sizeof buf) - { - strcpy(buf, network); - } - else - { - return CORE_EBADIP; - } - - /* parse components */ - s = buf; - ipsub->sub[0] = 0; - ipsub->mask[0] = 0; - shift = 24; - while (*s) - { - t = s; - if (!c_isdigit(*t)) - { - return CORE_EBADIP; - } - while (c_isdigit(*t)) - { - ++t; - } - if (*t == '.') - { - *t++ = 0; - } - else if (*t) - { - return CORE_EBADIP; - } - if (shift < 0) - { - return CORE_EBADIP; - } - octet = atoi(s); - if (octet < 0 || octet > 255) - { - return CORE_EBADIP; - } - ipsub->sub[0] |= octet << shift; - ipsub->mask[0] |= 0xFFUL << shift; - s = t; - shift -= 8; - } - ipsub->sub[0] = ntohl(ipsub->sub[0]); - ipsub->mask[0] = ntohl(ipsub->mask[0]); - ipsub->family = AF_INET; - return CORE_OK; -} - -/* return values: - * CORE_EINVAL not an IP address; caller should see - * if it is something else - * CORE_BADIP IP address portion is is not valid - * CORE_BADMASK mask portion is not valid - */ -static status_t parse_ip( - ipsubnet_t *ipsub, const char *ipstr, int network_allowed) -{ - /* supported flavors of IP: - * - * . IPv6 numeric address string (e.g., "fe80::1") - * - * IMPORTANT: Don't store IPv4-mapped IPv6 address as an IPv6 address. - * - * . IPv4 numeric address string (e.g., "127.0.0.1") - * - * . IPv4 network string (e.g., "9.67") - * - * IMPORTANT: This network form is only allowed if network_allowed is on. - */ - int rc; - - rc = inet_pton(AF_INET6, ipstr, ipsub->sub); - if (rc == 1) - { - if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ipsub->sub)) - { - /* ipsubnet_test() assumes that we don't create IPv4-mapped IPv6 - * addresses; this of course forces the user to specify - * IPv4 addresses in a.b.c.d style instead of ::ffff:a.b.c.d style. - */ - d_error("Cannot support IPv4-mapped IPv6: " - "Use IPv4 address in a.b.c.d style " - "instead of ::ffff:a.b.c.d style"); - return CORE_EBADIP; - } - ipsub->family = AF_INET6; - } - else - { - rc = inet_pton(AF_INET, ipstr, ipsub->sub); - if (rc == 1) - { - ipsub->family = AF_INET; - } - } - if (rc != 1) - { - if (network_allowed) - { - return parse_network(ipsub, ipstr); - } - else - { - return CORE_EBADIP; - } - } - return CORE_OK; -} - -static int looks_like_ip(const char *ipstr) -{ - if (strlen(ipstr) == 0) - { - return 0; - } - - if (strchr(ipstr, ':')) - { - /* definitely not a hostname; - * assume it is intended to be an IPv6 address */ - return 1; - } - - /* simple IPv4 address string check */ - while ((*ipstr == '.') || c_isdigit(*ipstr)) - ipstr++; - return (*ipstr == '\0'); -} - -static void fix_subnet(ipsubnet_t *ipsub) -{ - /* in case caller specified more bits in network address than are - * valid according to the mask, turn off the extra bits - */ - int i; - - for (i = 0; i < sizeof ipsub->mask / sizeof(c_int32_t); i++) - { - ipsub->sub[i] &= ipsub->mask[i]; - } -} - -/* be sure not to store any IPv4 address as a v4-mapped IPv6 address */ -CORE_DECLARE(status_t) core_ipsubnet( - ipsubnet_t *ipsub, const char *ipstr, const char *mask_or_numbits) -{ - status_t rv; - char *endptr; - long bits, maxbits = 32; - - d_assert(ipsub, return CORE_ERROR,); - d_assert(ipstr, return CORE_ERROR,); - - /* filter out stuff which doesn't look remotely like an IP address; - * this helps callers like mod_access which have a syntax allowing - * hostname or IP address; - * CORE_EINVAL tells the caller that it was probably not intended - * to be an IP address - */ - if (!looks_like_ip(ipstr)) - { - d_error("looks_like_ip() is failed"); - return CORE_EINVAL; - } - - /* assume ipstr is an individual IP address, not a subnet */ - memset(ipsub->mask, 0xFF, sizeof ipsub->mask); - - rv = parse_ip(ipsub, ipstr, mask_or_numbits == NULL); - if (rv != CORE_OK) - { - d_error("parse_ip() is failed"); - return rv; - } - - if (mask_or_numbits) - { - if (ipsub->family == AF_INET6) - { - maxbits = 128; - } - bits = strtol(mask_or_numbits, &endptr, 10); - if (*endptr == '\0' && bits > 0 && bits <= maxbits) - { - /* valid num-bits string; fill in mask appropriately */ - int cur_entry = 0; - c_int32_t cur_bit_value; - - memset(ipsub->mask, 0, sizeof ipsub->mask); - while (bits > 32) - { - ipsub->mask[cur_entry] = 0xFFFFFFFF; /* all 32 bits */ - bits -= 32; - ++cur_entry; - } - cur_bit_value = 0x80000000; - while (bits) - { - ipsub->mask[cur_entry] |= cur_bit_value; - --bits; - cur_bit_value /= 2; - } - ipsub->mask[cur_entry] = htonl(ipsub->mask[cur_entry]); - } - else if (inet_pton(AF_INET, mask_or_numbits, ipsub->mask) == 1 && - ipsub->family == AF_INET) - { - /* valid IPv4 netmask */ - } - else - { - d_error("Bad netmask"); - return CORE_EBADMASK; - } - } - - fix_subnet(ipsub); - - return CORE_OK; -} diff --git a/lib/core/src/unix/socket.c b/lib/core/src/unix/socket.c deleted file mode 100644 index 367d8d8e4..000000000 --- a/lib/core/src/unix/socket.c +++ /dev/null @@ -1,814 +0,0 @@ -#define TRACE_MODULE _sock - -#include "core_pool.h" -#include "core_debug.h" -#include "core_pkbuf.h" - -#include "core_arch_network.h" - -#define MAX_SOCK_POOL_SIZE 512 -#define MAX_SOCK_NODE_POOL_SIZE 512 - -static int max_fd; -static list_t fd_list; -static fd_set read_fds; -static mutex_id mutex; - -pool_declare(sock_pool, sock_t, MAX_SOCK_POOL_SIZE); -pool_declare(sock_node_pool, sock_node_t, MAX_SOCK_NODE_POOL_SIZE); - -static status_t sononblock(int sd); -static status_t soblock(int sd); -static void set_fds(fd_set *fds); -static void fd_dispatch(fd_set *fds); - -/* - * Init/Final - */ -status_t network_init(void) -{ - mutex_create(&mutex, MUTEX_DEFAULT); - - pool_init(&sock_pool, MAX_SOCK_POOL_SIZE); - pool_init(&sock_node_pool, MAX_SOCK_NODE_POOL_SIZE); - - max_fd = 0; - list_init(&fd_list); - memset(&read_fds, 0, sizeof(fd_set)); - - return CORE_OK; -} -status_t network_final(void) -{ - if (pool_size(&sock_pool) != pool_avail(&sock_pool)) - d_error("%d not freed in sock_pool[%d]", - pool_size(&sock_pool) - pool_avail(&sock_pool), - pool_size(&sock_pool)); - d_trace(3, "%d not freed in sock_pool[%d]\n", - pool_size(&sock_pool) - pool_avail(&sock_pool), - pool_size(&sock_pool)); - if (pool_size(&sock_node_pool) != pool_avail(&sock_node_pool)) - d_error("%d not freed in sock_node_pool[%d]", - pool_size(&sock_node_pool) - pool_avail(&sock_node_pool), - pool_size(&sock_node_pool)); - d_trace(3, "%d not freed in sock_node_pool[%d]\n", - pool_size(&sock_node_pool) - pool_avail(&sock_node_pool), - pool_size(&sock_node_pool)); - pool_final(&sock_pool); - pool_final(&sock_node_pool); - - mutex_delete(mutex); - - return CORE_OK; -} - -/* - * Socket - */ -status_t sock_create(sock_id *new) -{ - sock_t *sock = NULL; - - pool_alloc_node(&sock_pool, &sock); - d_assert(sock, return CORE_ENOMEM,); - memset(sock, 0, sizeof(sock_t)); - - sock->fd = -1; - - *new = (sock_id)sock; - - return CORE_OK; -} - -status_t sock_delete(sock_id id) -{ - sock_t *sock = (sock_t *)id; - d_assert(id, return CORE_ERROR,); - - if (sock_is_registered(id)) - sock_unregister(id); - if (sock->fd >= 0) - close(sock->fd); - sock->fd = -1; - - pool_free_node(&sock_pool, sock); - return CORE_OK; -} - -status_t sock_delete_list(list_t *list) -{ - status_t rv; - sock_node_t *snode; - - d_assert(list, return CORE_ERROR,); - - for (snode = list_first(list); snode; snode = list_next(snode)) - { - rv = sock_delete(snode->sock); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - return CORE_OK; -} - -status_t sock_socket(sock_id *new, int family, int type, int protocol) -{ - status_t rv; - sock_t *sock = NULL; - - rv = sock_create(new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - sock = (sock_t *)(*new); - - sock->family = family; - sock->fd = socket(sock->family, type, protocol); - if (sock->fd < 0) - { - d_warn("socket create(%d:%d:%d) failed(%d:%s)", - sock->family, type, protocol, errno, strerror(errno)); - return CORE_ERROR; - } - - d_trace(1, "socket create(%d:%d:%d)\n", sock->family, type, protocol); - - return CORE_OK; -} - -status_t sock_setsockopt(sock_id id, c_int32_t opt, c_int32_t on) -{ - sock_t *sock = (sock_t *)id; - int one; - status_t rv; - - d_assert(sock, return CORE_ERROR,); - if (on) - one = 1; - else - one = 0; - - switch(opt) - { - case SOCK_O_REUSEADDR: - if (on != sock_is_option_set(sock, SOCK_O_REUSEADDR)) - { - if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, - (void *)&one, sizeof(int)) == -1) - { - return errno; - } - sock_set_option(sock, SOCK_O_REUSEADDR, on); - } - break; - case SOCK_O_NONBLOCK: - if (sock_is_option_set(sock, SOCK_O_NONBLOCK) != on) - { - if (on) - { - if ((rv = sononblock(sock->fd)) != CORE_OK) - return rv; - } - else - { - if ((rv = soblock(sock->fd)) != CORE_OK) - return rv; - } - sock_set_option(sock, SOCK_O_NONBLOCK, on); - } - break; - default: - d_error("Not implemented(%d)", opt); - return CORE_EINVAL; - } - - return CORE_OK; -} - -status_t sock_bind(sock_id id, c_sockaddr_t *addr) -{ - sock_t *sock = (sock_t *)id; - char buf[CORE_ADDRSTRLEN]; - socklen_t addrlen; - - d_assert(sock, return CORE_ERROR,); - d_assert(addr, return CORE_ERROR,); - - addrlen = sockaddr_len(addr); - d_assert(addrlen, return CORE_ERROR,); - - if (bind(sock->fd, &addr->sa, addrlen) != 0) - { - d_error("socket bind(%d) [%s]:%d failed(%d:%s)", - addr->c_sa_family, CORE_ADDR(addr, buf), CORE_PORT(addr), - errno, strerror(errno)); - return CORE_ERROR; - } - - memcpy(&sock->local_addr, addr, sizeof(sock->local_addr)); - - d_trace(1, "socket bind %s:%d\n", CORE_ADDR(addr, buf), CORE_PORT(addr)); - - return CORE_OK; -} - -status_t sock_connect(sock_id id, c_sockaddr_t *addr) -{ - sock_t *sock = (sock_t *)id; - char buf[CORE_ADDRSTRLEN]; - socklen_t addrlen; - - d_assert(sock, return CORE_ERROR,); - d_assert(addr, return CORE_ERROR,); - - addrlen = sockaddr_len(addr); - d_assert(addrlen, return CORE_ERROR,); - - if (connect(sock->fd, &addr->sa, addrlen) != 0) - { - d_error("socket connect[%s]:%d failed(%d:%s)", - CORE_ADDR(addr, buf), CORE_PORT(addr), errno, strerror(errno)); - return CORE_ERROR; - } - - memcpy(&sock->remote_addr, addr, sizeof(sock->remote_addr)); - - d_trace(1, "socket connect %s:%d\n", CORE_ADDR(addr, buf), CORE_PORT(addr)); - - return CORE_OK; -} - -status_t sock_listen(sock_id id) -{ - int rc; - sock_t *sock = (sock_t *)id; - d_assert(sock, return CORE_ERROR,); - - rc = listen(sock->fd, 5); - if (rc < 0) - { - d_error("listen failed(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} - -status_t sock_accept(sock_id *new, sock_id id) -{ - sock_t *sock = (sock_t *)id; - sock_t *new_sock = NULL; - - int new_fd = -1; - c_sockaddr_t addr; - socklen_t addrlen; - - memset(&addr, 0, sizeof(addr)); - addrlen = sizeof(addr.ss); - - d_assert(id, return CORE_ERROR,); - - new_fd = accept(sock->fd, &addr.sa, &addrlen); - if (new_fd < 0) - { - d_error("accept failed(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; - } - - pool_alloc_node(&sock_pool, &new_sock); - d_assert(new_sock, return CORE_ENOMEM,); - memset(new_sock, 0, sizeof(sock_t)); - - new_sock->family = sock->family; - new_sock->fd = new_fd; - - memcpy(&new_sock->remote_addr, &addr, sizeof(new_sock->remote_addr)); - - *new = (sock_id)new_sock; - - return CORE_OK; -} - -int sock_family(sock_id id) -{ - sock_t *sock = (sock_t *)id; - d_assert(id, return -1,); - - return sock->family; -} -c_sockaddr_t *sock_local_addr(sock_id id) -{ - sock_t *sock = (sock_t *)id; - d_assert(id, return NULL,); - - return &sock->local_addr; -} -c_sockaddr_t *sock_remote_addr(sock_id id) -{ - sock_t *sock = (sock_t *)id; - d_assert(id, return NULL,); - - return &sock->remote_addr; -} - -/* - * Socket Node - */ -status_t sock_add_node( - list_t *list, sock_node_t **node, c_sockaddr_t *sa_list, int family) -{ - status_t rv; - c_sockaddr_t *new_list = NULL; - - d_assert(list, return CORE_OK,); - d_assert(node, return CORE_OK,); - d_assert(sa_list, return CORE_OK,); - - rv = core_copyaddrinfo(&new_list, sa_list); - d_assert(rv == CORE_OK, return CORE_OK,); - - if (family != AF_UNSPEC) - { - rv = core_filteraddrinfo(&new_list, family); - d_assert(rv == CORE_OK, return CORE_OK,); - } - - if (new_list) - { - pool_alloc_node(&sock_node_pool, node); - d_assert(*node, return CORE_OK,); - memset(*node, 0, sizeof(sock_node_t)); - - (*node)->list = new_list; - - list_append(list, *node); - } - - return CORE_OK; -} - -status_t sock_remove_node(list_t *list, sock_node_t *node) -{ - d_assert(node, return CORE_ERROR,); - - list_remove(list, node); - - core_freeaddrinfo(node->list); - pool_free_node(&sock_node_pool, node); - - return CORE_OK; -} - -status_t sock_remove_all_nodes(list_t *list) -{ - sock_node_t *node = NULL, *next_node = NULL; - - node = list_first(list); - while(node) - { - next_node = list_next(node); - - sock_remove_node(list, node); - - node = next_node; - } - - return CORE_OK; -} - -status_t sock_probe_node( - list_t *list, list_t *list6, const char *dev, c_uint16_t port) -{ - sock_node_t *node = NULL; - struct ifaddrs *iflist, *cur; - int rc; - - rc = getifaddrs(&iflist); - if (rc != 0) - { - d_error("getifaddrs failed(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; - } - - for (cur = iflist; cur != NULL; cur = cur->ifa_next) - { - c_sockaddr_t *addr = NULL; - - if (cur->ifa_flags & IFF_LOOPBACK) - continue; - - if (cur->ifa_flags & IFF_POINTOPOINT) - continue; - - if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */ - continue; - - if (dev && strcmp(dev, cur->ifa_name) != 0) - continue; - - addr = (c_sockaddr_t *)cur->ifa_addr; - if (cur->ifa_addr->sa_family == AF_INET) - { - if (!list) continue; - -#ifndef IN_IS_ADDR_LOOPBACK -#define IN_IS_ADDR_LOOPBACK(a) \ - ((((long int) (a)->s_addr) & ntohl(0xff000000)) == ntohl(0x7f000000)) -#endif /* IN_IS_ADDR_LOOPBACK */ - -/* An IP equivalent to IN6_IS_ADDR_UNSPECIFIED */ -#ifndef IN_IS_ADDR_UNSPECIFIED -#define IN_IS_ADDR_UNSPECIFIED(a) \ - (((long int) (a)->s_addr) == 0x00000000) -#endif /* IN_IS_ADDR_UNSPECIFIED */ - if (IN_IS_ADDR_UNSPECIFIED(&addr->sin.sin_addr) || - IN_IS_ADDR_LOOPBACK(&addr->sin.sin_addr)) - continue; - } - else if (cur->ifa_addr->sa_family == AF_INET6) - { - if (!list6) continue; - - if (IN6_IS_ADDR_UNSPECIFIED(&addr->sin6.sin6_addr) || - IN6_IS_ADDR_LOOPBACK(&addr->sin6.sin6_addr) || - IN6_IS_ADDR_MULTICAST(&addr->sin6.sin6_addr) || - IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr) || - IN6_IS_ADDR_SITELOCAL(&addr->sin6.sin6_addr)) - continue; - } - else - continue; - - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, return CORE_ERROR,); - memcpy(&addr->sa, cur->ifa_addr, sockaddr_len(cur->ifa_addr)); - addr->c_sa_port = htons(port); - - pool_alloc_node(&sock_node_pool, &node); - d_assert(node, return CORE_ERROR,); - memset(node, 0, sizeof(sock_node_t)); - - node->list = addr; - - if (addr->c_sa_family == AF_INET) - { - d_assert(list, return CORE_ERROR,); - list_append(list, node); - } - else if (addr->c_sa_family == AF_INET6) - { - d_assert(list6, return CORE_ERROR,); - list_append(list6, node); - } - else - d_assert(0, return CORE_ERROR,); - - } - - freeifaddrs(iflist); - - return CORE_OK; -} - -status_t sock_fill_scope_id_in_local(c_sockaddr_t *sa_list) -{ - struct ifaddrs *iflist = NULL, *cur; - int rc; - c_sockaddr_t *addr, *ifaddr; - - for (addr = sa_list; addr != NULL; addr = addr->next) - { - if (addr->c_sa_family != AF_INET6) - continue; - - if (!IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr)) - continue; - - if (addr->sin6.sin6_scope_id != 0) - continue; - - if (iflist == NULL) - { - rc = getifaddrs(&iflist); - if (rc != 0) - { - d_error("getifaddrs failed(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; - } - } - - for (cur = iflist; cur != NULL; cur = cur->ifa_next) - { - ifaddr = (c_sockaddr_t *)cur->ifa_addr; - - if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */ - continue; - - if (cur->ifa_addr->sa_family != AF_INET6) - continue; - - if (!IN6_IS_ADDR_LINKLOCAL(&ifaddr->sin6.sin6_addr)) - continue; - - if (memcmp(&addr->sin6.sin6_addr, - &ifaddr->sin6.sin6_addr, sizeof(struct in6_addr)) == 0) - { - /* Fill Scope ID in localhost */ - addr->sin6.sin6_scope_id = ifaddr->sin6.sin6_scope_id; - } - } - } - - if (iflist) - freeifaddrs(iflist); - - return CORE_OK; -} - -/* - * Send/Recv - */ -ssize_t sock_write(sock_id id, const void *buf, size_t len) -{ - sock_t *sock = (sock_t *)id; - ssize_t size; - - d_assert(id, return -1,); - - size = write(sock->fd, buf, len); - if (size < 0) - { - d_error("sock_write(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -ssize_t sock_read(sock_id id, void *buf, size_t len) -{ - sock_t *sock = (sock_t *)id; - ssize_t size; - - d_assert(id, return -1,); - - size = read(sock->fd, buf, len); - if (size < 0) - { - d_error("sock_read(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -ssize_t core_send(sock_id id, const void *buf, size_t len, int flags) -{ - sock_t *sock = (sock_t *)id; - ssize_t size; - - d_assert(id, return -1,); - - size = send(sock->fd, buf, len, flags); - if (size < 0) - { - d_error("core_send(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -ssize_t core_sendto(sock_id id, - const void *buf, size_t len, int flags, const c_sockaddr_t *to) -{ - sock_t *sock = (sock_t *)id; - ssize_t size; - socklen_t addrlen; - - d_assert(id, return -1,); - d_assert(to, return -1,); - - addrlen = sockaddr_len(to); - d_assert(addrlen, return CORE_ERROR,); - - size = sendto(sock->fd, buf, len, flags, &to->sa, addrlen); - if (size < 0) - { - d_error("core_sendto(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -ssize_t core_recv(sock_id id, void *buf, size_t len, int flags) -{ - sock_t *sock = (sock_t *)id; - ssize_t size; - - d_assert(id, return -1,); - - size = recv(sock->fd, buf, len, flags); - if (size < 0) - { - d_error("core_recv(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -ssize_t core_recvfrom(sock_id id, - void *buf, size_t len, int flags, c_sockaddr_t *from) -{ - sock_t *sock = (sock_t *)id; - ssize_t size; - socklen_t addrlen = sizeof(struct sockaddr_storage); - - d_assert(id, return -1,); - d_assert(from, return -1,); - - size = recvfrom(sock->fd, buf, len, flags, &from->sa, &addrlen); - if (size < 0) - { - d_error("corek_recvfrom(len:%ld) failed(%d:%s)", - len, errno, strerror(errno)); - } - - return size; -} - -/* - * Select Loop - */ -status_t sock_register(sock_id id, sock_handler handler, void *data) -{ - sock_t *sock = (sock_t *)id; - - d_assert(id, return CORE_ERROR,); - - if (sock_is_registered(id)) - { - d_error("socket has already been registered"); - return CORE_ERROR; - } - - if (sock_setsockopt(id, SOCK_O_NONBLOCK, 1) == CORE_ERROR) - { - d_error("cannot set socket to non-block"); - return CORE_ERROR; - } - - if (sock->fd > max_fd) - { - max_fd = sock->fd; - } - sock->handler = handler; - sock->data = data; - - list_append(&fd_list, sock); - - return CORE_OK; -} - -status_t sock_unregister(sock_id id) -{ - d_assert(id, return CORE_ERROR,); - - list_remove(&fd_list, id); - - return CORE_OK; -} - -int sock_is_registered(sock_id id) -{ - sock_t *sock = (sock_t *)id; - sock_t *iter = NULL; - - d_assert(id, return CORE_ERROR,); - for (iter = list_first(&fd_list); iter != NULL; iter = list_next(iter)) - { - if (iter == sock) - { - return 1; - } - } - - return 0; -} - -int sock_select_loop(c_time_t timeout) -{ - struct timeval tv; - int rc; - - if (timeout > 0) - { - tv.tv_sec = time_sec(timeout); - tv.tv_usec = time_usec(timeout); - } - - set_fds(&read_fds); - - rc = select(max_fd + 1, &read_fds, NULL, NULL, timeout > 0 ? &tv : NULL); - if (rc < 0) - { - if (errno != EINTR && errno != 0) - d_error("select failed(%d:%s)", errno, strerror(errno)); - - return rc; - } - - /* Timeout */ - if (rc == 0) - { - return rc; - } - - /* Dispatch Handler */ - fd_dispatch(&read_fds); - - return 0; -} - -static status_t soblock(int sd) -{ -/* BeOS uses setsockopt at present for non blocking... */ -#ifndef BEOS - int fd_flags; - - fd_flags = fcntl(sd, F_GETFL, 0); -#if defined(O_NONBLOCK) - fd_flags &= ~O_NONBLOCK; -#elif defined(O_NDELAY) - fd_flags &= ~O_NDELAY; -#elif defined(FNDELAY) - fd_flags &= ~FNDELAY; -#else -#error Please teach CORE how to make sockets blocking on your platform. -#endif - if (fcntl(sd, F_SETFL, fd_flags) == -1) - { - return errno; - } -#else - int on = 0; - if (setsockopt(sd, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int)) < 0) - return errno; -#endif /* BEOS */ - return CORE_OK; -} - -static status_t sononblock(int sd) -{ -#ifndef BEOS - int fd_flags; - - fd_flags = fcntl(sd, F_GETFL, 0); -#if defined(O_NONBLOCK) - fd_flags |= O_NONBLOCK; -#elif defined(O_NDELAY) - fd_flags |= O_NDELAY; -#elif defined(FNDELAY) - fd_flags |= FNDELAY; -#else -#error Please teach CORE how to make sockets non-blocking on your platform. -#endif - if (fcntl(sd, F_SETFL, fd_flags) == -1) - { - return errno; - } -#else - int on = 1; - if (setsockopt(sd, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int)) < 0) - return errno; -#endif /* BEOS */ - return CORE_OK; -} - -static void set_fds(fd_set *fds) -{ - sock_t *sock = NULL; - - FD_ZERO(fds); - for (sock = list_first(&fd_list); sock != NULL; sock = list_next(sock)) - { - FD_SET(sock->fd, fds); - } -} - -static void fd_dispatch(fd_set *fds) -{ - sock_t *sock = NULL; - - for (sock = list_first(&fd_list); sock != NULL; sock = list_next(sock)) - { - if (FD_ISSET(sock->fd, fds)) - { - if (sock->handler) - { - sock->handler((sock_id)sock, sock->data); - } - } - } -} diff --git a/lib/core/src/unix/start.c b/lib/core/src/unix/start.c deleted file mode 100644 index a0bec58e2..000000000 --- a/lib/core/src/unix/start.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "core.h" -#include "core_general.h" -#include "core_debug.h" -#include "core_pool.h" -#include "core_msgq.h" -#include "core_tlv.h" -#include "core_timer.h" -#include "core_atomic.h" -#include "core_mutex.h" -#include "core_cond.h" -#include "core_rwlock.h" -#include "core_semaphore.h" -#include "core_thread.h" -#include "core_network.h" -#include "core_file.h" -#include "core_pkbuf.h" -#include "core_signal.h" - -status_t core_app_initialize(int *argc, - const char * const * *argv, - const char * const * *env) -{ - /* An absolute noop. At present, only Win32 requires this stub, but it's - * required in order to move command arguments passed through the service - * control manager into the process, and it's required to fix the char* - * data passed in from win32 unicode into utf-8, win32's core internal fmt. - */ - return core_initialize(); -} - -static int initialized = 0; - -status_t core_initialize(void) -{ - if (initialized++) - { - return CORE_OK; - } - - /* IMPORTANT: Mutex should be initialized firtly because node-pool - * framework uses mutex and it will be used by other xxx_init() */ - mutex_init(); - semaphore_init(); - cond_init(); - rwlock_init(); - atomic_init(); - thread_init(); - network_init(); - file_init(); - pkbuf_init(); - tlv_init(); - tm_init(); - msgq_init(); - signal_init(); - - return CORE_OK; -} - -void core_terminate(void) -{ - initialized--; - if (initialized) { - return; - } - - /* Reverse ordered finalization */ - msgq_final(); - tm_final(); - tlv_final(); - pkbuf_final(); - file_final(); - network_final(); - thread_final(); - atomic_final(); - rwlock_final(); - cond_final(); - semaphore_final(); - mutex_final(); - - return; -} - -void core_terminate2(void) -{ - core_terminate(); -} diff --git a/lib/core/src/unix/tcp.c b/lib/core/src/unix/tcp.c deleted file mode 100644 index 32c2f528c..000000000 --- a/lib/core/src/unix/tcp.c +++ /dev/null @@ -1,93 +0,0 @@ -#define TRACE_MODULE _tcp - -#include "core_debug.h" -#include "core_arch_network.h" - -status_t tcp_server(sock_id *new, c_sockaddr_t *sa_list) -{ - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - d_assert(new, return CORE_ERROR,); - d_assert(sa_list, return CORE_ERROR,); - - addr = sa_list; - while(addr) - { - rv = sock_socket(new, addr->c_sa_family, SOCK_STREAM, IPPROTO_TCP); - if (rv == CORE_OK) - { - d_assert(sock_setsockopt(*new, SOCK_O_REUSEADDR, 1) == CORE_OK, - return CORE_ERROR, - "setsockopt [%s]:%d failed(%d:%s)", - CORE_ADDR(addr, buf), CORE_PORT(addr), - errno, strerror(errno)); - - if (sock_bind(*new, addr) == CORE_OK) - { - d_trace(1, "tcp_server() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - rv = sock_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("tcp_server() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - rv = sock_listen(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; -} - -status_t tcp_client(sock_id *new, c_sockaddr_t *sa_list) -{ - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - d_assert(new, return CORE_ERROR,); - d_assert(sa_list, return CORE_ERROR,); - - addr = sa_list; - while(addr) - { - rv = sock_socket(new, addr->c_sa_family, SOCK_STREAM, IPPROTO_TCP); - if (rv == CORE_OK) - { - if (sock_connect(*new, addr) == CORE_OK) - { - d_trace(1, "tcp_client() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - rv = sock_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("tcp_client() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} diff --git a/lib/core/src/unix/thread.c b/lib/core/src/unix/thread.c deleted file mode 100644 index e3a0a27dc..000000000 --- a/lib/core/src/unix/thread.c +++ /dev/null @@ -1,226 +0,0 @@ -#include "core.h" -#include "core_arch_thread.h" -#include "core_portable.h" -#include "core_errno.h" -#include "core_param.h" -#include "core_general.h" -#define TRACE_MODULE _thread -#include "core_debug.h" -#include "core_pool.h" -#include "core_semaphore.h" - -struct thread_stop_info { - pthread_t thread; - semaphore_id semaphore; -}; - -pool_declare(thread_pool, thread_t, MAX_NUM_OF_THREAD); -pool_declare(threadattr_pool, threadattr_t, MAX_NUM_OF_THREADATTR); - -static struct thread_stop_info thread_stop_info; - -int thread_should_stop(void) -{ - return (thread_stop_info.thread == pthread_self()); -} - -status_t thread_init(void) -{ - pool_init(&thread_pool, MAX_NUM_OF_THREAD); - pool_init(&threadattr_pool, MAX_NUM_OF_THREADATTR); - - memset(&thread_stop_info, 0, sizeof(thread_stop_info)); - - semaphore_create(&thread_stop_info.semaphore, 0); - return CORE_OK; -} - -status_t thread_final(void) -{ - pool_final(&thread_pool); - pool_final(&threadattr_pool); - - semaphore_delete(thread_stop_info.semaphore); - return CORE_OK; -} - -status_t threadattr_create(threadattr_t **new) -{ - status_t stat; - - pool_alloc_node(&threadattr_pool, &(*new)); - d_assert((*new), return CORE_ENOMEM, "threadattr_pool(%d) is not enough\n", - MAX_NUM_OF_THREADATTR); - stat = pthread_attr_init(&(*new)->attr); - - if (stat == 0) - { - return CORE_OK; - } - - return stat; -} - -status_t threadattr_stacksize_set( - threadattr_t *attr, size_t stacksize) -{ - int stat; - - stat = pthread_attr_setstacksize(&attr->attr, stacksize); - if (stat == 0) - { - return CORE_OK; - } - - return stat; -} - -status_t threadattr_delete(threadattr_t *attr) -{ - status_t stat; - - stat = pthread_attr_destroy(&attr->attr); - pool_free_node(&threadattr_pool, attr); - - if (stat == 0) - { - return CORE_OK; - } - - return stat; -} - -static void *dummy_worker(void *opaque) -{ - void *func = NULL; - thread_t *thread = (thread_t *)opaque; - - thread->thread = pthread_self(); - semaphore_post(thread->semaphore); - d_trace(3, "[%d] dummy_worker post semaphore\n", thread->thread); - - if (!thread_should_stop()) - func = thread->func((thread_id)thread, thread->data); - - d_trace(3, "[%d] thread stopped = %d\n", - thread->thread, thread_should_stop()); - semaphore_post(thread_stop_info.semaphore); - d_trace(3, "[%d] post semaphore for thread_stop_info.semaphore\n", - thread->thread); - - return func; -} - -status_t thread_create(thread_id *id, - threadattr_t *attr, thread_start_t func, void *data) -{ - status_t stat; - pthread_attr_t *temp; - thread_t *new = NULL; - - pool_alloc_node(&thread_pool, &new); - d_assert(new, return CORE_ENOMEM, "thread_pool(%d) is not enough\n", - MAX_NUM_OF_THREAD); - memset(new, 0, sizeof(thread_id)); - - new->data = data; - new->func = func; - - semaphore_create(&new->semaphore, 0); - - if (attr) - temp = &attr->attr; - else - temp = NULL; - - if ((stat = pthread_create(&new->thread, temp, dummy_worker, new)) != 0) - { - return stat; - } - - d_trace(3, "thread_create wait\n"); - semaphore_wait(new->semaphore); - d_trace(3, "thread_create done\n"); - - *id = (thread_id)new; - - return CORE_OK; -} - -status_t thread_delete(thread_id id) -{ - thread_t *thread = (thread_t *)id; - - thread_stop_info.thread = thread->thread; - d_trace(3, "thread_stop_info.thread for %d\n", thread_stop_info.thread); - semaphore_wait(thread_stop_info.semaphore); - d_trace(3, "semaphore_wait done\n"); - thread_stop_info.thread = 0; - - pthread_join(thread->thread, 0); - - semaphore_delete(thread->semaphore); - pool_free_node(&thread_pool, thread); - d_trace(3, "delete thread-related memory\n"); - - return CORE_OK; -} - -status_t thread_join(status_t *retval, thread_id id) -{ - thread_t *thread = (thread_t *)id; - - status_t stat; - status_t *thread_stat; - - if ((stat = pthread_join(thread->thread, (void *)&thread_stat)) == 0) - { - *retval = thread->exitval; - } - - semaphore_delete(thread->semaphore); - pool_free_node(&thread_pool, thread); - - return stat; -} - -status_t thread_exit(thread_id id, status_t retval) -{ - thread_t *thread = (thread_t *)id; - - thread->exitval = retval; - pthread_exit(NULL); - return CORE_OK; -} - -status_t thread_detach(thread_id id) -{ - thread_t *thread = (thread_t *)id; - - return pthread_detach(thread->thread); -} - -void thread_yield(void) -{ -#ifdef HAVE_PTHREAD_YIELD - pthread_yield(NULL); -#else -#ifdef HAVE_SCHED_YIELD - sched_yield(); -#endif -#endif -} - -status_t os_thread_get(os_thread_t **thethd, thread_id id) -{ - thread_t *thread = (thread_t *)id; - - *thethd = &thread->thread; - - return CORE_OK; -} - -os_thread_t os_thread_current(void) -{ - return pthread_self(); -} diff --git a/lib/core/src/unix/time.c b/lib/core/src/unix/time.c deleted file mode 100644 index ba2ffa841..000000000 --- a/lib/core/src/unix/time.c +++ /dev/null @@ -1,254 +0,0 @@ -#include "core.h" -#include "core_time.h" - -static c_int32_t get_offset(struct tm *tm) -{ -#if defined(HAVE_STRUCT_TM_TM_GMTOFF) - return tm->tm_gmtoff; -#elif defined(HAVE_STRUCT_TM___TM_GMTOFF) - return tm->__tm_gmtoff; -#else -#error cannot support tm->tm_gmtoff -#endif -} - -status_t time_ansi_put(c_time_t *result, time_t input) -{ - *result = (c_time_t)input * USEC_PER_SEC; - return CORE_OK; -} - -/* NB NB NB NB This returns GMT!!!!!!!!!! */ -c_time_t time_now(void) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec * USEC_PER_SEC + tv.tv_usec; -} - -void core_sleep(c_time_t t) -{ -#ifdef OS2 - DosSleep(t/1000); -#elif defined(BEOS) - snooze(t); -#elif defined(NETWARE) - delay(t/1000); -#else - struct timeval tv; - tv.tv_usec = t % USEC_PER_SEC; - tv.tv_sec = t / USEC_PER_SEC; - select(0, NULL, NULL, NULL, &tv); -#endif -} - -static void explode_time(time_exp_t *xt, c_time_t t, - c_int32_t offset, int use_localtime) -{ - struct tm tm; - time_t tt = (t / USEC_PER_SEC) + offset; - xt->tm_usec = t % USEC_PER_SEC; - -#if defined (_POSIX_THREAD_SAFE_FUNCTIONS) - if (use_localtime) - localtime_r(&tt, &tm); - else - gmtime_r(&tt, &tm); -#else - if (use_localtime) - tm = *localtime(&tt); - else - tm = *gmtime(&tt); -#endif - - xt->tm_sec = tm.tm_sec; - xt->tm_min = tm.tm_min; - xt->tm_hour = tm.tm_hour; - xt->tm_mday = tm.tm_mday; - xt->tm_mon = tm.tm_mon; - xt->tm_year = tm.tm_year; - xt->tm_wday = tm.tm_wday; - xt->tm_yday = tm.tm_yday; - xt->tm_isdst = tm.tm_isdst; - xt->tm_gmtoff = get_offset(&tm); -} - -status_t time_exp_tz(time_exp_t *result, - c_time_t input, c_int32_t offs) -{ - explode_time(result, input, offs, 0); - result->tm_gmtoff = offs; - return CORE_OK; -} - -status_t time_exp_gmt(time_exp_t *result, c_time_t input) -{ - return time_exp_tz(result, input, 0); -} - -status_t time_exp_lt(time_exp_t *result, c_time_t input) -{ -#if defined(__EMX__) - /* EMX gcc (OS/2) has a timezone global we can use */ - return time_exp_tz(result, input, -timezone); -#else - explode_time(result, input, 0, 1); - return CORE_OK; -#endif /* __EMX__ */ -} - -status_t time_exp_get(c_time_t *t, time_exp_t *xt) -{ - time_t year = xt->tm_year; - time_t days; - static const int dayoffset[12] = - {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; - - /* shift new year to 1st March in order to make leap year calc easy */ - - if (xt->tm_mon < 2) - year--; - - /* Find number of days since 1st March 1900 (in the Gregorian calendar). */ - - days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4; - days += dayoffset[xt->tm_mon] + xt->tm_mday - 1; - days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ - days = ((days * 24 + xt->tm_hour) * 60 + xt->tm_min) * 60 + xt->tm_sec; - - if (days < 0) { - return CORE_EBADDATE; - } - *t = days * USEC_PER_SEC + xt->tm_usec; - return CORE_OK; -} - -status_t time_exp_gmt_get(c_time_t *t, time_exp_t *xt) -{ - status_t status = time_exp_get(t, xt); - if (status == CORE_OK) - *t -= (time_t) xt->tm_gmtoff * USEC_PER_SEC; - return status; -} - -const char month_snames[12][4] = -{ - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; -const char day_snames[7][4] = -{ - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; - -status_t rfc822_date(char *date_str, c_time_t t) -{ - time_exp_t xt; - const char *s; - int real_year; - - time_exp_gmt(&xt, t); - - /* example: "Sat, 08 Jan 2000 18:31:41 GMT" */ - /* 12345678901234567890123456789 */ - - s = &day_snames[xt.tm_wday][0]; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = ','; - *date_str++ = ' '; - *date_str++ = xt.tm_mday / 10 + '0'; - *date_str++ = xt.tm_mday % 10 + '0'; - *date_str++ = ' '; - s = &month_snames[xt.tm_mon][0]; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = ' '; - real_year = 1900 + xt.tm_year; - /* This routine isn't y10k ready. */ - *date_str++ = real_year / 1000 + '0'; - *date_str++ = real_year % 1000 / 100 + '0'; - *date_str++ = real_year % 100 / 10 + '0'; - *date_str++ = real_year % 10 + '0'; - *date_str++ = ' '; - *date_str++ = xt.tm_hour / 10 + '0'; - *date_str++ = xt.tm_hour % 10 + '0'; - *date_str++ = ':'; - *date_str++ = xt.tm_min / 10 + '0'; - *date_str++ = xt.tm_min % 10 + '0'; - *date_str++ = ':'; - *date_str++ = xt.tm_sec / 10 + '0'; - *date_str++ = xt.tm_sec % 10 + '0'; - *date_str++ = ' '; - *date_str++ = 'G'; - *date_str++ = 'M'; - *date_str++ = 'T'; - *date_str++ = 0; - return CORE_OK; -} - -status_t core_ctime(char *date_str, c_time_t t) -{ - time_exp_t xt; - const char *s; - int real_year; - - /* example: "Wed Jun 30 21:49:08 1993" */ - /* 123456789012345678901234 */ - - time_exp_lt(&xt, t); - s = &day_snames[xt.tm_wday][0]; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = ' '; - s = &month_snames[xt.tm_mon][0]; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = *s++; - *date_str++ = ' '; - *date_str++ = xt.tm_mday / 10 + '0'; - *date_str++ = xt.tm_mday % 10 + '0'; - *date_str++ = ' '; - *date_str++ = xt.tm_hour / 10 + '0'; - *date_str++ = xt.tm_hour % 10 + '0'; - *date_str++ = ':'; - *date_str++ = xt.tm_min / 10 + '0'; - *date_str++ = xt.tm_min % 10 + '0'; - *date_str++ = ':'; - *date_str++ = xt.tm_sec / 10 + '0'; - *date_str++ = xt.tm_sec % 10 + '0'; - *date_str++ = ' '; - real_year = 1900 + xt.tm_year; - *date_str++ = real_year / 1000 + '0'; - *date_str++ = real_year % 1000 / 100 + '0'; - *date_str++ = real_year % 100 / 10 + '0'; - *date_str++ = real_year % 10 + '0'; - *date_str++ = 0; - - return CORE_OK; -} - -status_t core_strftime(char *s, size_t *retsize, size_t max, - const char *format, time_exp_t *xt) -{ - struct tm tm; - memset(&tm, 0, sizeof tm); - tm.tm_sec = xt->tm_sec; - tm.tm_min = xt->tm_min; - tm.tm_hour = xt->tm_hour; - tm.tm_mday = xt->tm_mday; - tm.tm_mon = xt->tm_mon; - tm.tm_year = xt->tm_year; - tm.tm_wday = xt->tm_wday; - tm.tm_yday = xt->tm_yday; - tm.tm_isdst = xt->tm_isdst; -#if defined(HAVE_STRUCT_TM_TM_GMTOFF) - tm.tm_gmtoff = xt->tm_gmtoff; -#elif defined(HAVE_STRUCT_TM___TM_GMTOFF) - tm.__tm_gmtoff = xt->tm_gmtoff; -#endif - (*retsize) = strftime(s, max, format, &tm); - return CORE_OK; -} diff --git a/lib/core/src/unix/udp.c b/lib/core/src/unix/udp.c deleted file mode 100644 index 751778236..000000000 --- a/lib/core/src/unix/udp.c +++ /dev/null @@ -1,134 +0,0 @@ -#define TRACE_MODULE _udp - -#include "core_debug.h" -#include "core_arch_network.h" - -status_t udp_socket(sock_id *new, int family) -{ - status_t rv; - - rv = sock_socket(new, family, SOCK_DGRAM, IPPROTO_UDP); - d_assert(rv == CORE_OK && new, return CORE_ERROR,); - - d_trace(1, "udp socket(%d)\n", family); - - return CORE_OK; -} - -status_t udp_server(sock_id *new, c_sockaddr_t *sa_list) -{ - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - d_assert(new, return CORE_ERROR,); - d_assert(sa_list, return CORE_ERROR,); - - addr = sa_list; - while(addr) - { - rv = udp_socket(new, addr->c_sa_family); - if (rv == CORE_OK) - { - d_assert(sock_setsockopt(*new, SOCK_O_REUSEADDR, 1) == CORE_OK, - return CORE_ERROR, - "setsockopt [%s]:%d failed(%d:%s)", - CORE_ADDR(addr, buf), CORE_PORT(addr), - errno, strerror(errno)); - - if (sock_bind(*new, addr) == CORE_OK) - { - d_trace(1, "udp_server() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - rv = sock_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("udp_server() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} - -status_t udp_client(sock_id *new, c_sockaddr_t *sa_list) -{ - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - d_assert(new, return CORE_ERROR,); - d_assert(sa_list, return CORE_ERROR,); - - addr = sa_list; - while(addr) - { - rv = udp_socket(new, addr->c_sa_family); - if (rv == CORE_OK) - { - if (sock_connect(*new, addr) == CORE_OK) - { - d_trace(1, "udp_client() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - rv = sock_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("udp_client() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), errno, - strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} - -status_t udp_connect(sock_id id, c_sockaddr_t *sa_list) -{ - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; - - d_assert(id, return CORE_ERROR,); - d_assert(sa_list, return CORE_ERROR,); - - addr = sa_list; - while(addr) - { - if (sock_connect(id, addr) == CORE_OK) - { - d_trace(1, "udp_connect() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - break; - } - - addr = addr->next; - } - - if (addr == NULL) - { - d_error("udp_connect() [%s]:%d failed(%d:%s)", - CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), - errno, strerror(errno)); - return CORE_ERROR; - } - - return CORE_OK; -} diff --git a/lib/core/src/version.c b/lib/core/src/version.c deleted file mode 100644 index 582d139e2..000000000 --- a/lib/core/src/version.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "core_version.h" -#include "core_general.h" /* for CORE_STRINGIFY */ - -CORE_DECLARE(void) core_version(core_version_t *pvsn) -{ - pvsn->major = CORE_MAJOR_VERSION; - pvsn->minor = CORE_MINOR_VERSION; - pvsn->patch = CORE_PATCH_VERSION; -#ifdef CORE_IS_DEV_VERSION - pvsn->is_dev = 1; -#else - pvsn->is_dev = 0; -#endif -} - -CORE_DECLARE(const char *) core_version_string(void) -{ - return CORE_VERSION_STRING; -} diff --git a/lib/core/test/Makefile.am b/lib/core/test/Makefile.am deleted file mode 100644 index 56bd9d5cb..000000000 --- a/lib/core/test/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -bin_PROGRAMS = testcore - -testcore_SOURCES = \ - abts.c testds.c testfsm.c testsock.c testthread.c testtlv.c \ - testaes.c testfile.c testlock.c testatomic.c testsha.c testtime.c \ - testdir.c testfilecopy.c testmsgq.c testsleep.c testtimer.c \ - testpkbuf.c testmisc.c testhash.c test3gpp.c \ - abts.h abts_tests.h testutil.c testutil.h \ - $(NULL) - -if !USRSCTP -testcore_SOURCES += testsctp.c -endif - -testcore_LDADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(NULL) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ - $(NULL) - -AM_CFLAGS = \ - -Wall -Werror @OSCPPFLAGS@ \ - -Wno-unused-function -Wno-unused-variable -Wno-restrict \ - -Wno-unknown-warning-option \ - $(NULL) - -TESTS = testcore - -MAINTAINERCLEANFILES = Makefile.in -CLEANFILES = -R data -MOSTLYCLEANFILES = core *.stackdump diff --git a/lib/core/test/abts.c b/lib/core/test/abts.c deleted file mode 100644 index 737a07d30..000000000 --- a/lib/core/test/abts.c +++ /dev/null @@ -1,479 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "abts.h" -#include "abts_tests.h" -#include "testutil.h" -#include "core_pkbuf.h" - -#define ABTS_STAT_SIZE 6 -static char status[ABTS_STAT_SIZE] = {'|', '/', '-', '|', '\\', '-'}; -static int curr_char; -static int verbose = 1; -static int exclude = 0; -static int quiet = 0; -static int list_tests = 0; - -const char **testlist = NULL; - -static int find_test_name(const char *testname) { - int i; - for (i = 0; testlist[i] != NULL; i++) { - if (!strcmp(testlist[i], testname)) { - return 1; - } - } - return 0; -} - -/* Determine if the test should be run at all */ -static int should_test_run(const char *testname) { - int found = 0; - if (list_tests == 1) { - return 0; - } - if (testlist == NULL) { - return 1; - } - found = find_test_name(testname); - if ((found && !exclude) || (!found && exclude)) { - return 1; - } - return 0; -} - -static void reset_status(void) -{ - curr_char = 0; -} - -static void update_status(void) -{ - if (!quiet) { - curr_char = (curr_char + 1) % ABTS_STAT_SIZE; - fprintf(stdout, "\b%c", status[curr_char]); - fflush(stdout); - } -} - -static void end_suite(abts_suite *suite) -{ - if (suite != NULL) { - sub_suite *last = suite->tail; - if (!quiet) { - fprintf(stdout, "\b"); - fflush(stdout); - } - if (last->failed == 0) { - fprintf(stdout, "SUCCESS\n"); - fflush(stdout); - } - else { - fprintf(stdout, "FAILED %d of %d\n", last->failed, last->num_test); - fflush(stdout); - } - } -} - -abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full) -{ - sub_suite *subsuite; - char *p; - const char *suite_name; - curr_char = 0; - - /* Only end the suite if we actually ran it */ - if (suite && suite->tail &&!suite->tail->not_run) { - end_suite(suite); - } - - subsuite = core_malloc(sizeof(*subsuite)); - subsuite->num_test = 0; - subsuite->failed = 0; - subsuite->next = NULL; - /* suite_name_full may be an absolute path depending on __FILE__ - * expansion */ - suite_name = strrchr(suite_name_full, '/'); - if (suite_name) { - suite_name++; - } else { - suite_name = suite_name_full; - } - p = strrchr(suite_name, '.'); - if (p) { - subsuite->name = memcpy(core_calloc(p - suite_name + 1, 1), - suite_name, p - suite_name); - } - else { - subsuite->name = suite_name; - } - - if (list_tests) { - fprintf(stdout, "%s\n", subsuite->name); - } - - subsuite->not_run = 0; - - if (suite == NULL) { - suite = core_malloc(sizeof(*suite)); - suite->head = subsuite; - suite->tail = subsuite; - } - else { - suite->tail->next = subsuite; - suite->tail = subsuite; - } - - if (!should_test_run(subsuite->name)) { - subsuite->not_run = 1; - return suite; - } - - reset_status(); - fprintf(stdout, "%-20s: ", subsuite->name); - update_status(); - fflush(stdout); - - return suite; -} - -void abts_run_test(abts_suite *ts, test_func f, void *value) -{ - abts_case tc; - sub_suite *ss; - - if (!should_test_run(ts->tail->name)) { - return; - } - ss = ts->tail; - - tc.failed = 0; - tc.suite = ss; - - ss->num_test++; - update_status(); - - f(&tc, value); - - if (tc.failed) { - ss->failed++; - } -} - -static int report(abts_suite *suite) -{ - int count = 0; - sub_suite *dptr; - - if (suite && suite->tail &&!suite->tail->not_run) { - end_suite(suite); - } - - for (dptr = suite->head; dptr; dptr = dptr->next) { - count += dptr->failed; - } - - if (list_tests) { - return 0; - } - - if (count == 0) { - printf("All tests passed.\n"); - return 0; - } - - dptr = suite->head; - fprintf(stdout, "%-15s\t\tTotal\tFail\tFailed %%\n", "Failed Tests"); - fprintf(stdout, "===================================================\n"); - while (dptr != NULL) { - if (dptr->failed != 0) { - float percent = ((float)dptr->failed / (float)dptr->num_test); - fprintf(stdout, "%-15s\t\t%5d\t%4d\t%6.2f%%\n", dptr->name, - dptr->num_test, dptr->failed, percent * 100); - } - dptr = dptr->next; - } - return 1; -} - -static void abts_free(abts_suite *suite) -{ - sub_suite *ptr = NULL, *next_ptr = NULL; - - ptr = suite->head; - while (ptr != NULL) { - next_ptr = ptr->next; - - CORE_FREE((void*)ptr->name); - CORE_FREE(ptr); - ptr = next_ptr; - } - - CORE_FREE(suite); -} - -void abts_log_message(const char *fmt, ...) -{ - va_list args; - update_status(); - - if (verbose) { - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); - fflush(stderr); - } -} - -void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected != actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_size_equal(abts_case *tc, size_t expected, size_t actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - /* Note that the comparison is type-exact, reporting must be a best-fit */ - fprintf(stderr, "Line %d: expected %lu, but saw %lu\n", lineno, - (unsigned long)expected, (unsigned long)actual); - fflush(stderr); - } -} - -void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!expected && !actual) return; - if (expected && actual) - if (!strcmp(expected, actual)) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_str_nequal(abts_case *tc, const char *expected, const char *actual, - size_t n, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!strncmp(expected, actual, n)) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_ptr_null(abts_case *tc, const void *ptr, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (ptr == NULL) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Expected NULL, but saw <%p>\n", lineno, ptr); - fflush(stderr); - } -} - -void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (ptr != NULL) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Expected not NULL, but saw <%p>\n", lineno, ptr); - fflush(stderr); - } -} - -void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%p>, but saw <%p>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_fail(abts_case *tc, const char *message, int lineno) -{ - update_status(); - if (tc->failed) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -void abts_assert(abts_case *tc, const char *message, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -void abts_true(abts_case *tc, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Condition is false, but expected true\n", lineno); - fflush(stderr); - } -} - -void abts_false(abts_case *tc, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Condition is true, but expected false\n", lineno); - fflush(stderr); - } -} - -void abts_not_impl(abts_case *tc, const char *message, int lineno) -{ - update_status(); - - tc->suite->not_impl++; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -int main(int argc, const char *const argv[]) { - int i; - int rv; - int list_provided = 0; - abts_suite *suite = NULL; - - test_initialize(); - - quiet = !isatty(STDOUT_FILENO); - - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-v")) { - verbose = 1; - continue; - } - if (!strcmp(argv[i], "-x")) { - exclude = 1; - continue; - } - if (!strcmp(argv[i], "-l")) { - list_tests = 1; - continue; - } - if (!strcmp(argv[i], "-q")) { - quiet = 1; - continue; - } - if (argv[i][0] == '-') { - fprintf(stderr, "Invalid option: `%s'\n", argv[i]); - exit(1); - } - list_provided = 1; - } - - if (list_provided) { - /* Waste a little space here, because it is easier than counting the - * number of tests listed. Besides it is at most three char *. - */ - testlist = core_calloc(argc + 1, sizeof(char *)); - for (i = 1; i < argc; i++) { - testlist[i - 1] = argv[i]; - } - } - - for (i = 0; i < (sizeof(alltests) / sizeof(struct testlist *)); i++) { - suite = alltests[i].func(suite); - } - - rv = report(suite); - - abts_free(suite); - - CORE_FREE(testlist); - return rv; -} - diff --git a/lib/core/test/abts.h b/lib/core/test/abts.h deleted file mode 100644 index 211805077..000000000 --- a/lib/core/test/abts.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#ifdef WIN32 -#include -#else -#include -#endif - -#ifndef ABTS_H -#define ABTS_H - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -struct sub_suite { - const char *name; - int num_test; - int failed; - int not_run; - int not_impl; - struct sub_suite *next; -}; -typedef struct sub_suite sub_suite; - -struct abts_suite { - sub_suite *head; - sub_suite *tail; -}; -typedef struct abts_suite abts_suite; - -struct abts_case { - int failed; - sub_suite *suite; -}; -typedef struct abts_case abts_case; - -typedef void (*test_func)(abts_case *tc, void *data); - -#define ADD_SUITE(suite) abts_add_suite(suite, __FILE__); - -abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name); -void abts_run_test(abts_suite *ts, test_func f, void *value); -void abts_log_message(const char *fmt, ...); - -void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno); -void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno); -void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno); -void abts_str_nequal(abts_case *tc, const char *expected, const char *actual, - size_t n, int lineno); -void abts_ptr_null(abts_case *tc, const void *ptr, int lineno); -void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno); -void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno); -void abts_true(abts_case *tc, int condition, int lineno); -void abts_false(abts_case *tc, int condition, int lineno); -void abts_fail(abts_case *tc, const char *message, int lineno); -void abts_not_impl(abts_case *tc, const char *message, int lineno); -void abts_assert(abts_case *tc, const char *message, int condition, int lineno); -void abts_size_equal(abts_case *tc, size_t expected, size_t actual, int lineno); - -/* Convenience macros. Ryan hates these! */ -#define ABTS_INT_EQUAL(a, b, c) abts_int_equal(a, b, c, __LINE__) -#define ABTS_INT_NEQUAL(a, b, c) abts_int_nequal(a, b, c, __LINE__) -#define ABTS_STR_EQUAL(a, b, c) abts_str_equal(a, b, c, __LINE__) -#define ABTS_STR_NEQUAL(a, b, c, d) abts_str_nequal(a, b, c, d, __LINE__) -#define ABTS_PTR_NULL(a, b) abts_ptr_null(a, b, __LINE__) -#define ABTS_PTR_NOTNULL(a, b) abts_ptr_notnull(a, b, __LINE__) -#define ABTS_PTR_EQUAL(a, b, c) abts_ptr_equal(a, b, c, __LINE__) -#define ABTS_TRUE(a, b) abts_true(a, b, __LINE__); -#define ABTS_FALSE(a, b) abts_false(a, b, __LINE__); -#define ABTS_FAIL(a, b) abts_fail(a, b, __LINE__); -#define ABTS_NOT_IMPL(a, b) abts_not_impl(a, b, __LINE__); -#define ABTS_ASSERT(a, b, c) abts_assert(a, b, c, __LINE__); - -#define ABTS_SIZE_EQUAL(a, b, c) abts_size_equal(a, b, c, __LINE__) - - -abts_suite *run_tests(abts_suite *suite); -abts_suite *run_tests1(abts_suite *suite); - - -#endif - -#ifdef __cplusplus -} -#endif - diff --git a/lib/core/test/abts_tests.h b/lib/core/test/abts_tests.h deleted file mode 100644 index 3389e0973..000000000 --- a/lib/core/test/abts_tests.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef APR_TEST_INCLUDES -#define APR_TEST_INCLUDES - -#include "abts.h" -#include "testutil.h" - -const struct testlist { - abts_suite *(*func)(abts_suite *suite); -} alltests[] = { - {testds}, - {testfsm}, - {testtlv}, - {testaes}, - {testsha2}, - {testsock}, -#ifndef DARWIN - {testsctp}, -#endif - {testtime}, - {testtimer}, - {testthread}, - {testlock}, - {testatomic}, - {testfile}, - {testfilecopy}, - {testdir}, - {testmsgq}, - {testsleep}, - {testpkbuf}, - {testmisc}, - {testhash}, - {test3gpp}, -}; - -#endif /* APR_TEST_INCLUDES */ diff --git a/lib/core/test/test3gpp.c b/lib/core/test/test3gpp.c deleted file mode 100644 index 1c01a38a6..000000000 --- a/lib/core/test/test3gpp.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "core_lib.h" -#include "core_debug.h" - -#include "3gpp_types.h" - -#include "testutil.h" - -static void _3gpp_test1(abts_case *tc, void *data) -{ - status_t rv; - plmn_id_t plmn_id; - - plmn_id_build(&plmn_id, 1, 1, 2); - ABTS_TRUE(tc, memcmp(plmn_id_build(&plmn_id, 1, 1, 2), "\x00\xf1\x10", - PLMN_ID_LEN) == 0); - - ABTS_INT_EQUAL(tc, 1, plmn_id_mcc(&plmn_id)); - ABTS_INT_EQUAL(tc, 1, plmn_id_mnc(&plmn_id)); - ABTS_INT_EQUAL(tc, 2, plmn_id_mnc_len(&plmn_id)); - - ABTS_TRUE(tc, memcmp(plmn_id_build(&plmn_id, 555, 10, 2), "\x55\xf5\x01", - PLMN_ID_LEN) == 0); - - ABTS_INT_EQUAL(tc, 555, plmn_id_mcc(&plmn_id)); - ABTS_INT_EQUAL(tc, 10, plmn_id_mnc(&plmn_id)); - ABTS_INT_EQUAL(tc, 2, plmn_id_mnc_len(&plmn_id)); -} - -abts_suite *test3gpp(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, _3gpp_test1, NULL); - - return suite; -} diff --git a/lib/core/test/testaes.c b/lib/core/test/testaes.c deleted file mode 100644 index 13577ea10..000000000 --- a/lib/core/test/testaes.c +++ /dev/null @@ -1,392 +0,0 @@ -#include "core_aes.h" -#include "core_aes_cmac.h" -#include "core_pkbuf.h" -#include "testutil.h" - -typedef struct { - unsigned char *key; - unsigned int *rk; - int key_bits; - unsigned char input[16]; - unsigned char cipher_output[16]; - unsigned char decipher_output[16]; -} aes_test_vector_t; - -static void aes_test1(abts_case *tc, void *data) -{ - const int key_bits = 128; - unsigned int rk[RKLENGTH(128)]; - unsigned char key[16] = - "\x00\x01\x02\x03\x05\x06\x07\x08\x0A\x0B\x0C\x0D\x0F\x10\x11\x12"; - unsigned char pt[16] = "\x50\x68\x12\xA4\x5F\x08\xC8\x89\xB9\x7F\x59\x80\x03\x8B\x83\x59"; - unsigned char ct[16]; - unsigned char expected[16] = - "\xD8\xF5\x32\x53\x82\x89\xEF\x7D\x06\xB5\x06\xA4\xFD\x5B\xE9\xC9"; - int nrounds; - int rc; - - nrounds = aes_setup_enc(rk, key, key_bits); - aes_encrypt(rk ,nrounds, pt, ct); - - rc = memcmp(ct, expected, 16); - - ABTS_INT_EQUAL(tc, 0, rc); -} - -static void aes_test2(abts_case *tc, void *data) -{ - unsigned char tmp[16]; - int nrounds; - int rc; - aes_test_vector_t test_vector[3]; - int i; - - - test_vector[0].key_bits = 128; - test_vector[0].key = - core_malloc(sizeof(char)*KEYLENGTH(test_vector[0].key_bits)); - test_vector[0].rk = - core_malloc(sizeof(unsigned int)*RKLENGTH(test_vector[0].key_bits)); - memcpy(test_vector[0].key, - "\x95\xA8\xEE\x8E\x89\x97\x9B\x9E" - "\xFD\xCB\xC6\xEB\x97\x97\x52\x8D", - KEYLENGTH(test_vector[0].key_bits)); - memcpy(test_vector[0].input, - "\x4E\xC1\x37\xA4\x26\xDA\xBF\x8A" - "\xA0\xBE\xB8\xBC\x0C\x2B\x89\xD6", - 16); - memcpy(test_vector[0].cipher_output, - "\xD9\xB6\x5D\x12\x32\xBA\x01\x99" - "\xCD\xBD\x48\x7B\x2A\x1F\xD6\x46", - 16); - memcpy(test_vector[0].decipher_output, - "\x95\x70\xC3\x43\x63\x56\x5B\x39" - "\x35\x03\xA0\x01\xC0\xE2\x3B\x65", - 16); - - test_vector[1].key_bits = 192; - test_vector[1].key = - core_malloc(sizeof(char)*KEYLENGTH(test_vector[1].key_bits)); - test_vector[1].rk = - core_malloc(sizeof(unsigned int)*RKLENGTH(test_vector[1].key_bits)); - memcpy(test_vector[1].key, - "\x95\xA8\xEE\x8E\x89\x97\x9B\x9E" - "\xFD\xCB\xC6\xEB\x97\x97\x52\x8D" - "\x43\x2D\xC2\x60\x61\x55\x38\x18", - KEYLENGTH(test_vector[1].key_bits)); - memcpy(test_vector[1].input , - "\x4E\xC1\x37\xA4\x26\xDA\xBF\x8A" - "\xA0\xBE\xB8\xBC\x0C\x2B\x89\xD6", - 16); - memcpy(test_vector[1].cipher_output, - "\xB1\x8B\xB3\xE7\xE1\x07\x32\xBE" - "\x13\x58\x44\x3A\x50\x4D\xBB\x49", - 16); - memcpy(test_vector[1].decipher_output, - "\x29\xDF\xD7\x5B\x85\xCE\xE4\xDE" - "\x6E\x26\xA8\x08\xCD\xC2\xC9\xC3", - 16); - - test_vector[2].key_bits = 256; - test_vector[2].key = - core_malloc(sizeof(char)*KEYLENGTH(test_vector[2].key_bits)); - test_vector[2].rk = - core_malloc(sizeof(unsigned int)*RKLENGTH(test_vector[2].key_bits)); - memcpy(test_vector[2].key, - "\x95\xA8\xEE\x8E\x89\x97\x9B\x9E" - "\xFD\xCB\xC6\xEB\x97\x97\x52\x8D" - "\x43\x2D\xC2\x60\x61\x55\x38\x18" - "\xEA\x63\x5E\xC5\xD5\xA7\x72\x7E", - KEYLENGTH(test_vector[2].key_bits)); - memcpy(test_vector[2].input , - "\x4E\xC1\x37\xA4\x26\xDA\xBF\x8A" - "\xA0\xBE\xB8\xBC\x0C\x2B\x89\xD6", - 16); - memcpy(test_vector[2].cipher_output, - "\x2F\x9C\xFD\xDB\xFF\xCD\xE6\xB9" - "\xF3\x7E\xF8\xE4\x0D\x51\x2C\xF4", - 16); - memcpy(test_vector[2].decipher_output, - "\x11\x0A\x35\x45\xCE\x49\xB8\x4B" - "\xBB\x7B\x35\x23\x61\x08\xFA\x6E", - 16); - - for (i=0; i<3; i++) - { - nrounds = aes_setup_enc(test_vector[i].rk, test_vector[i].key, - test_vector[i].key_bits); - aes_encrypt(test_vector[i].rk ,nrounds, test_vector[i].input, tmp); - - rc = memcmp(tmp, test_vector[i].cipher_output, 16); - ABTS_INT_EQUAL(tc, 0, rc); - - nrounds = aes_setup_dec(test_vector[i].rk, test_vector[i].key, - test_vector[i].key_bits); - aes_decrypt(test_vector[i].rk ,nrounds, test_vector[i].input, tmp); - rc = memcmp(tmp, test_vector[i].decipher_output, 16); - ABTS_INT_EQUAL(tc, 0, rc); - - CORE_FREE(test_vector[i].key); - CORE_FREE(test_vector[i].rk); - } -} - -#if 0 - Case #1: Encrypting 16 bytes (1 block) using AES-CBC with 128-bit key - Key : 0x06a9214036b8a15b512e03d534120006 - IV : 0x3dafba429d9eb430b422da802c9fac41 - Plaintext : "Single block msg" - Ciphertext: 0xe353779c1079aeb82708942dbe77181a - - Case #2: Encrypting 32 bytes (2 blocks) using AES-CBC with 128-bit key - Key : 0xc286696d887c9aa0611bbb3e2025a45a - IV : 0x562e17996d093d28ddb3ba695a2e6f58 - Plaintext : 0x000102030405060708090a0b0c0d0e0f - 101112131415161718191a1b1c1d1e1f - Ciphertext: 0xd296cd94c2cccf8a3a863028b5e1dc0a - 7586602d253cfff91b8266bea6d61ab1 - - Case #3: Encrypting 48 bytes (3 blocks) using AES-CBC with 128-bit key - Key : 0x6c3ea0477630ce21a2ce334aa746c2cd - IV : 0xc782dc4c098c66cbd9cd27d825682c81 - Plaintext : "This is a 48-byte message (exactly 3 AES blocks)" - Ciphertext: 0xd0a02b3836451753d493665d33f0e886 - 2dea54cdb293abc7506939276772f8d5 - 021c19216bad525c8579695d83ba2684 - - Case #4: Encrypting 64 bytes (4 blocks) using AES-CBC with 128-bit key - Key : 0x56e47a38c5598974bc46903dba290349 - IV : 0x8ce82eefbea0da3c44699ed7db51b7d9 - Plaintext : 0xa0a1a2a3a4a5a6a7a8a9aaabacadaeaf - b0b1b2b3b4b5b6b7b8b9babbbcbdbebf - c0c1c2c3c4c5c6c7c8c9cacbcccdcecf - d0d1d2d3d4d5d6d7d8d9dadbdcdddedf - Ciphertext: 0xc30e32ffedc0774e6aff6af0869f71aa - 0f3af07a9a31a9c684db207eb0ef8e4e - 35907aa632c3ffdf868bb7b29d3d46ad - 83ce9f9a102ee99d49a53e87f4c3da55 -#endif - -typedef struct { - unsigned char key[33]; - int key_bits; - unsigned char ivec[33]; - unsigned char plain[65]; - unsigned int plainlen; - unsigned char cipher[65]; - unsigned int cipherlen; -} aes_cbc_test_vector_t; - -static void aes_test3(abts_case *tc, void *data) -{ - aes_cbc_test_vector_t tv[5] = { - { - "\x06\xa9\x21\x40\x36\xb8\xa1\x5b\x51\x2e\x03\xd5\x34\x12\x00\x06", - 128, - "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30\xb4\x22\xda\x80\x2c\x9f\xac\x41", - "Single block msg", - 16, - "\xe3\x53\x77\x9c\x10\x79\xae\xb8\x27\x08\x94\x2d\xbe\x77\x18\x1a", - 16 - }, { - "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", - 128, - "\x56\x2e\x17\x99\x6d\x09\x3d\x28\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", - 32, - "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a\x3a\x86\x30\x28\xb5\xe1\xdc\x0a" - "\x75\x86\x60\x2d\x25\x3c\xff\xf9\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1", - 32 - }, { - - "\x6c\x3e\xa0\x47\x76\x30\xce\x21\xa2\xce\x33\x4a\xa7\x46\xc2\xcd", - 128, - "\xc7\x82\xdc\x4c\x09\x8c\x66\xcb\xd9\xcd\x27\xd8\x25\x68\x2c\x81", - "This is a 48-byte message (exactly 3 AES blocks)", - 48, - "\xd0\xa0\x2b\x38\x36\x45\x17\x53\xd4\x93\x66\x5d\x33\xf0\xe8\x86" - "\x2d\xea\x54\xcd\xb2\x93\xab\xc7\x50\x69\x39\x27\x67\x72\xf8\xd5" - "\x02\x1c\x19\x21\x6b\xad\x52\x5c\x85\x79\x69\x5d\x83\xba\x26\x84", - 48 - }, { - "\x56\xe4\x7a\x38\xc5\x59\x89\x74\xbc\x46\x90\x3d\xba\x29\x03\x49", - 128, - "\x8c\xe8\x2e\xef\xbe\xa0\xda\x3c\x44\x69\x9e\xd7\xdb\x51\xb7\xd9", - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf", - 64, - "\xc3\x0e\x32\xff\xed\xc0\x77\x4e\x6a\xff\x6a\xf0\x86\x9f\x71\xaa" - "\x0f\x3a\xf0\x7a\x9a\x31\xa9\xc6\x84\xdb\x20\x7e\xb0\xef\x8e\x4e" - "\x35\x90\x7a\xa6\x32\xc3\xff\xdf\x86\x8b\xb7\xb2\x9d\x3d\x46\xad" - "\x83\xce\x9f\x9a\x10\x2e\xe9\x9d\x49\xa5\x3e\x87\xf4\xc3\xda\x55", - 64 - }, { - "\x56\xe4\x7a\x38\xc5\x59\x89\x74\xbc\x46\x90\x3d\xba\x29\x03\x49", - 128, - "\x8c\xe8\x2e\xef\xbe\xa0\xda\x3c\x44\x69\x9e\xd7\xdb\x51\xb7\xd9", - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd", - 62, - "\xc3\x0e\x32\xff\xed\xc0\x77\x4e\x6a\xff\x6a\xf0\x86\x9f\x71\xaa" - "\x0f\x3a\xf0\x7a\x9a\x31\xa9\xc6\x84\xdb\x20\x7e\xb0\xef\x8e\x4e" - "\x35\x90\x7a\xa6\x32\xc3\xff\xdf\x86\x8b\xb7\xb2\x9d\x3d\x46\xad" - "\x5d\x96\x74\x07\xe9\x86\x0c\x0b\x50\x80\x4a\xfb\x69\xc1\x13\xaa", - 64 - } - }; - - unsigned char out[128]; - unsigned int i, rc, outlen; - c_uint8_t ivec[32]; - - for (i = 0; i < 5; i++) - { - outlen = sizeof(out); - memcpy(ivec, tv[i].ivec, 16); - aes_cbc_encrypt(tv[i].key, tv[i].key_bits, ivec, - tv[i].plain, tv[i].plainlen, out, &outlen); - ABTS_INT_EQUAL(tc, tv[i].cipherlen, outlen); - rc = memcmp(tv[i].cipher, out, tv[i].cipherlen); - ABTS_INT_EQUAL(tc, 0, rc); - - outlen = sizeof(out); - memcpy(ivec, tv[i].ivec, 16); - aes_cbc_decrypt(tv[i].key, tv[i].key_bits, ivec, - tv[i].cipher, tv[i].cipherlen, out, &outlen); - ABTS_INT_EQUAL(tc, tv[i].cipherlen, outlen); - rc = memcmp(tv[i].plain, out, tv[i].plainlen); - ABTS_INT_EQUAL(tc, 0, rc); - } -} - -/* RFC 4493 - - -------------------------------------------------- - Subkey Generation - K 2b7e1516 28aed2a6 abf71588 09cf4f3c - AES-128(key,0) 7df76b0c 1ab899b3 3e42f047 b91b546f - K1 fbeed618 35713366 7c85e08f 7236a8de - K2 f7ddac30 6ae266cc f90bc11e e46d513b - -------------------------------------------------- - - -------------------------------------------------- - Example 1: len = 0 - M - AES-CMAC bb1d6929 e9593728 7fa37d12 9b756746 - -------------------------------------------------- - - Example 2: len = 16 - M 6bc1bee2 2e409f96 e93d7e11 7393172a - AES-CMAC 070a16b4 6b4d4144 f79bdd9d d04a287c - -------------------------------------------------- - - Example 3: len = 40 - M 6bc1bee2 2e409f96 e93d7e11 7393172a - ae2d8a57 1e03ac9c 9eb76fac 45af8e51 - 30c81c46 a35ce411 - AES-CMAC dfa66747 de9ae630 30ca3261 1497c827 - -------------------------------------------------- - - Example 4: len = 64 - M 6bc1bee2 2e409f96 e93d7e11 7393172a - ae2d8a57 1e03ac9c 9eb76fac 45af8e51 - 30c81c46 a35ce411 e5fbc119 1a0a52ef - f69f2445 df4f9b17 ad2b417b e66c3710 - AES-CMAC 51f0bebf 7e3b9d92 fc497417 79363cfe - -------------------------------------------------- -*/ - -static void cmac_test(abts_case *tc, void *data) -{ - c_uint8_t key[16] = { - 0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6, - 0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c - }; - - c_uint8_t msg[4][64] = { - { - /* Empty string */ - }, - { - 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, - 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a - }, { - 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, - 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a, - 0xae,0x2d,0x8a,0x57,0x1e,0x03,0xac,0x9c, - 0x9e,0xb7,0x6f,0xac,0x45,0xaf,0x8e,0x51, - 0x30,0xc8,0x1c,0x46,0xa3,0x5c,0xe4,0x11 - }, { - 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, - 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a, - 0xae,0x2d,0x8a,0x57,0x1e,0x03,0xac,0x9c, - 0x9e,0xb7,0x6f,0xac,0x45,0xaf,0x8e,0x51, - 0x30,0xc8,0x1c,0x46,0xa3,0x5c,0xe4,0x11, - 0xe5,0xfb,0xc1,0x19,0x1a,0x0a,0x52,0xef, - 0xf6,0x9f,0x24,0x45,0xdf,0x4f,0x9b,0x17, - 0xad,0x2b,0x41,0x7b,0xe6,0x6c,0x37,0x10 - } - }; - - c_uint32_t msglen[4] = {0, 16, 40, 64}; - - c_uint8_t cmac_answer[4][16] = { - { - 0xbb,0x1d,0x69,0x29,0xe9,0x59,0x37,0x28, - 0x7f,0xa3,0x7d,0x12,0x9b,0x75,0x67,0x46 - }, { - 0x07,0x0a,0x16,0xb4,0x6b,0x4d,0x41,0x44, - 0xf7,0x9b,0xdd,0x9d,0xd0,0x4a,0x28,0x7c - }, { - 0xdf,0xa6,0x67,0x47,0xde,0x9a,0xe6,0x30, - 0x30,0xca,0x32,0x61,0x14,0x97,0xc8,0x27 - }, { - 0x51,0xf0,0xbe,0xbf,0x7e,0x3b,0x9d,0x92, - 0xfc,0x49,0x74,0x17,0x79,0x36,0x3c,0xfe - } - }; - - c_uint8_t cmac[16]; - - int i, rc; - status_t rv; - - for (i = 0; i < 4; i++) - { - rv = aes_cmac_calculate(cmac, key, msg[i], msglen[i]); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rc = memcmp(cmac, cmac_answer[i], 16); - ABTS_INT_EQUAL(tc, 0, rc); - } - - for (i = 0; i < 4; i++) - { - rv = aes_cmac_verify(cmac_answer[i], key, msg[i], msglen[i]); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - } - - key[0] = 0; - for (i = 0; i < 4; i++) - { - rv = aes_cmac_verify(cmac_answer[i], key, msg[i], msglen[i]); - ABTS_INT_EQUAL(tc, ERR_INVALID_CMAC, rv); - } -} - -abts_suite *testaes(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, aes_test1, NULL); - abts_run_test(suite, aes_test2, NULL); - abts_run_test(suite, aes_test3, NULL); - abts_run_test(suite, cmac_test, NULL); - - return suite; -} diff --git a/lib/core/test/testatomic.c b/lib/core/test/testatomic.c deleted file mode 100644 index cf49b4b8e..000000000 --- a/lib/core/test/testatomic.c +++ /dev/null @@ -1,491 +0,0 @@ -#include "core_atomic.h" -#include "core_thread.h" -#include "core_mutex.h" -#include "testutil.h" - -static void test_set32(abts_case *tc, void *data) -{ - c_uint32_t y32; - atomic_set32(&y32, 2); - ABTS_INT_EQUAL(tc, 2, y32); -} - -static void test_read32(abts_case *tc, void *data) -{ - c_uint32_t y32; - atomic_set32(&y32, 2); - ABTS_INT_EQUAL(tc, 2, atomic_read32(&y32)); -} - -static void test_dec32(abts_case *tc, void *data) -{ - c_uint32_t y32; - int rv; - - atomic_set32(&y32, 2); - - rv = atomic_dec32(&y32); - ABTS_INT_EQUAL(tc, 1, y32); - ABTS_ASSERT(tc, "atomic_dec returned zero when it shouldn't", rv != 0); - - rv = atomic_dec32(&y32); - ABTS_INT_EQUAL(tc, 0, y32); - ABTS_ASSERT(tc, "atomic_dec didn't returned zero when it should", rv == 0); -} - -static void test_xchg32(abts_case *tc, void *data) -{ - c_uint32_t oldval; - c_uint32_t y32; - - atomic_set32(&y32, 100); - oldval = atomic_xchg32(&y32, 50); - - ABTS_INT_EQUAL(tc, 100, oldval); - ABTS_INT_EQUAL(tc, 50, y32); -} - -static void test_xchgptr(abts_case *tc, void *data) -{ - int a; - void *ref = "little piggy"; - void *target_ptr = ref; - void *old_ptr; - - old_ptr = atomic_xchgptr(&target_ptr, &a); - ABTS_PTR_EQUAL(tc, ref, old_ptr); - ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr); -} - -static void test_cas_equal(abts_case *tc, void *data) -{ - c_uint32_t casval = 0; - c_uint32_t oldval; - - oldval = atomic_cas32(&casval, 12, 0); - ABTS_INT_EQUAL(tc, 0, oldval); - ABTS_INT_EQUAL(tc, 12, casval); -} - -static void test_cas_equal_nonnull(abts_case *tc, void *data) -{ - c_uint32_t casval = 12; - c_uint32_t oldval; - - oldval = atomic_cas32(&casval, 23, 12); - ABTS_INT_EQUAL(tc, 12, oldval); - ABTS_INT_EQUAL(tc, 23, casval); -} - -static void test_cas_notequal(abts_case *tc, void *data) -{ - c_uint32_t casval = 12; - c_uint32_t oldval; - - oldval = atomic_cas32(&casval, 23, 2); - ABTS_INT_EQUAL(tc, 12, oldval); - ABTS_INT_EQUAL(tc, 12, casval); -} - -static void test_casptr_equal(abts_case *tc, void *data) -{ - int a; - void *target_ptr = NULL; - void *old_ptr; - - old_ptr = atomic_casptr(&target_ptr, &a, NULL); - ABTS_PTR_EQUAL(tc, NULL, old_ptr); - ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr); -} - -static void test_casptr_equal_nonnull(abts_case *tc, void *data) -{ - int a, b; - void *target_ptr = &a; - void *old_ptr; - - old_ptr = atomic_casptr(&target_ptr, &b, &a); - ABTS_PTR_EQUAL(tc, &a, old_ptr); - ABTS_PTR_EQUAL(tc, &b, (void *) target_ptr); -} - -static void test_casptr_notequal(abts_case *tc, void *data) -{ - int a, b; - void *target_ptr = &a; - void *old_ptr; - - old_ptr = atomic_casptr(&target_ptr, &a, &b); - ABTS_PTR_EQUAL(tc, &a, old_ptr); - ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr); -} - -static void test_add32(abts_case *tc, void *data) -{ - c_uint32_t oldval; - c_uint32_t y32; - - atomic_set32(&y32, 23); - oldval = atomic_add32(&y32, 4); - ABTS_INT_EQUAL(tc, 23, oldval); - ABTS_INT_EQUAL(tc, 27, y32); -} - -static void test_add32_neg(abts_case *tc, void *data) -{ - c_uint32_t oldval; - c_uint32_t y32; - - atomic_set32(&y32, 23); - oldval = atomic_add32(&y32, -10); - ABTS_INT_EQUAL(tc, 23, oldval); - ABTS_INT_EQUAL(tc, 13, y32); -} - -static void test_inc32(abts_case *tc, void *data) -{ - c_uint32_t oldval; - c_uint32_t y32; - - atomic_set32(&y32, 23); - oldval = atomic_inc32(&y32); - ABTS_INT_EQUAL(tc, 23, oldval); - ABTS_INT_EQUAL(tc, 24, y32); -} - -static void test_set_add_inc_sub(abts_case *tc, void *data) -{ - c_uint32_t y32; - - atomic_set32(&y32, 0); - atomic_add32(&y32, 20); - atomic_inc32(&y32); - atomic_sub32(&y32, 10); - - ABTS_INT_EQUAL(tc, 11, y32); -} - -static void test_wrap_zero(abts_case *tc, void *data) -{ - c_uint32_t y32; - c_uint32_t rv; - c_uint32_t minus1 = (c_uint32_t)-1; - char str[256];; - - atomic_set32(&y32, 0); - rv = atomic_dec32(&y32); - - ABTS_ASSERT(tc, "atomic_dec32 on zero returned zero.", rv != 0); - sprintf(str, "zero wrap failed: 0 - 1 = %d", y32); - ABTS_ASSERT(tc, str, y32 == minus1); -} - -static void test_inc_neg1(abts_case *tc, void *data) -{ - c_uint32_t y32 = (c_uint32_t)-1; - c_uint32_t minus1 = (c_uint32_t)-1; - c_uint32_t rv; - char str[256]; - - rv = atomic_inc32(&y32); - - ABTS_ASSERT(tc, "atomic_inc32 didn't return the old value.", rv == minus1); - sprintf(str, "zero wrap failed: -1 + 1 = %d", y32); - ABTS_ASSERT(tc, str, y32 == 0); -} - -void *THREAD_FUNC thread_func_mutex(thread_id id, void *data); -void *THREAD_FUNC thread_func_atomic(thread_id id, void *data); - -mutex_id thread_lock; -volatile c_uint32_t mutex_locks = 0; -volatile c_uint32_t atomic_ops = 0; -status_t exit_ret_val = 123; /* just some made up number to check on later */ - -#define NUM_THREADS 40 -#define NUM_ITERATIONS 20000 - -void *THREAD_FUNC thread_func_mutex(thread_id id, void *data) -{ - int i; - - for (i = 0; i < NUM_ITERATIONS; i++) { - mutex_lock(thread_lock); - mutex_locks++; - mutex_unlock(thread_lock); - } - thread_exit(id, exit_ret_val); - return NULL; -} - -void *THREAD_FUNC thread_func_atomic(thread_id id, void *data) -{ - int i; - - for (i = 0; i < NUM_ITERATIONS ; i++) { - atomic_inc32(&atomic_ops); - atomic_add32(&atomic_ops, 2); - atomic_dec32(&atomic_ops); - atomic_dec32(&atomic_ops); - } - thread_exit(id, exit_ret_val); - return NULL; -} - -static void test_atomics_threaded(abts_case *tc, void *data) -{ - thread_id t1[NUM_THREADS]; - thread_id t2[NUM_THREADS]; - status_t rv; - int i; - -#ifdef HAVE_PTHREAD_SETCONCURRENCY - pthread_setconcurrency(8); -#endif - - rv = mutex_create(&thread_lock, MUTEX_DEFAULT); - ABTS_ASSERT(tc, "Could not create lock", rv == CORE_OK) ; - - for (i = 0; i < NUM_THREADS; i++) { - status_t r1, r2; - r1 = thread_create(&t1[i], NULL, thread_func_mutex, NULL); - r2 = thread_create(&t2[i], NULL, thread_func_atomic, NULL); - ABTS_ASSERT(tc, "Failed creating threads", !r1 && !r2); - } - - for (i = 0; i < NUM_THREADS; i++) { - status_t s1, s2; - thread_join(&s1, t1[i]); - thread_join(&s2, t2[i]); - - ABTS_ASSERT(tc, "Invalid return value from thread_join", - s1 == exit_ret_val && s2 == exit_ret_val); - } - - ABTS_INT_EQUAL(tc, NUM_THREADS * NUM_ITERATIONS, mutex_locks); - ABTS_INT_EQUAL(tc, NUM_THREADS * NUM_ITERATIONS, - atomic_read32(&atomic_ops)); - - rv = mutex_delete(thread_lock); - ABTS_ASSERT(tc, "Failed creating threads", rv == CORE_OK); -} - -#undef NUM_THREADS -#define NUM_THREADS 7 - -typedef struct tbox_t tbox_t; - -struct tbox_t { - abts_case *tc; - c_uint32_t *mem; - c_uint32_t preval; - c_uint32_t postval; - c_uint32_t loop; - void (*func)(tbox_t *box); -}; - -static CORE_INLINE void busyloop_read32(tbox_t *tbox) -{ - c_uint32_t val; - - do { - val = atomic_read32(tbox->mem); - - if (val != tbox->preval) - thread_yield(); - else - break; - } while (1); -} - -static void busyloop_set32(tbox_t *tbox) -{ - do { - busyloop_read32(tbox); - atomic_set32(tbox->mem, tbox->postval); - } while (--tbox->loop); -} - -static void busyloop_add32(tbox_t *tbox) -{ - c_uint32_t val; - - do { - busyloop_read32(tbox); - val = atomic_add32(tbox->mem, tbox->postval); - mutex_lock(thread_lock); - ABTS_INT_EQUAL(tbox->tc, val, tbox->preval); - mutex_unlock(thread_lock); - } while (--tbox->loop); -} - -static void busyloop_sub32(tbox_t *tbox) -{ - do { - busyloop_read32(tbox); - atomic_sub32(tbox->mem, tbox->postval); - } while (--tbox->loop); -} - -static void busyloop_inc32(tbox_t *tbox) -{ - c_uint32_t val; - - do { - busyloop_read32(tbox); - val = atomic_inc32(tbox->mem); - mutex_lock(thread_lock); - ABTS_INT_EQUAL(tbox->tc, val, tbox->preval); - mutex_unlock(thread_lock); - } while (--tbox->loop); -} - -static void busyloop_dec32(tbox_t *tbox) -{ - c_uint32_t val; - - do { - busyloop_read32(tbox); - val = atomic_dec32(tbox->mem); - mutex_lock(thread_lock); - ABTS_INT_NEQUAL(tbox->tc, 0, val); - mutex_unlock(thread_lock); - } while (--tbox->loop); -} - -static void busyloop_cas32(tbox_t *tbox) -{ - c_uint32_t val; - - do { - do { - val = atomic_cas32(tbox->mem, tbox->postval, tbox->preval); - - if (val != tbox->preval) - thread_yield(); - else - break; - } while (1); - } while (--tbox->loop); -} - -static void busyloop_xchg32(tbox_t *tbox) -{ - c_uint32_t val; - - do { - busyloop_read32(tbox); - val = atomic_xchg32(tbox->mem, tbox->postval); - mutex_lock(thread_lock); - ABTS_INT_EQUAL(tbox->tc, val, tbox->preval); - mutex_unlock(thread_lock); - } while (--tbox->loop); -} - -static void *THREAD_FUNC thread_func_busyloop(thread_id id, void *data) -{ - tbox_t *tbox = data; - - tbox->func(tbox); - - thread_exit(id, 0); - - return NULL; -} - -static void test_atomics_busyloop_threaded(abts_case *tc, void *data) -{ - unsigned int i; - status_t rv; - c_uint32_t count = 0; - tbox_t tbox[NUM_THREADS]; - thread_id thread[NUM_THREADS]; - - rv = mutex_create(&thread_lock, MUTEX_DEFAULT); - ABTS_ASSERT(tc, "Could not create lock", rv == CORE_OK); - - /* get ready */ - for (i = 0; i < NUM_THREADS; i++) { - tbox[i].tc = tc; - tbox[i].mem = &count; - tbox[i].loop = 50; - } - - tbox[0].preval = 98; - tbox[0].postval = 3891; - tbox[0].func = busyloop_add32; - - tbox[1].preval = 3989; - tbox[1].postval = 1010; - tbox[1].func = busyloop_sub32; - - tbox[2].preval = 2979; - tbox[2].postval = 0; /* not used */ - tbox[2].func = busyloop_inc32; - - tbox[3].preval = 2980; - tbox[3].postval = 16384; - tbox[3].func = busyloop_set32; - - tbox[4].preval = 16384; - tbox[4].postval = 0; /* not used */ - tbox[4].func = busyloop_dec32; - - tbox[5].preval = 16383; - tbox[5].postval = 1048576; - tbox[5].func = busyloop_cas32; - - tbox[6].preval = 1048576; - tbox[6].postval = 98; /* goto tbox[0] */ - tbox[6].func = busyloop_xchg32; - - /* get set */ - for (i = 0; i < NUM_THREADS; i++) { - rv = thread_create(&thread[i], NULL, thread_func_busyloop, - &tbox[i]); - ABTS_ASSERT(tc, "Failed creating thread", rv == CORE_OK); - } - - /* go! */ - atomic_set32(tbox->mem, 98); - - for (i = 0; i < NUM_THREADS; i++) { - status_t retval; - rv = thread_join(&retval, thread[i]); - ABTS_ASSERT(tc, "Thread join failed", rv == CORE_OK); - ABTS_ASSERT(tc, "Invalid return value from thread_join", retval == 0); - } - - ABTS_INT_EQUAL(tbox->tc, 98, count); - - rv = mutex_delete(thread_lock); - ABTS_ASSERT(tc, "Failed creating threads", rv == CORE_OK); -} - -abts_suite *testatomic(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, test_set32, NULL); - abts_run_test(suite, test_read32, NULL); - abts_run_test(suite, test_dec32, NULL); - abts_run_test(suite, test_xchg32, NULL); - abts_run_test(suite, test_xchgptr, NULL); - abts_run_test(suite, test_cas_equal, NULL); - abts_run_test(suite, test_cas_equal_nonnull, NULL); - abts_run_test(suite, test_cas_notequal, NULL); - abts_run_test(suite, test_casptr_equal, NULL); - abts_run_test(suite, test_casptr_equal_nonnull, NULL); - abts_run_test(suite, test_casptr_notequal, NULL); - abts_run_test(suite, test_add32, NULL); - abts_run_test(suite, test_add32_neg, NULL); - abts_run_test(suite, test_inc32, NULL); - abts_run_test(suite, test_set_add_inc_sub, NULL); - abts_run_test(suite, test_wrap_zero, NULL); - abts_run_test(suite, test_inc_neg1, NULL); - - abts_run_test(suite, test_atomics_threaded, NULL); - abts_run_test(suite, test_atomics_busyloop_threaded, NULL); - - return suite; -} diff --git a/lib/core/test/testdir.c b/lib/core/test/testdir.c deleted file mode 100644 index 72206d5d5..000000000 --- a/lib/core/test/testdir.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core_file.h" -#include "testutil.h" - -static void test_mkdir(abts_case *tc, void *data) -{ - status_t rv; - file_info_t finfo; - - rv = dir_make("data/testdir", FILE_UREAD | FILE_UWRITE | FILE_UEXECUTE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_stat(&finfo, "data/testdir", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, FILE_DIR, finfo.filetype); -} - -static void test_mkdir_recurs(abts_case *tc, void *data) -{ - status_t rv; - file_info_t finfo; - - rv = dir_make_recursive("data/one/two/three", - FILE_UREAD | FILE_UWRITE | FILE_UEXECUTE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_stat(&finfo, "data/one", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, FILE_DIR, finfo.filetype); - - rv = file_stat(&finfo, "data/one/two", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, FILE_DIR, finfo.filetype); - - rv = file_stat(&finfo, "data/one/two/three", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, FILE_DIR, finfo.filetype); -} - -static void test_remove(abts_case *tc, void *data) -{ - status_t rv; - file_info_t finfo; - - rv = dir_remove("data/testdir"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_stat(&finfo, "data/testdir", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_ENOENT(rv)); -} - -static void test_removeall_fail(abts_case *tc, void *data) -{ - status_t rv; - - rv = dir_remove("data/one"); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_ENOTEMPTY(rv)); -} - -static void test_removeall(abts_case *tc, void *data) -{ - status_t rv; - - rv = dir_remove("data/one/two/three"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = dir_remove("data/one/two"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = dir_remove("data/one"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static void test_remove_notthere(abts_case *tc, void *data) -{ - status_t rv; - - rv = dir_remove("data/notthere"); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_ENOENT(rv)); -} - -static void test_mkdir_twice(abts_case *tc, void *data) -{ - status_t rv; - - rv = dir_make("data/testdir", FILE_UREAD | FILE_UWRITE | FILE_UEXECUTE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = dir_make("data/testdir", FILE_UREAD | FILE_UWRITE | FILE_UEXECUTE); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_EEXIST(rv)); - - rv = dir_remove("data/testdir"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -abts_suite *testdir(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, test_mkdir, NULL); - abts_run_test(suite, test_mkdir_recurs, NULL); - abts_run_test(suite, test_remove, NULL); - abts_run_test(suite, test_removeall_fail, NULL); - abts_run_test(suite, test_removeall, NULL); - abts_run_test(suite, test_remove_notthere, NULL); - abts_run_test(suite, test_mkdir_twice, NULL); - - return suite; -} diff --git a/lib/core/test/testds.c b/lib/core/test/testds.c deleted file mode 100644 index e626ee344..000000000 --- a/lib/core/test/testds.c +++ /dev/null @@ -1,813 +0,0 @@ -#include "core_pool.h" -#include "core_list.h" -#include "core_queue.h" -#include "core_ringbuf.h" -#include "testutil.h" - - -/***************************************************************************** - * test for core_pool.h - */ -typedef struct { - char m1; - int m2; -} pt_type1; - -#define SIZE_OF_TPOOL1 5 -#define SIZE_OF_TPOOL2 5 - -typedef char type_of_tpool1; -typedef pt_type1 type_of_tpool2; - -pool_declare(tpool1, type_of_tpool1, SIZE_OF_TPOOL1); - -static void pool_test_core1(abts_case *tc, void *data, int start) -{ - int i, j, n; - - type_of_tpool1 *org[SIZE_OF_TPOOL1+1]; - type_of_tpool1 *node[SIZE_OF_TPOOL1+1]; - - pool_init(&tpool1, SIZE_OF_TPOOL1); - - /* Check basic members */ - n = pool_size(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL1, n); - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL1, n); - n = pool_used(&tpool1); - ABTS_INT_EQUAL(tc, 0, n); - - /* Allocation up to start index */ - for (i = 0; i < start; i++) - { - pool_alloc_node(&tpool1, &node[i]); - /* Check not null */ - ABTS_PTR_NOTNULL(tc, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL1 - (i + 1), n); - } - - /* Free all allocated nodes */ - for (i = 0; i < start; i++) - { - pool_free_node(&tpool1, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL1 - start + (i + 1), n); - } - - /* Allocation up to maximum pool size */ - for (i = 0; i < SIZE_OF_TPOOL1; i++) - { - pool_alloc_node(&tpool1, &node[i]); - org[i] = node[i]; - /* Check not null */ - ABTS_PTR_NOTNULL(tc, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL1 - (i + 1), n); - } - - /* Free all allocated */ - for (i = 0; i < SIZE_OF_TPOOL1; i++) - { - pool_free_node(&tpool1, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, i + 1, n); - } - - /* Check that addresses of nodes are same with original ones */ - n = 0; - for (i = 0; i < SIZE_OF_TPOOL1; i++) - { - pool_alloc_node(&tpool1, &node[i]); - for (j = 0; j < SIZE_OF_TPOOL1; j++) - { - if (node[i] == org[j]) - n++; - } - } - - /* Free all allocated */ - for (i = 0; i < SIZE_OF_TPOOL1; i++) - { - pool_free_node(&tpool1, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, i + 1, n); - } - - pool_final(&tpool1); -} - -static void pool_test_core2(abts_case *tc, void *data, int start) -{ - int i, j, n; - - type_of_tpool2 *org[SIZE_OF_TPOOL2+1]; - type_of_tpool2 *node[SIZE_OF_TPOOL2+1]; - - pool_init(&tpool1, SIZE_OF_TPOOL2); - - /* Check basic members */ - n = pool_size(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL2, n); - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL2, n); - n = pool_used(&tpool1); - ABTS_INT_EQUAL(tc, 0, n); - - /* Allocation up to start index */ - for (i = 0; i < start; i++) - { - pool_alloc_node(&tpool1, &node[i]); - /* Check not null */ - ABTS_PTR_NOTNULL(tc, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL2 - (i + 1), n); - } - - /* Free all allocated nodes */ - for (i = 0; i < start; i++) - { - pool_free_node(&tpool1, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL2 - start + (i + 1), n); - } - - /* Allocation up to maximum pool size */ - for (i = 0; i < SIZE_OF_TPOOL2; i++) - { - pool_alloc_node(&tpool1, &node[i]); - org[i] = node[i]; - /* Check not null */ - ABTS_PTR_NOTNULL(tc, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, SIZE_OF_TPOOL2 - (i + 1), n); - } - - /* Free all allocated */ - for (i = 0; i < SIZE_OF_TPOOL2; i++) - { - pool_free_node(&tpool1, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, i + 1, n); - } - - /* Check that addresses of nodes are same with original ones */ - n = 0; - for (i = 0; i < SIZE_OF_TPOOL2; i++) - { - pool_alloc_node(&tpool1, &node[i]); - for (j = 0; j < SIZE_OF_TPOOL2; j++) - { - if (node[i] == org[j]) - n++; - } - } - - /* Free all allocated */ - for (i = 0; i < SIZE_OF_TPOOL2; i++) - { - pool_free_node(&tpool1, node[i]); - /* Check the number of available nodes */ - n = pool_avail(&tpool1); - ABTS_INT_EQUAL(tc, i + 1, n); - } - - pool_final(&tpool1); -} - -static void pool_test1(abts_case *tc, void *data) -{ - int i; - - for (i = 0; i < SIZE_OF_TPOOL1; i++) - pool_test_core1(tc, data, i); -} - -static void pool_test2(abts_case *tc, void *data) -{ - int i; - - for (i = 0; i < SIZE_OF_TPOOL2; i++) - pool_test_core2(tc, data, i); -} - - - -/***************************************************************************** - * test for core_list.h - */ -typedef struct { - lnode_t node; - int m1; -} lt_type1; - -list_t tlist1; - -int lttype1_compare(lt_type1 *pnode1, lt_type1 *pnode2) -{ - if (pnode1->m1 == pnode2->m1) - return 0; - else if (pnode1->m1 < pnode2->m1) - return -1; - else - return 1; -} - -#define SIZE_OF_lt_type1 16 - -static void list_test1(abts_case *tc, void *data) -{ - int i; - - lt_type1 *iter, node[SIZE_OF_lt_type1]; - - for (i = 0; i < SIZE_OF_lt_type1; i++) - node[i].m1 = i; - - /* Initialize head of list */ - list_init(&tlist1); - - /* Check list is empty */ - ABTS_TRUE(tc, list_is_empty(&tlist1)); - - /* Confirm that any node can't be get */ - iter = list_first(&tlist1); - ABTS_PTR_NULL(tc, iter); - - /* Add a node */ - list_append(&tlist1, &node[0]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); - - /* Iterate from the last. And check the pointers */ - iter = list_last(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_prev(iter); - ABTS_PTR_NULL(tc, iter); - - /* Add two nodes */ - list_append(&tlist1, &node[1]); - list_append(&tlist1, &node[2]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); - - /* Iterate from the last. And check the pointers */ - iter = list_last(&tlist1); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_prev(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_prev(iter); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_prev(iter); - ABTS_PTR_NULL(tc, iter); - - /* Remove all nodes */ - list_remove(&tlist1, &node[0]); - list_remove(&tlist1, &node[1]); - list_remove(&tlist1, &node[2]); - - /* Check list is empty */ - ABTS_TRUE(tc, list_is_empty(&tlist1)); -} - -static void list_test2(abts_case *tc, void *data) -{ - int i; - - lt_type1 *iter, node[SIZE_OF_lt_type1]; - - for (i = 0; i < SIZE_OF_lt_type1; i++) - node[i].m1 = i; - - /* Initialize head of list */ - list_init(&tlist1); - - /* Check list is empty */ - ABTS_TRUE(tc, list_is_empty(&tlist1)); - - /* Confirm that any node can't be get */ - iter = list_first(&tlist1); - ABTS_PTR_NULL(tc, iter); - - /* Add a node */ - list_prepend(&tlist1, &node[0]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); - - /* Iterate from the last. And check the pointers */ - iter = list_last(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_prev(iter); - ABTS_PTR_NULL(tc, iter); - - /* Add two nodes */ - list_prepend(&tlist1, &node[1]); - list_prepend(&tlist1, &node[2]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); - - /* Iterate from the last. And check the pointers */ - iter = list_last(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_prev(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_prev(iter); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_prev(iter); - ABTS_PTR_NULL(tc, iter); - - /* Remove all nodes */ - list_remove(&tlist1, &node[2]); - list_remove(&tlist1, &node[1]); - list_remove(&tlist1, &node[0]); - - /* Check list is empty */ - ABTS_TRUE(tc, list_is_empty(&tlist1)); -} - -static void list_test3(abts_case *tc, void *data) -{ - int i; - - lt_type1 *iter, node[SIZE_OF_lt_type1]; - - for (i = 0; i < SIZE_OF_lt_type1; i++) - node[i].m1 = i; - - /* Initialize head of list */ - list_init(&tlist1); - - /* Add three nodes */ - for (i = 0; i < 3; i++) - list_append(&tlist1, &node[i]); - - /* Iterate from the first. And check the pointers */ - i = 0; iter = list_first(&tlist1); - while (iter) - { - ABTS_PTR_EQUAL(tc, &node[i++], iter); - iter = list_next(iter); - } - ABTS_INT_EQUAL(tc, 3, i); - - /* Iterate from the last. And check the pointers */ - i = 0; iter = list_last(&tlist1); - while (iter) - { - ABTS_PTR_EQUAL(tc, &node[3 - (++i)], iter); - iter = list_prev(iter); - } - ABTS_INT_EQUAL(tc, 3, i); - - /* Insert three nodes by list_insert_prev() */ - list_insert_prev(&tlist1, &node[0], &node[3]); - list_insert_prev(&tlist1, &node[1], &node[4]); - list_insert_prev(&tlist1, &node[2], &node[5]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[3], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[4], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[5], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); - - /* Remove three nodes inserted by list_insert_prev() */ - list_remove(&tlist1, &node[3]); - list_remove(&tlist1, &node[4]); - list_remove(&tlist1, &node[5]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); -} - -static void list_test4(abts_case *tc, void *data) -{ - int i; - - lt_type1 *iter, node[SIZE_OF_lt_type1]; - - for (i = 0; i < SIZE_OF_lt_type1; i++) - node[i].m1 = i; - - /* Initialize head of list */ - list_init(&tlist1); - - /* Add three nodes */ - for (i = 0; i < 3; i++) - list_append(&tlist1, &node[i]); - - /* Iterate from the first. And check the pointers */ - i = 0; iter = list_first(&tlist1); - while (iter) - { - ABTS_PTR_EQUAL(tc, &node[i++], iter); - iter = list_next(iter); - } - ABTS_INT_EQUAL(tc, 3, i); - - /* Iterate from the last. And check the pointers */ - i = 0; iter = list_last(&tlist1); - while (iter) - { - ABTS_PTR_EQUAL(tc, &node[3 - (++i)], iter); - iter = list_prev(iter); - } - ABTS_INT_EQUAL(tc, 3, i); - - /* Insert three nodes by list_insert_next() */ - list_insert_next(&tlist1, &node[0], &node[3]); - list_insert_next(&tlist1, &node[1], &node[4]); - list_insert_next(&tlist1, &node[2], &node[5]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[3], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[4], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[5], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); - - /* Remove three nodes inserted by list_insert_next() */ - list_remove(&tlist1, &node[3]); - list_remove(&tlist1, &node[4]); - list_remove(&tlist1, &node[5]); - - /* Iterate from the first. And check the pointers */ - iter = list_first(&tlist1); - ABTS_PTR_EQUAL(tc, &node[0], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[1], iter); - iter = list_next(iter); - ABTS_PTR_EQUAL(tc, &node[2], iter); - iter = list_next(iter); - ABTS_PTR_NULL(tc, iter); -} - -static void list_test5(abts_case *tc, void *data) -{ - int i, j; - - /* List up posssible oders with four nodes */ - int od[24][4] = { - {0,1,2,3}, {0,1,3,2}, {0,2,1,3}, {0,2,3,1}, {0,3,1,2}, {0,3,2,1}, - {1,0,2,3}, {1,0,3,2}, {1,2,0,3}, {1,2,3,0}, {1,3,0,2}, {1,3,2,0}, - {2,1,0,3}, {2,1,3,0}, {2,0,1,3}, {2,0,3,1}, {2,3,1,0}, {2,3,0,1}, - {3,1,2,0}, {3,1,0,2}, {3,2,1,0}, {3,2,0,1}, {3,0,1,2}, {3,0,2,1} - }; - - lt_type1 *iter, node[SIZE_OF_lt_type1]; - - for (i = 0; i < SIZE_OF_lt_type1; i++) - node[i].m1 = i; - - for (i = 0; i < 24; i++) - { - /* Initialize head of list */ - list_init(&tlist1); - - /* Add four nodes using predefined orders */ - for (j = 0; j < 4; j++) - list_insert_sorted(&tlist1, &node[od[i][j]], <type1_compare); - - /* Iterate from the first. And check the SORTED */ - j = 0; iter = list_first(&tlist1); - while (iter) - { - ABTS_INT_EQUAL(tc, iter->m1, j++); - iter = list_next(iter); - } - } -} - - - -/***************************************************************************** - * test for core_queue.h - */ -typedef struct { - int m1; -} qt_type1; - -#define SIZE_OF_TQUE1 4 -#define SIZE_OF_TQUE2 3 - -typedef int type_of_tque1; -typedef qt_type1 type_of_tque2; - -que_declare(tque1, type_of_tque1, SIZE_OF_TQUE1); -que_declare(tque2, type_of_tque2, SIZE_OF_TQUE2); -que_declare(tque3, type_of_tque2 *, SIZE_OF_TQUE2); - -static void que_test1(abts_case *tc, void *data) -{ - int i, r; - - type_of_tque1 n, node[SIZE_OF_TQUE1+1]; - - n = 0; - for (i = 0; i < SIZE_OF_TQUE1; i++) - node[i] = i; - - /* Initialize queue */ - que_init(&tque1, SIZE_OF_TQUE1); - - /* Check basic members */ - ABTS_TRUE(tc, que_is_empty(&tque1)); - ABTS_FALSE(tc, que_is_full(&tque1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TQUE1, que_avail(&tque1)); - ABTS_INT_EQUAL(tc, 0, que_used(&tque1)); - - /* Push a node */ - r = que_push(&tque1, &node[0]); - ABTS_INT_EQUAL(tc, 1, r); - - /* Check queue status */ - ABTS_FALSE(tc, que_is_empty(&tque1)); - ABTS_FALSE(tc, que_is_full(&tque1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TQUE1 - 1, que_avail(&tque1)); - ABTS_INT_EQUAL(tc, 1, que_used(&tque1)); - - /* Pop a node */ - r = que_pop(&tque1, &n); - ABTS_INT_EQUAL(tc, 0, r); - - /* Check queue status */ - ABTS_TRUE(tc, que_is_empty(&tque1)); - ABTS_FALSE(tc, que_is_full(&tque1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TQUE1, que_avail(&tque1)); - ABTS_INT_EQUAL(tc, 0, que_used(&tque1)); - - /* Push nodes up to queue size */ - for (i = 0; i < SIZE_OF_TQUE1; i++) - { - r = que_push(&tque1, &node[i]); - ABTS_INT_EQUAL(tc, i + 1, r); - } - - /* Check queue status */ - ABTS_FALSE(tc, que_is_empty(&tque1)); - ABTS_TRUE(tc, que_is_full(&tque1)); - ABTS_INT_EQUAL(tc, 0, que_avail(&tque1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TQUE1, que_used(&tque1)); - - /* Push a node to full queue */ - r = que_push(&tque1, &node[0]); - ABTS_INT_EQUAL(tc, -1, r); - - /* Pop all pushed nodes and check pop order */ - for (i = 0; i < SIZE_OF_TQUE1; i++) - { - r = que_pop(&tque1, &n); - ABTS_INT_EQUAL(tc, node[i], n); - ABTS_INT_EQUAL(tc, SIZE_OF_TQUE1 - (i + 1), r); - } - - /* Check queue status */ - ABTS_TRUE(tc, que_is_empty(&tque1)); - ABTS_FALSE(tc, que_is_full(&tque1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TQUE1, que_avail(&tque1)); - ABTS_INT_EQUAL(tc, 0, que_used(&tque1)); - - /* Pop a node from empty queue */ - r = que_pop(&tque1, &n); - ABTS_INT_EQUAL(tc, -1, r); -} - - - -/***************************************************************************** - * test for core_ringbuf.h - */ - -#define SIZE_OF_TRBUF1 7 -rbuf_declare(trbuf1, SIZE_OF_TRBUF1); - -#define SIZE_OF_TRBUF2 7 -rbuf_declare_ext(trbuf2); -char trbuf2_ext_buf[SIZE_OF_TRBUF2]; - -static void rbuf_test1(abts_case *tc, void *data) -{ - int i, n; - char wbuf[32]; - char rbuf[32]; - - for (i = 0; i < 26; i++) - wbuf[i] = 'a' + i; - - rbuf_init(&trbuf1, SIZE_OF_TRBUF1); - - /* Check basic members */ - ABTS_TRUE(tc, rbuf_is_empty(&trbuf1)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF1, rbuf_free_bytes(&trbuf1)); - ABTS_INT_EQUAL(tc, 0, rbuf_bytes(&trbuf1)); - - /* Write 3 bytes */ - n = rbuf_write(&trbuf1, wbuf, 3); - ABTS_INT_EQUAL(tc, 3, n); - - /* Check basic members */ - ABTS_FALSE(tc, rbuf_is_empty(&trbuf1)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF1 - 3, rbuf_free_bytes(&trbuf1)); - ABTS_INT_EQUAL(tc, 3, rbuf_bytes(&trbuf1)); - - /* Read 3 bytes */ - n = rbuf_read(&trbuf1, rbuf, 3); rbuf[3] = 0; - ABTS_INT_EQUAL(tc, 3, n); - ABTS_STR_EQUAL(tc, "abc", rbuf); - - /* Check basic members */ - ABTS_TRUE(tc, rbuf_is_empty(&trbuf1)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF1, rbuf_free_bytes(&trbuf1)); - ABTS_INT_EQUAL(tc, 0, rbuf_bytes(&trbuf1)); - - /* Write 3 bytes */ - n = rbuf_write(&trbuf1, wbuf, 3); - ABTS_INT_EQUAL(tc, 3, n); - - /* Write 5 bytes, but only 4 bytes shall be written */ - n = rbuf_write(&trbuf1, wbuf + 3, 5); - ABTS_INT_EQUAL(tc, 4, n); - - /* Write 1 bytes to full buffer */ - n = rbuf_write(&trbuf1, wbuf, 1); - ABTS_INT_EQUAL(tc, -1, n); - - /* Read 2 bytes */ - n = rbuf_read(&trbuf1, rbuf, 2); rbuf[2] = 0; - ABTS_INT_EQUAL(tc, 2, n); - ABTS_STR_EQUAL(tc, "ab", rbuf); - - /* Read 5 bytes */ - n = rbuf_read(&trbuf1, rbuf, 5); rbuf[5] = 0; - ABTS_INT_EQUAL(tc, 5, n); - ABTS_STR_EQUAL(tc, "cdefg", rbuf); - - /* Check basic members */ - ABTS_TRUE(tc, rbuf_is_empty(&trbuf1)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf1)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF1, rbuf_free_bytes(&trbuf1)); - ABTS_INT_EQUAL(tc, 0, rbuf_bytes(&trbuf1)); - - /* Read 1 bytes from empty buffer */ - n = rbuf_read(&trbuf1, rbuf, 1); - ABTS_INT_EQUAL(tc, -1, n); -} - -static void rbuf_test2(abts_case *tc, void *data) -{ - int i, n; - char wbuf[32]; - char rbuf[32]; - - for (i = 0; i < 26; i++) - wbuf[i] = 'a' + i; - - rbuf_init_ext(&trbuf2, SIZE_OF_TRBUF1, trbuf2_ext_buf); - - /* Check basic members */ - ABTS_TRUE(tc, rbuf_is_empty(&trbuf2)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf2)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF2, rbuf_free_bytes(&trbuf2)); - ABTS_INT_EQUAL(tc, 0, rbuf_bytes(&trbuf2)); - - /* Write 3 bytes */ - n = rbuf_write(&trbuf2, wbuf, 3); - ABTS_INT_EQUAL(tc, 3, n); - - /* Check basic members */ - ABTS_FALSE(tc, rbuf_is_empty(&trbuf2)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf2)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF2 - 3, rbuf_free_bytes(&trbuf2)); - ABTS_INT_EQUAL(tc, 3, rbuf_bytes(&trbuf2)); - - /* Read 3 bytes */ - n = rbuf_read(&trbuf2, rbuf, 3); rbuf[3] = 0; - ABTS_INT_EQUAL(tc, 3, n); - ABTS_STR_EQUAL(tc, "abc", rbuf); - - /* Check basic members */ - ABTS_TRUE(tc, rbuf_is_empty(&trbuf2)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf2)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF2, rbuf_free_bytes(&trbuf2)); - ABTS_INT_EQUAL(tc, 0, rbuf_bytes(&trbuf2)); - - /* Write 3 bytes */ - n = rbuf_write(&trbuf2, wbuf, 3); - ABTS_INT_EQUAL(tc, 3, n); - - /* Write 5 bytes, but only 4 bytes shall be written */ - n = rbuf_write(&trbuf2, wbuf + 3, 5); - ABTS_INT_EQUAL(tc, 4, n); - - /* Write 1 bytes to full buffer */ - n = rbuf_write(&trbuf2, wbuf, 1); - ABTS_INT_EQUAL(tc, -1, n); - - /* Read 2 bytes */ - n = rbuf_read(&trbuf2, rbuf, 2); rbuf[2] = 0; - ABTS_INT_EQUAL(tc, 2, n); - ABTS_STR_EQUAL(tc, "ab", rbuf); - - /* Read 5 bytes */ - n = rbuf_read(&trbuf2, rbuf, 5); rbuf[5] = 0; - ABTS_INT_EQUAL(tc, 5, n); - ABTS_STR_EQUAL(tc, "cdefg", rbuf); - - /* Check basic members */ - ABTS_TRUE(tc, rbuf_is_empty(&trbuf2)); - ABTS_FALSE(tc, rbuf_is_full(&trbuf2)); - ABTS_INT_EQUAL(tc, SIZE_OF_TRBUF2, rbuf_free_bytes(&trbuf2)); - ABTS_INT_EQUAL(tc, 0, rbuf_bytes(&trbuf2)); - - /* Read 1 bytes from empty buffer */ - n = rbuf_read(&trbuf2, rbuf, 1); - ABTS_INT_EQUAL(tc, -1, n); - - n = rbuf_skip_write_pos(&trbuf2, 5); - ABTS_INT_EQUAL(tc, 5, n); - n = rbuf_skip_read_pos(&trbuf2, 5); - ABTS_INT_EQUAL(tc, 5, n); -} - -abts_suite *testds(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, pool_test1, NULL); - abts_run_test(suite, pool_test2, NULL); - - abts_run_test(suite, list_test1, NULL); - abts_run_test(suite, list_test2, NULL); - abts_run_test(suite, list_test3, NULL); - abts_run_test(suite, list_test4, NULL); - abts_run_test(suite, list_test5, NULL); - - abts_run_test(suite, que_test1, NULL); - - abts_run_test(suite, rbuf_test1, NULL); - abts_run_test(suite, rbuf_test2, NULL); - - return suite; -} diff --git a/lib/core/test/testfile.c b/lib/core/test/testfile.c deleted file mode 100644 index 9433f96f6..000000000 --- a/lib/core/test/testfile.c +++ /dev/null @@ -1,685 +0,0 @@ -#include "core_file.h" -#include "core_pkbuf.h" -#include "testutil.h" - -#define DIRNAME "data" -#define FILENAME DIRNAME "/file_datafile.txt" -#define TESTSTR "This is the file data file." - -#define TESTREAD_BLKSIZE 1024 -#define FILE_BUFFERSIZE 4096 /* This should match FILE's buffer size. */ - - -static void test_file_init(abts_case *tc, void *data) -{ - status_t rv; - file_info_t finfo; - size_t bytes; - file_t *filetest = NULL; - - rv = dir_make("data", FILE_UREAD | FILE_UWRITE | FILE_UEXECUTE); - - rv = file_stat(&finfo, "data", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, FILE_DIR, finfo.filetype); - - rv = file_open(&filetest, FILENAME, - FILE_WRITE | FILE_CREATE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - bytes = strlen(TESTSTR); - rv = file_write(filetest, TESTSTR, &bytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - file_close(filetest); - -} - -static void test_open_noreadwrite(abts_case *tc, void *data) -{ - status_t rv; - file_t *thefile = NULL; - - rv = file_open(&thefile, FILENAME, - FILE_CREATE | FILE_EXCL, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_TRUE(tc, rv != CORE_OK); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_EACCES(rv)); - ABTS_PTR_EQUAL(tc, NULL, thefile); -} - -static void test_open_excl(abts_case *tc, void *data) -{ - status_t rv; - file_t *thefile = NULL; - - rv = file_open(&thefile, FILENAME, - FILE_CREATE | FILE_EXCL | FILE_WRITE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_TRUE(tc, rv != CORE_OK); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_EEXIST(rv)); - ABTS_PTR_EQUAL(tc, NULL, thefile); -} - -static void test_open_read(abts_case *tc, void *data) -{ - status_t rv; - file_t *filetest = NULL; - - rv = file_open(&filetest, FILENAME, - FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_PTR_NOTNULL(tc, filetest); - file_close(filetest); -} - -static void link_existing(abts_case *tc, void *data) -{ - status_t rv; - - rv = file_link("data/file_datafile.txt", "data/file_datafile2.txt"); - file_remove("data/file_datafile2.txt"); - ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == CORE_OK); -} - -static void link_nonexisting(abts_case *tc, void *data) -{ - status_t rv; - - rv = file_link("data/does_not_exist.txt", "data/fake.txt"); - ABTS_ASSERT(tc, "", rv != CORE_OK); -} - -static void test_read(abts_case *tc, void *data) -{ - status_t rv; - size_t nbytes = 256; - char *str = core_malloc(nbytes + 1); - file_t *filetest = NULL; - - rv = file_open(&filetest, FILENAME, - FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - - CORE_ASSERT_OK(tc, "Opening test file " FILENAME, rv); - rv = file_read(filetest, str, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(TESTSTR), nbytes); - ABTS_STR_EQUAL(tc, TESTSTR, str); - - CORE_FREE(str); - - file_close(filetest); -} - -static void test_readzero(abts_case *tc, void *data) -{ - status_t rv; - size_t nbytes = 0; - char *str = NULL; - file_t *filetest; - - rv = file_open(&filetest, FILENAME, FILE_READ, FILE_OS_DEFAULT); - CORE_ASSERT_OK(tc, "Opening test file " FILENAME, rv); - - rv = file_read(filetest, str, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, 0, nbytes); - - file_close(filetest); -} - -static void test_filename(abts_case *tc, void *data) -{ - const char *str; - status_t rv; - file_t *filetest = NULL; - - rv = file_open(&filetest, FILENAME, - FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - CORE_ASSERT_OK(tc, "Opening test file " FILENAME, rv); - - rv = file_name_get(&str, filetest); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, FILENAME, str); - - file_close(filetest); -} - -static void test_fileclose(abts_case *tc, void *data) -{ - char str; - status_t rv; - size_t one = 1; - file_t *filetest = NULL; - - rv = file_open(&filetest, FILENAME, - FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - CORE_ASSERT_OK(tc, "Opening test file " FILENAME, rv); - - rv = file_close(filetest); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - /* We just closed the file, so this should fail */ - rv = file_read(filetest, &str, &one); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_EBADF(rv)); -} - -static void test_file_remove(abts_case *tc, void *data) -{ - status_t rv; - file_t *filetest = NULL; - - rv = file_remove(FILENAME); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_open(&filetest, FILENAME, FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_ENOENT(rv)); -} - -static void test_open_write(abts_case *tc, void *data) -{ - status_t rv; - file_t *filetest = NULL; - - filetest = NULL; - rv = file_open(&filetest, FILENAME, - FILE_WRITE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, 1, STATUS_IS_ENOENT(rv)); - ABTS_PTR_EQUAL(tc, NULL, filetest); -} - -static void test_open_writecreate(abts_case *tc, void *data) -{ - status_t rv; - file_t *filetest = NULL; - - filetest = NULL; - rv = file_open(&filetest, FILENAME, - FILE_WRITE | FILE_CREATE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - file_close(filetest); -} - -static void test_write(abts_case *tc, void *data) -{ - status_t rv; - size_t bytes = strlen(TESTSTR); - file_t *filetest = NULL; - - rv = file_open(&filetest, FILENAME, - FILE_WRITE | FILE_CREATE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_write(filetest, TESTSTR, &bytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - file_close(filetest); -} - -static void test_open_readwrite(abts_case *tc, void *data) -{ - status_t rv; - file_t *filetest = NULL; - - filetest = NULL; - rv = file_open(&filetest, FILENAME, - FILE_READ | FILE_WRITE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_PTR_NOTNULL(tc, filetest); - - file_close(filetest); -} - -static void test_seek(abts_case *tc, void *data) -{ - status_t rv; - off_t offset = 5; - size_t nbytes = 256; - char *str = core_malloc(nbytes + 1); - file_t *filetest = NULL; - - rv = file_open(&filetest, FILENAME, - FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - CORE_ASSERT_OK(tc, "Open test file " FILENAME, rv); - - rv = file_read(filetest, str, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(TESTSTR), nbytes); - ABTS_STR_EQUAL(tc, TESTSTR, str); - - memset(str, 0, nbytes + 1); - - rv = file_seek(filetest, SEEK_SET, &offset); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_read(filetest, str, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(TESTSTR) - 5, nbytes); - ABTS_STR_EQUAL(tc, TESTSTR + 5, str); - - file_close(filetest); - - /* Test for regression of sign error bug with SEEK_END and - buffered files. */ - rv = file_open(&filetest, FILENAME, - FILE_READ, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - CORE_ASSERT_OK(tc, "Open test file " FILENAME, rv); - - offset = -5; - rv = file_seek(filetest, SEEK_END, &offset); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(TESTSTR) - 5, nbytes); - - memset(str, 0, nbytes + 1); - nbytes = 256; - rv = file_read(filetest, str, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, 5, nbytes); - ABTS_STR_EQUAL(tc, TESTSTR + strlen(TESTSTR) - 5, str); - - CORE_FREE(str); - - file_close(filetest); -} - -static void test_getc(abts_case *tc, void *data) -{ - file_t *f = NULL; - status_t rv; - char ch; - - rv = file_open(&f, FILENAME, FILE_READ, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - file_getc(&ch, f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, (int)TESTSTR[0], (int)ch); - file_close(f); -} - -static void test_gets(abts_case *tc, void *data) -{ - file_t *f = NULL; - status_t rv; - char *str = core_malloc(256); - - rv = file_open(&f, FILENAME, FILE_READ, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_gets(str, 256, f); - /* Only one line in the test file, so FILE will encounter EOF on the first - * call to gets, but we should get CORE_OK on this call and - * CORE_EOF on the next. - */ - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, TESTSTR, str); - rv = file_gets(str, 256, f); - ABTS_INT_EQUAL(tc, CORE_EOF, rv); - ABTS_STR_EQUAL(tc, "", str); - - CORE_FREE(str); - file_close(f); -} - -static void test_bigread(abts_case *tc, void *data) -{ - file_t *f = NULL; - status_t rv; - char buf[FILE_BUFFERSIZE * 2]; - size_t nbytes; - - /* Create a test file with known content. - */ - rv = file_open(&f, "data/created_file", - FILE_CREATE | FILE_WRITE | FILE_TRUNCATE, - FILE_UREAD | FILE_UWRITE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - nbytes = FILE_BUFFERSIZE; - memset(buf, 0xFE, nbytes); - - rv = file_write(f, buf, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, FILE_BUFFERSIZE, nbytes); - - rv = file_close(f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - f = NULL; - rv = file_open(&f, "data/created_file", FILE_READ, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - nbytes = sizeof buf; - rv = file_read(f, buf, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, FILE_BUFFERSIZE, nbytes); - - rv = file_close(f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_remove("data/created_file"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -/* This is a horrible name for this function. We are testing FILE, not how - * Apache uses FILE. And, this function tests _way_ too much stuff. - */ -static void test_mod_neg(abts_case *tc, void *data) -{ - status_t rv; - file_t *f; - const char *s; - int i; - size_t nbytes; - char buf[8192]; - off_t cur; - const char *fname = "data/modneg.dat"; - - rv = file_open(&f, fname, - FILE_CREATE | FILE_WRITE, FILE_UREAD | FILE_UWRITE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - s = "body56789\n"; - nbytes = strlen(s); - rv = file_write(f, s, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); - - for (i = 0; i < 7980; i++) { - s = "0"; - nbytes = strlen(s); - rv = file_write(f, s, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); - } - - s = "end456789\n"; - nbytes = strlen(s); - rv = file_write(f, s, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); - - for (i = 0; i < 10000; i++) { - s = "1"; - nbytes = strlen(s); - rv = file_write(f, s, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); - } - - rv = file_close(f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_open(&f, fname, FILE_READ, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_gets(buf, 11, f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "body56789\n", buf); - - cur = 0; - rv = file_seek(f, FILE_CUR, &cur); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_ASSERT(tc, "File Pointer Mismatch, expected 10", cur == 10); - - nbytes = sizeof(buf); - rv = file_read(f, buf, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, nbytes, sizeof(buf)); - - cur = -((off_t)nbytes - 7980); - rv = file_seek(f, FILE_CUR, &cur); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_ASSERT(tc, "File Pointer Mismatch, expected 7990", cur == 7990); - - rv = file_gets(buf, 11, f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "end456789\n", buf); - - rv = file_close(f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_remove(fname); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -/* Test that the contents of file FNAME are equal to data EXPECT of - * length EXPECTLEN. */ -static void file_contents_equal(abts_case *tc, - const char *fname, - const void *expect, - size_t expectlen) -{ - void *actual = core_malloc(expectlen); - file_t *f; - - CORE_ASSERT_OK(tc, "open file", - file_open(&f, fname, FILE_READ, - 0)); - CORE_ASSERT_OK(tc, "read from file", - file_read_full(f, actual, expectlen, NULL)); - - ABTS_ASSERT(tc, "matched expected file contents", - memcmp(expect, actual, expectlen) == 0); - - CORE_ASSERT_OK(tc, "close file", file_close(f)); - - CORE_FREE(actual); -} - -#define LINE1 "this is a line of text\n" -#define LINE2 "this is a second line of text\n" - -static void test_puts(abts_case *tc, void *data) -{ - file_t *f; - const char *fname = "data/testputs.txt"; - - CORE_ASSERT_OK(tc, "open file for writing", - file_open(&f, fname, - FILE_WRITE|FILE_CREATE|FILE_TRUNCATE, - FILE_OS_DEFAULT)); - CORE_ASSERT_OK(tc, "write line to file", - file_puts(LINE1, f)); - CORE_ASSERT_OK(tc, "write second line to file", - file_puts(LINE2, f)); - - CORE_ASSERT_OK(tc, "close for writing", - file_close(f)); - - file_contents_equal(tc, fname, LINE1 LINE2, strlen(LINE1 LINE2)); -} - -static void test_writev(abts_case *tc, void *data) -{ - file_t *f; - size_t nbytes; - struct iovec vec[5]; - const char *fname = "data/testwritev.txt"; - - CORE_ASSERT_OK(tc, "open file for writing", - file_open(&f, fname, - FILE_WRITE|FILE_CREATE|FILE_TRUNCATE, - FILE_OS_DEFAULT)); - - vec[0].iov_base = LINE1; - vec[0].iov_len = strlen(LINE1); - - CORE_ASSERT_OK(tc, "writev of size 1 to file", - file_writev(f, vec, 1, &nbytes)); - - file_contents_equal(tc, fname, LINE1, strlen(LINE1)); - - vec[0].iov_base = LINE1; - vec[0].iov_len = strlen(LINE1); - vec[1].iov_base = LINE2; - vec[1].iov_len = strlen(LINE2); - vec[2].iov_base = LINE1; - vec[2].iov_len = strlen(LINE1); - vec[3].iov_base = LINE1; - vec[3].iov_len = strlen(LINE1); - vec[4].iov_base = LINE2; - vec[4].iov_len = strlen(LINE2); - - CORE_ASSERT_OK(tc, "writev of size 5 to file", - file_writev(f, vec, 5, &nbytes)); - - CORE_ASSERT_OK(tc, "close for writing", - file_close(f)); - - file_contents_equal(tc, fname, LINE1 LINE1 LINE2 LINE1 LINE1 LINE2, - strlen(LINE1)*4 + strlen(LINE2)*2); - -} - -static void test_writev_full(abts_case *tc, void *data) -{ - file_t *f; - size_t nbytes; - struct iovec vec[5]; - const char *fname = "data/testwritev_full.txt"; - - CORE_ASSERT_OK(tc, "open file for writing", - file_open(&f, fname, - FILE_WRITE|FILE_CREATE|FILE_TRUNCATE, - FILE_OS_DEFAULT)); - - vec[0].iov_base = LINE1; - vec[0].iov_len = strlen(LINE1); - vec[1].iov_base = LINE2; - vec[1].iov_len = strlen(LINE2); - vec[2].iov_base = LINE1; - vec[2].iov_len = strlen(LINE1); - vec[3].iov_base = LINE1; - vec[3].iov_len = strlen(LINE1); - vec[4].iov_base = LINE2; - vec[4].iov_len = strlen(LINE2); - - CORE_ASSERT_OK(tc, "writev_full of size 5 to file", - file_writev_full(f, vec, 5, &nbytes)); - - ABTS_SIZE_EQUAL(tc, strlen(LINE1)*3 + strlen(LINE2)*2, nbytes); - - CORE_ASSERT_OK(tc, "close for writing", - file_close(f)); - - file_contents_equal(tc, fname, LINE1 LINE2 LINE1 LINE1 LINE2, - strlen(LINE1)*3 + strlen(LINE2)*2); - -} - -static void test_truncate(abts_case *tc, void *data) -{ - status_t rv; - file_t *f; - const char *fname = "data/testtruncate.dat"; - const char *s; - size_t nbytes; - file_info_t finfo; - - file_remove(fname); - - rv = file_open(&f, fname, - FILE_CREATE | FILE_WRITE, FILE_UREAD | FILE_UWRITE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - s = "some data"; - nbytes = strlen(s); - rv = file_write(f, s, &nbytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); - - rv = file_close(f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_open(&f, fname, - FILE_TRUNCATE | FILE_WRITE, FILE_UREAD | FILE_UWRITE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_close(f); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = file_stat(&finfo, fname, FILE_INFO_SIZE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_ASSERT(tc, "File size mismatch, expected 0 (empty)", finfo.size == 0); - - rv = file_remove(fname); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static void test_fail_write_flush(abts_case *tc, void *data) -{ - file_t *f; - const char *fname = "data/testflush.dat"; - status_t rv; - char buf[FILE_BUFFERSIZE]; - int n; - - file_remove(fname); - - CORE_ASSERT_OK(tc, "open test file", - file_open(&f, fname, - FILE_CREATE|FILE_READ, - FILE_UREAD|FILE_UWRITE)); - - memset(buf, 'A', sizeof buf); - - /* Try three writes. One of these should fail when it exceeds the - * internal buffer and actually tries to write to the file, which - * was opened read-only and hence should be unwritable. */ - for (n = 0, rv = CORE_OK; n < 4 && rv == CORE_OK; n++) { - size_t bytes = sizeof buf; - rv = file_write(f, buf, &bytes); - } - - ABTS_ASSERT(tc, "failed to write to read-only buffered fd", - rv != CORE_OK); - - file_close(f); -} - -abts_suite *testfile(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, test_file_init, NULL); - abts_run_test(suite, test_open_noreadwrite, NULL); - abts_run_test(suite, test_open_excl, NULL); - abts_run_test(suite, test_open_read, NULL); - abts_run_test(suite, test_open_readwrite, NULL); - abts_run_test(suite, link_existing, NULL); - abts_run_test(suite, link_nonexisting, NULL); - abts_run_test(suite, test_read, NULL); - abts_run_test(suite, test_readzero, NULL); - abts_run_test(suite, test_seek, NULL); - abts_run_test(suite, test_filename, NULL); - abts_run_test(suite, test_fileclose, NULL); - abts_run_test(suite, test_file_remove, NULL); - abts_run_test(suite, test_open_write, NULL); - abts_run_test(suite, test_open_writecreate, NULL); - abts_run_test(suite, test_write, NULL); - abts_run_test(suite, test_getc, NULL); - abts_run_test(suite, test_gets, NULL); - abts_run_test(suite, test_puts, NULL); - abts_run_test(suite, test_writev, NULL); - abts_run_test(suite, test_writev_full, NULL); - abts_run_test(suite, test_bigread, NULL); - abts_run_test(suite, test_mod_neg, NULL); - abts_run_test(suite, test_truncate, NULL); - abts_run_test(suite, test_fail_write_flush, NULL); - - return suite; -} - diff --git a/lib/core/test/testfilecopy.c b/lib/core/test/testfilecopy.c deleted file mode 100644 index 2750bf7ed..000000000 --- a/lib/core/test/testfilecopy.c +++ /dev/null @@ -1,163 +0,0 @@ -#include "core_file.h" -#include "testutil.h" - -#define DIRNAME "data" -#define FILENAME1 DIRNAME "/file_datafile.txt" -#define TESTSTR1 "This is the file data file." -#define FILENAME2 DIRNAME "/mmap_datafile.txt" -#define TESTSTR2 "This is the MMAP data file." - -static void test_filecopy_init(abts_case *tc, void *data) -{ - status_t rv; - file_info_t finfo; - size_t bytes; - file_t *filetest = NULL; - - rv = dir_make("data", FILE_UREAD | FILE_UWRITE | FILE_UEXECUTE); - - rv = file_stat(&finfo, "data", FILE_INFO_TYPE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_INT_EQUAL(tc, FILE_DIR, finfo.filetype); - - rv = file_open(&filetest, FILENAME1, - FILE_WRITE | FILE_CREATE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - bytes = strlen(TESTSTR1); - rv = file_write(filetest, TESTSTR1, &bytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - file_close(filetest); - - rv = file_open(&filetest, FILENAME2, - FILE_WRITE | FILE_CREATE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - bytes = strlen(TESTSTR2); - rv = file_write(filetest, TESTSTR2, &bytes); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - file_close(filetest); -} - -static void copy_helper(abts_case *tc, const char *from, const char * to, - file_perms_t perms, int append) -{ - status_t rv; - status_t dest_rv; - file_info_t copy; - file_info_t orig; - file_info_t dest; - - dest_rv = file_stat(&dest, to, FILE_INFO_SIZE); - - if (!append) { - rv = file_copy(from, to, perms); - } - else { - rv = file_append(from, to, perms); - } - CORE_ASSERT_OK(tc, "Error copying file", rv); - - rv = file_stat(&orig, from, FILE_INFO_SIZE); - CORE_ASSERT_OK(tc, "Couldn't stat original file", rv); - - rv = file_stat(©, to, FILE_INFO_SIZE); - CORE_ASSERT_OK(tc, "Couldn't stat copy file", rv); - - if (!append) { - ABTS_ASSERT(tc, "File size differs", orig.size == copy.size); - } - else { - ABTS_ASSERT(tc, "File size differs", - ((dest_rv == CORE_OK) - ? dest.size : 0) + orig.size == copy.size); - } -} - -static void copy_short_file(abts_case *tc, void *data) -{ - status_t rv; - - /* make absolutely sure that the dest file doesn't exist. */ - file_remove("data/file_copy.txt"); - - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", - FILE_SOURCE_PERMS, 0); - rv = file_remove("data/file_copy.txt"); - CORE_ASSERT_OK(tc, "Couldn't remove copy file", rv); -} - -static void copy_over_existing(abts_case *tc, void *data) -{ - status_t rv; - - /* make absolutely sure that the dest file doesn't exist. */ - file_remove("data/file_copy.txt"); - - /* This is a cheat. I don't want to create a new file, so I just copy - * one file, then I copy another. If the second copy succeeds, then - * this works. - */ - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", - FILE_SOURCE_PERMS, 0); - - copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", - FILE_SOURCE_PERMS, 0); - - rv = file_remove("data/file_copy.txt"); - CORE_ASSERT_OK(tc, "Couldn't remove copy file", rv); -} - -static void append_nonexist(abts_case *tc, void *data) -{ - status_t rv; - - /* make absolutely sure that the dest file doesn't exist. */ - file_remove("data/file_copy.txt"); - - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", - FILE_SOURCE_PERMS, 0); - rv = file_remove("data/file_copy.txt"); - CORE_ASSERT_OK(tc, "Couldn't remove copy file", rv); -} - -static void append_exist(abts_case *tc, void *data) -{ - status_t rv; - - /* make absolutely sure that the dest file doesn't exist. */ - file_remove("data/file_copy.txt"); - - /* This is a cheat. I don't want to create a new file, so I just copy - * one file, then I copy another. If the second copy succeeds, then - * this works. - */ - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", - FILE_SOURCE_PERMS, 0); - - copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", - FILE_SOURCE_PERMS, 1); - - rv = file_remove("data/file_copy.txt"); - CORE_ASSERT_OK(tc, "Couldn't remove copy file", rv); -} - -abts_suite *testfilecopy(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, test_filecopy_init, NULL); - - abts_run_test(suite, copy_short_file, NULL); - abts_run_test(suite, copy_over_existing, NULL); - - abts_run_test(suite, append_nonexist, NULL); - abts_run_test(suite, append_exist, NULL); - - return suite; -} - diff --git a/lib/core/test/testfsm.c b/lib/core/test/testfsm.c deleted file mode 100644 index 2959174ed..000000000 --- a/lib/core/test/testfsm.c +++ /dev/null @@ -1,294 +0,0 @@ -#include "core_fsm.h" -#include "testutil.h" - -enum bomb_signal_t { - UP_SIG = FSM_USER_SIG, - DOWN_SIG, - ARM_SIG -}; - -typedef struct _tick_event_t { - fsm_event_t event; -} tick_event_t; - -typedef struct _bomb_t { - fsm_t fsm; - c_uint8_t timeout; - c_uint8_t code; - c_uint8_t defuse; -} bomb_t; - -void bomb_initial(bomb_t *s, tick_event_t *e); -void bomb_setting(bomb_t *s, tick_event_t *e); -void bomb_timing(bomb_t *s, tick_event_t *e); - -void bomb_create(bomb_t *s, uint8_t defuse) -{ - fsm_create(&s->fsm, &bomb_initial, 0); - s->defuse = defuse; -} - -void bomb_initial(bomb_t *s, tick_event_t *e) -{ - s->timeout = 10; - FSM_TRAN(s, &bomb_setting); -} - -void bomb_setting(bomb_t *s, tick_event_t *e) -{ - switch (e->event) - { - case UP_SIG: - { - if (s->timeout < 12) - { - ++s->timeout; - } - break; - } - case DOWN_SIG: { - if (s->timeout > 8) - { - --s->timeout; - } - break; - } - case ARM_SIG: - { - FSM_TRAN(s, &bomb_timing); - break; - } - } -} - -void bomb_timing(bomb_t *s, tick_event_t *e) -{ - switch (e->event) - { - case FSM_ENTRY_SIG: - { - s->code = 0; - break; - } - case UP_SIG: - { - s->code <<= 1; - s->code |= 1; - break; - } - case DOWN_SIG: - { - s->code <<= 1; - break; - } - case ARM_SIG: - { - if (s->code == s->defuse) - { - FSM_TRAN(s, &bomb_setting); - break; - } - } - } -} - -static void fsm_test1(abts_case *tc, void *data) -{ - bomb_t bomb; - tick_event_t tick_event; - - bomb_create(&bomb, 14); - - fsm_init(&bomb, 0); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 10, bomb.timeout); - - tick_event.event = UP_SIG; - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 11, bomb.timeout); - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 12, bomb.timeout); - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 12, bomb.timeout); - - tick_event.event = DOWN_SIG; - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 11, bomb.timeout); - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 10, bomb.timeout); - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 9, bomb.timeout); - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 8, bomb.timeout); - fsm_dispatch(&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 8, bomb.timeout); - - tick_event.event = ARM_SIG; - fsm_dispatch((fsm_t *)&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_timing, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 0, bomb.code); - - tick_event.event = UP_SIG; - fsm_dispatch((fsm_t *)&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_timing, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 1, bomb.code); - - tick_event.event = UP_SIG; - fsm_dispatch((fsm_t *)&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_timing, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 3, bomb.code); - - tick_event.event = UP_SIG; - fsm_dispatch((fsm_t *)&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_timing, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 7, bomb.code); - - tick_event.event = DOWN_SIG; - fsm_dispatch((fsm_t *)&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_timing, FSM_STATE(&bomb)); - ABTS_INT_EQUAL(tc, 14, bomb.code); - - tick_event.event = ARM_SIG; - fsm_dispatch((fsm_t *)&bomb, &tick_event); - ABTS_PTR_EQUAL(tc, &bomb_setting, FSM_STATE(&bomb)); -} - -enum alarm_signal_t { - TICK_SIG = FSM_USER_SIG, - ALARM_SET_SIG, - ALARM_ON_SIG, - ALARM_OFF_SIG, - ALARM_SIG, - CLOCK_12H_SIG, - CLOCK_24H_SIG, - TIME_SIG, - TERMINATE_SIG -}; - -typedef struct _alarm_t { - fsm_t fsm; - c_uint32_t time; -} alarm_t; - -typedef struct _set_event_t { - fsm_event_t event; - c_uint8_t digit; -} set_event_t; - -typedef struct _time_event_t { - fsm_event_t event; - c_uint8_t current_time; -} time_event_t; - -void alarm_initial(alarm_t *s, set_event_t *e); -void alarm_off(alarm_t *s, set_event_t *e); -void alarm_on(alarm_t *s, time_event_t *e); - -void alarm_initial(alarm_t *s, set_event_t *e) -{ - s->time = 12*60; - FSM_TRAN(s, &alarm_off); -} - -void alarm_off(alarm_t *s, set_event_t *e) -{ - switch (e->event) - { - case FSM_ENTRY_SIG: - { - s->time = (s->time/60)*100 + s->time%60; - break; - } - case FSM_EXIT_SIG: - { - s->time = (s->time/100)*60 + s->time%100; - break; - } - case ALARM_ON_SIG: - { - FSM_TRAN(s, &alarm_on); - break; - } - case ALARM_SET_SIG: - { - c_uint32_t alarm = (10 * s->time - + e->digit) % 10000; - if ((alarm / 100 < 24) && (alarm % 100 < 60)) - { - s->time = alarm; - } - else - { - s->time = 0; - } - break; - } - } -} - -void alarm_on(alarm_t *s, time_event_t *e) -{ - switch (e->event) - { - case FSM_ENTRY_SIG: - { - break; - } - case ALARM_SET_SIG: - { - break; - } - case ALARM_OFF_SIG: - { - FSM_TRAN(s, &alarm_off); - break; - } - } -} - -static void fsm_test2(abts_case *tc, void *data) -{ - alarm_t alarm; - set_event_t set_event; - time_event_t time_event; - - fsm_create(&alarm.fsm, &alarm_initial, 0); - - fsm_init(&alarm, 0); - ABTS_PTR_EQUAL(tc, &alarm_off, FSM_STATE(&alarm)); - ABTS_INT_EQUAL(tc, 1200, alarm.time); - - set_event.event = ALARM_ON_SIG; - fsm_dispatch(&alarm, &set_event); - ABTS_PTR_EQUAL(tc, &alarm_on, FSM_STATE(&alarm)); - ABTS_INT_EQUAL(tc, 720, alarm.time); - - time_event.event = ALARM_OFF_SIG; - fsm_dispatch(&alarm, &time_event); - ABTS_PTR_EQUAL(tc, &alarm_off, FSM_STATE(&alarm)); - ABTS_INT_EQUAL(tc, 1200, alarm.time); - - set_event.event = ALARM_SET_SIG; - set_event.digit = 0; - fsm_dispatch(&alarm, &set_event); - ABTS_PTR_EQUAL(tc, &alarm_off, FSM_STATE(&alarm)); - ABTS_INT_EQUAL(tc, 2000, alarm.time); -} - -abts_suite *testfsm(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, fsm_test1, NULL); - abts_run_test(suite, fsm_test2, NULL); - - return suite; -} diff --git a/lib/core/test/testhash.c b/lib/core/test/testhash.c deleted file mode 100644 index d2779304b..000000000 --- a/lib/core/test/testhash.c +++ /dev/null @@ -1,393 +0,0 @@ -#include "testutil.h" -#include "core_hash.h" - -#define MAX_LTH 256 -#define MAX_DEPTH 11 - -static int comp_string(const void *str1, const void *str2) -{ - return strcmp(str1,str2); -} - -static void dump_hash(hash_t *h, char str[][MAX_LTH]) -{ - hash_index_t *hi; - int i = 0; - - for (hi = hash_first(h); hi; hi = hash_next(hi)) { - const char *key = hash_this_key(hi); - int len = hash_this_key_len(hi); - char *val = hash_this_val(hi); - - str[i][0]='\0'; - sprintf(str[i], "%sKey %s (%d) Value %s\n", - str[i], key, len, val); - i++; - } - str[i][0]='\0'; - sprintf(str[i], "%s#entries %d\n", str[i], i); - - /* Sort the result strings so that they can be checked for expected results easily, - * without having to worry about platform quirks - */ - qsort( - str, /* Pointer to elements */ - i, /* number of elements */ - MAX_LTH, /* size of one element */ - comp_string /* Pointer to comparison routine */ - ); -} - -static void sum_hash(hash_t *h, int *pcount, int *keySum, int *valSum) -{ - hash_index_t *hi; - void *val, *key; - int count = 0; - - *keySum = 0; - *valSum = 0; - *pcount = 0; - for (hi = hash_first(h); hi; hi = hash_next(hi)) { - hash_this(hi, (void*)&key, NULL, &val); - *valSum += *(int *)val; - *keySum += *(int *)key; - count++; - } - *pcount=count; -} - -static void hash_make_test(abts_case *tc, void *data) -{ - hash_t *h = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_destroy(h); -} - -static void hash_set_test(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "key", HASH_KEY_STRING, "value"); - result = hash_get(h, "key", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "value", result); - - hash_destroy(h); -} - -static void hash_get_or_set_test(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - result = hash_get_or_set(h, "key", HASH_KEY_STRING, "value"); - ABTS_STR_EQUAL(tc, "value", result); - - result = hash_get_or_set(h, "key", HASH_KEY_STRING, "other"); - ABTS_STR_EQUAL(tc, "value", result); - - result = hash_get_or_set(h, "key", HASH_KEY_STRING, NULL); - ABTS_STR_EQUAL(tc, "value", result); - - hash_set(h, "key", HASH_KEY_STRING, NULL); - result = hash_get(h, "key", HASH_KEY_STRING); - ABTS_PTR_EQUAL(tc, NULL, result); - - result = hash_get_or_set(h, "key", HASH_KEY_STRING, NULL); - ABTS_PTR_EQUAL(tc, NULL, result); - - result = hash_get_or_set(h, "key", HASH_KEY_STRING, "other"); - ABTS_STR_EQUAL(tc, "other", result); - - hash_destroy(h); -} - -static void hash_reset(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "key", HASH_KEY_STRING, "value"); - result = hash_get(h, "key", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "value", result); - - hash_set(h, "key", HASH_KEY_STRING, "new"); - result = hash_get(h, "key", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "new", result); - - hash_destroy(h); -} - -static void same_value(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "same1", HASH_KEY_STRING, "same"); - result = hash_get(h, "same1", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "same", result); - - hash_set(h, "same2", HASH_KEY_STRING, "same"); - result = hash_get(h, "same2", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "same", result); - - hash_destroy(h); -} - -static unsigned int hash_custom( const char *key, int *klen) -{ - unsigned int hash = 0; - unsigned int len = *klen; - while( len ) { - (len) --; - hash = hash * 33 + key[ len ]; - } - return hash; -} - -static void same_value_custom(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make_custom(hash_custom); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "same1", 5, "same"); - result = hash_get(h, "same1", 5); - ABTS_STR_EQUAL(tc, "same", result); - - hash_set(h, "same2", 5, "same"); - result = hash_get(h, "same2", 5); - ABTS_STR_EQUAL(tc, "same", result); - - hash_destroy(h); -} - -static void key_space(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "key with space", HASH_KEY_STRING, "value"); - result = hash_get(h, "key with space", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "value", result); - - hash_destroy(h); -} - -static void hash_clear_test(abts_case *tc, void *data) -{ - hash_t *h; - int num[10], i; - int c; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - for (i = 0; i < 10; i++) - { - num[i] = i; - hash_set(h, &num[i], sizeof(num[i]), &num[i]); - } - c = hash_count(h); - ABTS_INT_EQUAL(tc, 10, c); - - hash_clear(h); - c = hash_count(h); - ABTS_INT_EQUAL(tc, 0, c); - - hash_destroy(h); -} - -/* This is kind of a hack, but I am just keeping an existing test. This is - * really testing hash_first, hash_next, and hash_this which - * should be tested in three separate tests, but this will do for now. - */ -static void hash_traverse(abts_case *tc, void *data) -{ - hash_t *h; - char StrArray[MAX_DEPTH][MAX_LTH]; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "OVERWRITE", HASH_KEY_STRING, "should not see this"); - hash_set(h, "FOO3", HASH_KEY_STRING, "bar3"); - hash_set(h, "FOO3", HASH_KEY_STRING, "bar3"); - hash_set(h, "FOO1", HASH_KEY_STRING, "bar1"); - hash_set(h, "FOO2", HASH_KEY_STRING, "bar2"); - hash_set(h, "FOO4", HASH_KEY_STRING, "bar4"); - hash_set(h, "SAME1", HASH_KEY_STRING, "same"); - hash_set(h, "SAME2", HASH_KEY_STRING, "same"); - hash_set(h, "OVERWRITE", HASH_KEY_STRING, "Overwrite key"); - - dump_hash(h, StrArray); - - ABTS_STR_EQUAL(tc, "Key FOO1 (4) Value bar1\n", StrArray[0]); - ABTS_STR_EQUAL(tc, "Key FOO2 (4) Value bar2\n", StrArray[1]); - ABTS_STR_EQUAL(tc, "Key FOO3 (4) Value bar3\n", StrArray[2]); - ABTS_STR_EQUAL(tc, "Key FOO4 (4) Value bar4\n", StrArray[3]); - ABTS_STR_EQUAL(tc, "Key OVERWRITE (9) Value Overwrite key\n", StrArray[4]); - ABTS_STR_EQUAL(tc, "Key SAME1 (5) Value same\n", StrArray[5]); - ABTS_STR_EQUAL(tc, "Key SAME2 (5) Value same\n", StrArray[6]); - ABTS_STR_EQUAL(tc, "#entries 7\n", StrArray[7]); - - hash_destroy(h); -} - -/* This is kind of a hack, but I am just keeping an existing test. This is - * really testing hash_first, hash_next, and hash_this which - * should be tested in three separate tests, but this will do for now. - */ -static void summation_test(abts_case *tc, void *data) -{ - hash_t *h; - int sumKeys, sumVal, trySumKey, trySumVal; - int i, j, val[100], key[100]; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - sumKeys = 0; - sumVal = 0; - trySumKey = 0; - trySumVal = 0; - - for (i = 0; i < 100; i++) { - j = i * 10 + 1; - sumKeys += j; - sumVal += i; - key[i] = j; - val[i] = i; - hash_set(h, &key[i], sizeof(int), &val[i]); - } - - sum_hash(h, &i, &trySumKey, &trySumVal); - ABTS_INT_EQUAL(tc, 100, i); - ABTS_INT_EQUAL(tc, sumVal, trySumVal); - ABTS_INT_EQUAL(tc, sumKeys, trySumKey); - - hash_destroy(h); -} - -static void delete_key(abts_case *tc, void *data) -{ - hash_t *h = NULL; - char *result = NULL; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "key", HASH_KEY_STRING, "value"); - hash_set(h, "key2", HASH_KEY_STRING, "value2"); - - result = hash_get(h, "key", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "value", result); - - result = hash_get(h, "key2", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "value2", result); - - hash_set(h, "key", HASH_KEY_STRING, NULL); - - result = hash_get(h, "key", HASH_KEY_STRING); - ABTS_PTR_EQUAL(tc, NULL, result); - - result = hash_get(h, "key2", HASH_KEY_STRING); - ABTS_STR_EQUAL(tc, "value2", result); - - hash_destroy(h); -} - -static void hash_count_0(abts_case *tc, void *data) -{ - hash_t *h = NULL; - int count; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - count = hash_count(h); - ABTS_INT_EQUAL(tc, 0, count); - - hash_destroy(h); -} - -static void hash_count_1(abts_case *tc, void *data) -{ - hash_t *h = NULL; - int count; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "key", HASH_KEY_STRING, "value"); - - count = hash_count(h); - ABTS_INT_EQUAL(tc, 1, count); - - hash_destroy(h); -} - -static void hash_count_5(abts_case *tc, void *data) -{ - hash_t *h = NULL; - int count; - - h = hash_make(); - ABTS_PTR_NOTNULL(tc, h); - - hash_set(h, "key1", HASH_KEY_STRING, "value1"); - hash_set(h, "key2", HASH_KEY_STRING, "value2"); - hash_set(h, "key3", HASH_KEY_STRING, "value3"); - hash_set(h, "key4", HASH_KEY_STRING, "value4"); - hash_set(h, "key5", HASH_KEY_STRING, "value5"); - - count = hash_count(h); - ABTS_INT_EQUAL(tc, 5, count); - - hash_destroy(h); -} - -abts_suite *testhash(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, hash_make_test, NULL); - abts_run_test(suite, hash_set_test, NULL); - abts_run_test(suite, hash_get_or_set_test, NULL); - abts_run_test(suite, hash_reset, NULL); - abts_run_test(suite, same_value, NULL); - abts_run_test(suite, same_value_custom, NULL); - abts_run_test(suite, key_space, NULL); - abts_run_test(suite, delete_key, NULL); - - abts_run_test(suite, hash_count_0, NULL); - abts_run_test(suite, hash_count_1, NULL); - abts_run_test(suite, hash_count_5, NULL); - - abts_run_test(suite, hash_clear_test, NULL); - abts_run_test(suite, hash_traverse, NULL); - abts_run_test(suite, summation_test, NULL); - - return suite; -} - diff --git a/lib/core/test/testlock.c b/lib/core/test/testlock.c deleted file mode 100644 index f93929294..000000000 --- a/lib/core/test/testlock.c +++ /dev/null @@ -1,393 +0,0 @@ -#include "core_thread.h" -#include "core_mutex.h" -#include "core_cond.h" -#include "core_rwlock.h" -#include "core_semaphore.h" -#include "core_time.h" -#include "testutil.h" - -#define MAX_ITER 40000 -#define MAX_COUNTER 10000 -#define MAX_RETRY 3 - -static void *THREAD_FUNC thread_rwlock_func(thread_id id, void *data); -static void *THREAD_FUNC thread_mutex_function(thread_id id, void *data); -static void *THREAD_FUNC thread_cond_producer(thread_id id, void *data); -static void *THREAD_FUNC thread_cond_consumer(thread_id id, void *data); - -static mutex_id mutex; -static rwlock_id rwlock; -static semaphore_id semaphore; -static int i = 0, x = 0; - -static int buff[MAX_COUNTER]; - -struct { - mutex_id mutex; - int nput; - int nval; -} put; - -struct { - mutex_id mutex; - cond_id cond; - int nready; -} nready; - -static mutex_id timeout_mutex; -static cond_id timeout_cond; - -static void *THREAD_FUNC thread_rwlock_func(thread_id id, void *data) -{ - int exitLoop = 1; - - while (1) - { - rwlock_rdlock(rwlock); - if (i == MAX_ITER) - exitLoop = 0; - rwlock_unlock(rwlock); - - if (!exitLoop) - break; - - rwlock_wrlock(rwlock); - if (i != MAX_ITER) - { - i++; - x++; - } - rwlock_unlock(rwlock); - } - return NULL; -} - -static void *THREAD_FUNC thread_mutex_function(thread_id id, void *data) -{ - int exitLoop = 1; - - /* slight delay to allow things to settle */ - core_sleep (1); - - while (1) - { - mutex_lock(mutex); - if (i == MAX_ITER) - exitLoop = 0; - else - { - i++; - x++; - } - mutex_unlock(mutex); - - if (!exitLoop) - break; - } - return NULL; -} - -static void *THREAD_FUNC thread_cond_producer(thread_id id, void *data) -{ - for (;;) - { - mutex_lock(put.mutex); - if (put.nput >= MAX_COUNTER) - { - mutex_unlock(put.mutex); - return NULL; - } - buff[put.nput] = put.nval; - put.nput++; - put.nval++; - mutex_unlock(put.mutex); - - mutex_lock(nready.mutex); - if (nready.nready == 0) - cond_signal(nready.cond); - nready.nready++; - mutex_unlock(nready.mutex); - - *((int *) data) += 1; - } - - return NULL; -} - -static void *THREAD_FUNC thread_cond_consumer(thread_id id, void *data) -{ - int i; - - for (i = 0; i < MAX_COUNTER; i++) - { - mutex_lock(nready.mutex); - while (nready.nready == 0) - cond_wait(nready.cond, nready.mutex); - nready.nready--; - mutex_unlock(nready.mutex); - - if (buff[i] != i) - printf("buff[%d] = %d\n", i, buff[i]); - } - - return NULL; -} - -static void *THREAD_FUNC thread_semaphore_function(thread_id id, void *data) -{ - int exitLoop = 1; - - /* slight delay to allow things to settle */ - core_sleep (1); - - while (1) - { - semaphore_wait(semaphore); - if (i == MAX_ITER) - exitLoop = 0; - else - { - i++; - x++; - } - semaphore_post(semaphore); - - if (!exitLoop) - break; - } - return NULL; -} - -static void test_mutex(abts_case *tc, void *data) -{ - thread_id t1, t2, t3, t4; - status_t s1, s2, s3, s4; - - s1 = mutex_create(&mutex, MUTEX_DEFAULT); - ABTS_INT_EQUAL(tc, CORE_OK, s1); - - i = 0; - x = 0; - - s1 = thread_create(&t1, NULL, thread_mutex_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s1); - s2 = thread_create(&t2, NULL, thread_mutex_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s2); - s3 = thread_create(&t3, NULL, thread_mutex_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s3); - s4 = thread_create(&t4, NULL, thread_mutex_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s4); - - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t1)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t2)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t3)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t4)); - - ABTS_INT_EQUAL(tc, MAX_ITER, x); - - CORE_ASSERT_OK(tc, "delete mutex", mutex_delete(mutex)); -} - -static void test_thread_rwlock(abts_case *tc, void *data) -{ - thread_id t1, t2, t3, t4; - status_t s1, s2, s3, s4; - - s1 = rwlock_create(&rwlock); - if (s1 == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "rwlocks not implemented"); - return; - } - CORE_ASSERT_OK(tc, "rwlock_create", s1); - - i = 0; - x = 0; - - s1 = thread_create(&t1, NULL, thread_rwlock_func, NULL); - CORE_ASSERT_OK(tc, "create thread 1", s1); - s2 = thread_create(&t2, NULL, thread_rwlock_func, NULL); - CORE_ASSERT_OK(tc, "create thread 2", s2); - s3 = thread_create(&t3, NULL, thread_rwlock_func, NULL); - CORE_ASSERT_OK(tc, "create thread 3", s3); - s4 = thread_create(&t4, NULL, thread_rwlock_func, NULL); - CORE_ASSERT_OK(tc, "create thread 4", s4); - - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t1)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t2)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t3)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t4)); - - ABTS_INT_EQUAL(tc, MAX_ITER, x); - - CORE_ASSERT_OK(tc, "delete rwlock", rwlock_delete(rwlock)); -} - -static void test_cond(abts_case *tc, void *data) -{ - thread_id p1, p2, p3, p4, c1; - status_t s0, s1, s2, s3, s4; - int count1, count2, count3, count4; - int sum; - - CORE_ASSERT_OK(tc, "create put mutex", - mutex_create(&put.mutex, MUTEX_DEFAULT)); - - CORE_ASSERT_OK(tc, "create nready mutex", - mutex_create(&nready.mutex, MUTEX_DEFAULT)); - - CORE_ASSERT_OK(tc, "create condvar", - cond_create(&nready.cond)); - - count1 = count2 = count3 = count4 = 0; - put.nput = put.nval = 0; - nready.nready = 0; - i = 0; - x = 0; - - s0 = thread_create(&p1, NULL, thread_cond_producer, &count1); - ABTS_INT_EQUAL(tc, CORE_OK, s0); - s1 = thread_create(&p2, NULL, thread_cond_producer, &count2); - ABTS_INT_EQUAL(tc, CORE_OK, s1); - s2 = thread_create(&p3, NULL, thread_cond_producer, &count3); - ABTS_INT_EQUAL(tc, CORE_OK, s2); - s3 = thread_create(&p4, NULL, thread_cond_producer, &count4); - ABTS_INT_EQUAL(tc, CORE_OK, s3); - s4 = thread_create(&c1, NULL, thread_cond_consumer, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s4); - - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(p1)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(p2)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(p3)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(p4)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(c1)); - - CORE_ASSERT_OK(tc, "delete condvar", - cond_delete(nready.cond)); - CORE_ASSERT_OK(tc, "delete ready mutex", mutex_delete(nready.mutex)); - CORE_ASSERT_OK(tc, "delete put mutex", mutex_delete(put.mutex)); - - sum = count1 + count2 + count3 + count4; - ABTS_INT_EQUAL(tc, MAX_COUNTER, sum); -} - -static void test_timeoutcond(abts_case *tc, void *data) -{ - status_t s; - c_time_t timeout; - c_time_t begin, end; - int i; - - s = mutex_create(&timeout_mutex, MUTEX_DEFAULT); - ABTS_INT_EQUAL(tc, CORE_OK, s); - - s = cond_create(&timeout_cond); - ABTS_INT_EQUAL(tc, CORE_OK, s); - - timeout = time_from_sec(1); - - for (i = 0; i < MAX_RETRY; i++) - { - mutex_lock(timeout_mutex); - - begin = time_now(); - s = cond_timedwait(timeout_cond, timeout_mutex, timeout); - end = time_now(); - mutex_unlock(timeout_mutex); - - if (s != CORE_OK && !STATUS_IS_TIMEUP(s)) - { - continue; - } - ABTS_INT_EQUAL(tc, 1, STATUS_IS_TIMEUP(s)); - ABTS_ASSERT(tc, - "Timer returned too late", end - begin - timeout < 100000); - break; - } - ABTS_ASSERT(tc, "Too many retries", i < MAX_RETRY); - CORE_ASSERT_OK(tc, "Unable to delete the conditional", - cond_delete(timeout_cond)); - CORE_ASSERT_OK(tc, "Unable to delete the mutex", - mutex_delete(timeout_mutex)); -} - -static void test_semaphore(abts_case *tc, void *data) -{ - thread_id t1, t2, t3, t4; - status_t s1, s2, s3, s4; - - s1 = semaphore_create(&semaphore, 1); - ABTS_INT_EQUAL(tc, CORE_OK, s1); - - i = 0; - x = 0; - - s1 = thread_create(&t1, NULL, thread_semaphore_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s1); - s2 = thread_create(&t2, NULL, thread_semaphore_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s2); - s3 = thread_create(&t3, NULL, thread_semaphore_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s3); - s4 = thread_create(&t4, NULL, thread_semaphore_function, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, s4); - - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t1)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t2)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t3)); - ABTS_INT_EQUAL(tc, CORE_OK, thread_delete(t4)); - - ABTS_INT_EQUAL(tc, MAX_ITER, x); - - CORE_ASSERT_OK(tc, "delete semaphore", semaphore_delete(semaphore)); -} - -#if HAVE_SEM_TIMEDWAIT -static semaphore_id timeout_semaphore; -static void test_timeoutsemaphore(abts_case *tc, void *data) -{ - status_t s; - c_time_t timeout; - c_time_t begin, end; - int i; - - s = semaphore_create(&timeout_semaphore, 0); - ABTS_INT_EQUAL(tc, CORE_OK, s); - - timeout = time_from_sec(1); - - for (i = 0; i < MAX_RETRY; i++) - { - begin = time_now(); - s = semaphore_timedwait(timeout_semaphore, timeout); - end = time_now(); - - if (s != CORE_OK && !STATUS_IS_TIMEUP(s)) - { - continue; - } - ABTS_INT_EQUAL(tc, 1, STATUS_IS_TIMEUP(s)); - ABTS_ASSERT(tc, - "Timer returned too late", end - begin - timeout < 100000); - break; - } - ABTS_ASSERT(tc, "Too many retries", i < MAX_RETRY); - CORE_ASSERT_OK(tc, "Unable to delete the semaphore", - semaphore_delete(timeout_semaphore)); -} -#endif - -abts_suite *testlock(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, test_mutex, NULL); - abts_run_test(suite, test_thread_rwlock, NULL); - abts_run_test(suite, test_cond, NULL); - abts_run_test(suite, test_timeoutcond, NULL); - abts_run_test(suite, test_semaphore, NULL); -#if HAVE_SEM_TIMEDWAIT - abts_run_test(suite, test_timeoutsemaphore, NULL); -#endif - - return suite; -} diff --git a/lib/core/test/testmisc.c b/lib/core/test/testmisc.c deleted file mode 100644 index 80af4e1aa..000000000 --- a/lib/core/test/testmisc.c +++ /dev/null @@ -1,202 +0,0 @@ -#include "core_lib.h" -#include "core_debug.h" - -#include "testutil.h" - -static void misc_test1(abts_case *tc, void *data) -{ - unsigned char c[42]; - ABTS_INT_EQUAL(tc, CORE_OK, core_generate_random_bytes(c, sizeof c)); -} - -static void misc_test2(abts_case *tc, void *data) -{ -#define K "4 6 5B5 CE8 B199B49FAA5F0A2EE238A6BC " -#define OP "5F1D289C 5D354D0A 140C2548 F5F3E3BA" -#define OPc "E8ED2 89D EBA9 52E4 283B 54E8 8E61 83CA" -#define AMF "8000" - c_uint8_t k[16] = "\x46\x5B\x5C\xE8\xB1\x99\xB4\x9F\xAA\x5F\x0A\x2E\xE2\x38\xA6\xBC"; - c_uint8_t op[16] = "\x5F\x1D\x28\x9C\x5D\x35\x4D\x0A\x14\x0C\x25\x48\xF5\xF3\xE3\xBA"; - c_uint8_t opc[16] = "\xE8\xED\x28\x9D\xEB\xA9\x52\xE4\x28\x3B\x54\xE8\x8E\x61\x83\xCA"; - c_uint8_t amf[2] = { 0x80, 0x00 }; -#define LOWER " 12abcdE F" - c_uint8_t lower[4] = "\x12\xab\xcd\xef"; - - char buffer[16]; - - ABTS_TRUE(tc, memcmp(k, CORE_HEX(K, strlen(K), buffer), 16) == 0); - - ABTS_TRUE(tc, memcmp(op, CORE_HEX(OP, strlen(OP), buffer), 16) == 0); - - ABTS_TRUE(tc, memcmp(opc, CORE_HEX(OPc, strlen(OPc), buffer), 16) == 0); - - ABTS_TRUE(tc, memcmp(amf, CORE_HEX(AMF, strlen(AMF), buffer), 2) == 0); - - ABTS_TRUE(tc, memcmp(lower, - CORE_HEX(LOWER, strlen(LOWER), buffer), 4) == 0); -} - -static void misc_test3(abts_case *tc, void *data) -{ - c_uint8_t k[16] = "\x46\x5B\x5C\xE8\xB1\x99\xB4\x9F\xAA\x5F\x0A\x2E\xE2\x38\xA6\xBC"; - c_uint8_t op[16] = "\x5F\x1D\x28\x9C\x5D\x35\x4D\x0A\x14\x0C\x25\x48\xF5\xF3\xE3\xBA"; - c_uint8_t opc[16] = "\xE8\xED\x28\x9D\xEB\xA9\x52\xE4\x28\x3B\x54\xE8\x8E\x61\x83\xCA"; - c_uint8_t amf[2] = { 0x80, 0x00 }; - c_uint8_t lower[4] = "\x12\xab\xcd\xef"; - c_uint8_t buffer[128]; - - ABTS_TRUE(tc, strcmp("465B5CE8 B199B49F AA5F0A2E E238A6BC", - core_hex_to_ascii(k, sizeof(k), buffer, sizeof(buffer))) == 0); - ABTS_TRUE(tc, strcmp("5F1D289C 5D354D0A 140C2548 F5F3E3BA", - core_hex_to_ascii(op, sizeof(op), buffer, sizeof(buffer))) == 0); - ABTS_TRUE(tc, strcmp("E8ED289D EBA952E4 283B54E8 8E6183CA", - core_hex_to_ascii(opc, sizeof(opc), buffer, sizeof(buffer))) == 0); - ABTS_TRUE(tc, strcmp("8000", - core_hex_to_ascii(amf, sizeof(amf), buffer, sizeof(buffer))) == 0); - ABTS_TRUE(tc, strcmp("12ABCDEF", - core_hex_to_ascii(lower, sizeof(lower), buffer, sizeof(buffer))) == 0); -} - -static void misc_test4(abts_case *tc, void *data) -{ -#define MAX_SIZE 8 - c_uint8_t tmp[MAX_SIZE] = "\x01\x23\x45\x67\x89\xab\xcd\xef"; - c_uint8_t buf[MAX_SIZE]; - c_uint64_t num; - - num = 0x0123456789abcdef; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 8, buf), 8) == 0); - num = 0x0123456789abcd; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 7, buf), 7) == 0); - num = 0x0123456789ab; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 6, buf), 6) == 0); - num = 0x0123456789; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 5, buf), 5) == 0); - num = 0x01234567; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 4, buf), 4) == 0); - num = 0x012345; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 3, buf), 3) == 0); - num = 0x0123; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 2, buf), 2) == 0); - num = 0x01; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 1, buf), 1) == 0); -} - -static void misc_test5(abts_case *tc, void *data) -{ - ABTS_TRUE(tc, 0x0123456789abcdef == - core_buffer_to_uint64("\x01\x23\x45\x67\x89\xab\xcd\xef", 8)); - ABTS_TRUE(tc, 0x0123456789abcd == - core_buffer_to_uint64("\x01\x23\x45\x67\x89\xab\xcd", 7)); - ABTS_TRUE(tc, 0x0123456789ab == - core_buffer_to_uint64("\x01\x23\x45\x67\x89\xab", 6)); - ABTS_TRUE(tc, 0x0123456789 == - core_buffer_to_uint64("\x01\x23\x45\x67\x89", 5)); - ABTS_TRUE(tc, 0x01234567 == - core_buffer_to_uint64("\x01\x23\x45\x67", 4)); - ABTS_TRUE(tc, 0x012345 == - core_buffer_to_uint64("\x01\x23\x45", 3)); - ABTS_TRUE(tc, 0x0123 == - core_buffer_to_uint64("\x01\x23", 2)); - ABTS_TRUE(tc, 0x01 == - core_buffer_to_uint64("\x01", 1)); -} - -static void misc_test6(abts_case *tc, void *data) -{ - char out[16]; - int out_len; -#define MSISDN "491725670014" - core_bcd_to_buffer(MSISDN, out, &out_len); - ABTS_TRUE(tc, memcmp("\x94\x71\x52\x76\x00\x41", out, out_len) == 0); -#define MEI "3516020019874800" - core_bcd_to_buffer(MEI, out, &out_len); - ABTS_TRUE(tc, - memcmp("\x53\x61\x20\x00\x91\x78\x84\x00", out, out_len) == 0); -#define IMSI "001010123456819" - core_bcd_to_buffer(IMSI, out, &out_len); - ABTS_TRUE(tc, - memcmp("\x00\x01\x01\x21\x43\x65\x18\xf9", out, out_len) == 0); -} - -static void misc_test7(abts_case *tc, void *data) -{ - char out[32]; - c_uint8_t buf1[6] = "\x94\x71\x52\x76\x00\x41"; - int buf1_len = 6; - c_uint8_t buf2[8] = "\x53\x61\x20\x00\x91\x78\x84\x00"; - int buf2_len = 8; - c_uint8_t buf3[8] = "\x00\x01\x01\x21\x43\x65\x18\xf9"; - int buf3_len = 8; - - core_buffer_to_bcd(buf1, buf1_len, out); - ABTS_TRUE(tc, strcmp("491725670014", out) == 0); - core_buffer_to_bcd(buf2, buf2_len, out); - ABTS_TRUE(tc, strcmp("3516020019874800", out) == 0); - core_buffer_to_bcd(buf3, buf3_len, out); - ABTS_TRUE(tc, strcmp("001010123456819", out) == 0); -} - -#define TEST_ENVVAR_NAME "core_test_envvar" -#define TEST_ENVVAR2_NAME "core_test_envvar2" -#define TEST_ENVVAR_VALUE "Just a value that we'll check" - -static void misc_test8(abts_case *tc, void *data) -{ - char *value; - status_t rv; - - rv = core_env_set(TEST_ENVVAR_NAME, TEST_ENVVAR_VALUE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - value = core_env_get(TEST_ENVVAR_NAME); - ABTS_PTR_NOTNULL(tc, value); - ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value); - - rv = core_env_delete(TEST_ENVVAR_NAME); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - value = core_env_get(TEST_ENVVAR_NAME); - ABTS_PTR_NULL(tc, value); - - rv = core_env_set(TEST_ENVVAR_NAME, ""); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - value = core_env_get(TEST_ENVVAR_NAME); - ABTS_PTR_NOTNULL(tc, value); - ABTS_STR_EQUAL(tc, "", value); - - rv = core_env_delete(TEST_ENVVAR_NAME); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - value = core_env_get(TEST_ENVVAR_NAME); - ABTS_PTR_NULL(tc, value); - - rv = core_env_set(TEST_ENVVAR2_NAME, TEST_ENVVAR_VALUE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - value = core_env_get(TEST_ENVVAR2_NAME); - ABTS_PTR_NOTNULL(tc, value); - ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value); - value = core_env_get(TEST_ENVVAR_NAME); - ABTS_PTR_NULL(tc, value); - value = core_env_get(TEST_ENVVAR2_NAME); - ABTS_PTR_NOTNULL(tc, value); - ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value); - - rv = core_env_delete(TEST_ENVVAR2_NAME); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - value = core_env_get(TEST_ENVVAR2_NAME); - ABTS_PTR_NULL(tc, value); -} - -abts_suite *testmisc(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, misc_test1, NULL); - abts_run_test(suite, misc_test2, NULL); - abts_run_test(suite, misc_test3, NULL); - abts_run_test(suite, misc_test4, NULL); - abts_run_test(suite, misc_test5, NULL); - abts_run_test(suite, misc_test6, NULL); - abts_run_test(suite, misc_test7, NULL); - abts_run_test(suite, misc_test8, NULL); - - return suite; -} diff --git a/lib/core/test/testmsgq.c b/lib/core/test/testmsgq.c deleted file mode 100644 index c739e7c0d..000000000 --- a/lib/core/test/testmsgq.c +++ /dev/null @@ -1,312 +0,0 @@ -#include "core_msgq.h" -#include "core_thread.h" -#include "core_portable.h" -#include "testutil.h" - -static char msg[16][24] = { - {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18}, - {0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28}, - {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, - {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, - {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58}, - {0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, - {0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78}, - {0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88}, - {0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98}, - {0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8}, - {0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8}, - {0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8}, - {0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8}, - {0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8}, - {0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8}, - {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08} -}; - -static char rmsg[16][24]; - -static int msglen[16] = {3, 4, 5, 6, 7, 8, 1, 2, 11, 12, 13, 14, 15, 16, 17, 18}; - -static msgq_id md; - -static void msgq_test1(abts_case *tc, void *data) -{ - int i, n; - - /* Basic test */ - md = msgq_create(5, 8, 0); - ABTS_INT_NEQUAL(tc, 0, md); - - n = msgq_send(md, msg[0], msglen[0]); - ABTS_INT_EQUAL(tc, msglen[0], n); - - n = msgq_recv(md, rmsg[0], 8); - ABTS_INT_EQUAL(tc, msglen[0], n); - - n = memcmp(msg[0], rmsg[0], msglen[0]); - ABTS_INT_EQUAL(tc, 0, n); - - msgq_delete(md); - - /* Test with send() and recv() function up to queue size */ - md = msgq_create(5, 8, 0); - ABTS_INT_NEQUAL(tc, 0, md); - - for (i = 0; i < 5; i++) - { - n = msgq_send(md, msg[i], msglen[i]); - ABTS_INT_EQUAL(tc, msglen[i], n); - } - - for (i = 0; i < 5; i++) - { - n = msgq_recv(md, rmsg[i], 8); - ABTS_INT_EQUAL(tc, msglen[i], n); - - n = memcmp(msg[i], rmsg[i], msglen[i]); - ABTS_INT_EQUAL(tc, 0, n); - } - - msgq_delete(md); - - /* Test with send() and timedrecv() function up to queue size */ - md = msgq_create(5, 8, 0); - ABTS_INT_NEQUAL(tc, 0, md); - - for (i = 0; i < 5; i++) - { - n = msgq_send(md, msg[i], msglen[i]); - ABTS_INT_EQUAL(tc, msglen[i], n); - } - - for (i = 0; i < 5; i++) - { - n = msgq_timedrecv(md, rmsg[i], 8, 0); - ABTS_INT_EQUAL(tc, msglen[i], n); - - n = memcmp(msg[i], rmsg[i], msglen[i]); - ABTS_INT_EQUAL(tc, 0, n); - } - - msgq_delete(md); -} - -static void msgq_test2(abts_case *tc, void *data) -{ - int i, n; - - md = msgq_create(5, 8, MSGQ_O_NONBLOCK); - ABTS_INT_NEQUAL(tc, 0, md); - - /* fill up the queue */ - for (i = 0; i < 5; i++) - { - n = msgq_send(md, msg[i], msglen[i]); - ABTS_INT_EQUAL(tc, msglen[i], n); - } - - /* Now, there is no room to send. - * Confirm that send() returns CORE_EGAIN */ - n = msgq_send(md, msg[0], msglen[0]); - ABTS_INT_EQUAL(tc, CORE_EAGAIN, n); - - /* empty queue */ - for (i = 0; i < 5; i++) - { - n = msgq_recv(md, rmsg[i], 8); - ABTS_INT_EQUAL(tc, msglen[i], n); - - n = memcmp(msg[i], rmsg[i], msglen[i]); - ABTS_INT_EQUAL(tc, 0, n); - } - - /* Now, there is no sent buffer to be read. - * Confirm that recv() return CORE_EGAIN */ - n = msgq_recv(md, rmsg[i], 8); - ABTS_INT_EQUAL(tc, CORE_EAGAIN, n); - - msgq_delete(md); -} - -static void msgq_test3(abts_case *tc, void *data) -{ - int i, j, n; - - md = msgq_create(16, 24, MSGQ_O_BLOCK); - ABTS_INT_NEQUAL(tc, 0, md); - - /* Repeat 10 times */ - for (j = 0; j < 10; j++) - { - /* Cycle repeatedly by queue depth */ - for (i = 0; i < 16; i++) - { - n = msgq_send(md, msg[i], 24); - ABTS_INT_EQUAL(tc, CORE_OK, n); - - n = msgq_recv(md, rmsg[i], 24); - ABTS_INT_EQUAL(tc, CORE_OK, n); - - n = memcmp(msg[i], rmsg[i], 24); - ABTS_INT_EQUAL(tc, 0, n); - } - } - - msgq_delete(md); -} - -#define TEST_QUEUE_SIZE 128 -#define TEST_EVT_SIZE (sizeof(test_event_t)) - -typedef struct { - int a; - int b; - char c[30]; -} test_event_t; - -typedef struct { - abts_case *tc; - int opt; - int cancelled; - int timed; -} test_param_t; - -static thread_id thr_producer; -static thread_id thr_consumer; -static int max = 100000; -static int exit_ret_val = 123; - -static void *THREAD_FUNC producer_main(thread_id id, void *data) -{ - test_param_t *param = (test_param_t *)data; - abts_case *tc = param->tc; - status_t rv; - int i = 0; - unsigned int full = 0; - - while (i++ < max) - { - test_event_t te; - - te.a = i; - te.b = i+2; - te.c[28] = 'X'; - te.c[29] = 'Y'; - rv = msgq_send(md, (char*)&te, TEST_EVT_SIZE); - if (rv == CORE_EAGAIN) - { - full++; - thread_yield(); - continue; - } - ABTS_ASSERT(tc, "producer error", rv == CORE_OK); - } - thread_exit(id, exit_ret_val); - - return NULL; -} - -static void *THREAD_FUNC consumer_main(thread_id id, void *data) -{ - test_param_t *param = (test_param_t *)data; - abts_case *tc = param->tc; - status_t rv; - int i = 0; - - while (!thread_should_stop()) - { - test_event_t te; - - if (param->cancelled) - pthread_testcancel(); - - if (param->timed) - rv = msgq_timedrecv(md, (char*)&te, TEST_EVT_SIZE, 10000); - else - rv = msgq_recv(md, (char*)&te, TEST_EVT_SIZE); - if (rv == CORE_EAGAIN || rv == CORE_TIMEUP) - { - thread_yield(); - continue; - } - ABTS_ASSERT(tc, "consumer error", rv == CORE_OK); - ABTS_ASSERT(tc, "consumer error", te.c[28] == 'X' && te.c[29] == 'Y'); - i++; - } - - return NULL; -} - -static void msgq_test4(abts_case *tc, void *data) -{ - status_t rv; - test_param_t *param = (test_param_t *)data; - param->tc = tc; - - md = msgq_create(TEST_QUEUE_SIZE, TEST_EVT_SIZE, param->opt); - ABTS_INT_NEQUAL(tc, 0, md); - - rv = thread_create(&thr_producer, NULL, producer_main, param); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&thr_consumer, NULL, consumer_main, param); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_join(&rv, thr_producer); - ABTS_INT_EQUAL(tc, exit_ret_val, rv); - - if (param->cancelled) - { - os_thread_t *thread; - - os_thread_get(&thread, thr_consumer); - pthread_cancel(*thread); - thread_join(&rv, thr_consumer); - } - else - { - thread_delete(thr_consumer); - } - - msgq_delete(md); -} - -#define STRESS_TEST 0 - -abts_suite *testmsgq(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - -#if 0 /* Deprecated */ - abts_run_test(suite, msgq_test1, NULL); - abts_run_test(suite, msgq_test2, NULL); -#endif - abts_run_test(suite, msgq_test3, NULL); - -#if STRESS_TEST == 1 - while(1) - { -#endif - test_param_t param; - memset(¶m, 0, sizeof(test_param_t)); - - param.opt = MSGQ_O_NONBLOCK; - abts_run_test(suite, msgq_test4, (void *)¶m); -#if HAVE_PTHREAD_H == 1 - param.opt = MSGQ_O_BLOCK; - param.cancelled = 1; - abts_run_test(suite, msgq_test4, (void *)¶m); -#endif - param.opt = MSGQ_O_NONBLOCK; - param.timed = 1; - abts_run_test(suite, msgq_test4, (void *)¶m); - param.opt = MSGQ_O_BLOCK; - param.timed = 1; - abts_run_test(suite, msgq_test4, (void *)¶m); -#if STRESS_TEST == 1 - printf("Test again = %"C_UINT64_T_FMT "\n", time_now()); - sleep(3); - } -#endif - - return suite; -} diff --git a/lib/core/test/testnetlib.c b/lib/core/test/testnetlib.c deleted file mode 100644 index 6138b594a..000000000 --- a/lib/core/test/testnetlib.c +++ /dev/null @@ -1,556 +0,0 @@ -#define TRACE_MODULE _testnetlib -#include "core_debug.h" -#include "core_net.h" -#include "testutil.h" - -#define TEST_SERVER_PORT 5121 -#define TEST_BUFFER_SIZE 1024 - -#define TEST_MAX_NUM 4 - -#define DISABLE_FTPTEST 1 -#define DISABLE_LINKTEST 1 - -static char buffer[TEST_BUFFER_SIZE]; -static int tcp_server_started = 0; -static int udp_server_started = 0; - -pthread_t tserver_tid,userver_tid; -net_sock_t *tserver_sock,*userver_sock; - -static void *tcp_session_main(void *param) -{ - int rc; - - net_sock_t *net_sock = (net_sock_t *)param; - while (1) - { - rc = net_read(net_sock, buffer, TEST_BUFFER_SIZE, 1); - if (rc > 0) - { - if (!strncmp(buffer, "QUIT",4)) - { - break; - } - else - { - /* Send received data */ - rc = net_send(net_sock, buffer, rc); - } - } - else if (rc == 0) - { - /* Timeout */ - } - else - { - printf("error = %d\n", net_sock->sndrcv_errno); - break; - } - } - - net_close(net_sock); - - return NULL; -} - -static void start_tcp_session(net_sock_t *net_sock) -{ - pthread_t tid; - - pthread_create(&tid, NULL, tcp_session_main, (void *)net_sock); - pthread_detach(tid); - return; -} - -static void *tcp_server_main(void *param) -{ - int rc; - net_sock_t *new_sock; - - rc = net_listen(&tserver_sock, SOCK_STREAM, IPPROTO_TCP, TEST_SERVER_PORT); - if (rc != 0) - { - d_error("net_tcp_listen Error(rc = %d)\n",rc); - return NULL; - } - - tcp_server_started = 1; - - while (1) - { - rc = net_accept(&new_sock, tserver_sock, 1); - if (rc >0) - { - /* New connection arrived. Start session */ - start_tcp_session(new_sock); - } - else if (rc == 0) - { - /* Timeout */ - } - else - { - /* Error occured */ - break; - } - } - - return NULL; -} - -static void start_tcp_server() -{ - pthread_create(&tserver_tid, NULL, tcp_server_main, NULL); - while (tcp_server_started == 0) - { - sleep(1); - } - sleep(1); - return; -} - -static void stop_tcp_server() -{ - net_close(tserver_sock); - pthread_join(tserver_tid, NULL); -} - -static void *udp_server_main(void *param) -{ - int rc; - - rc = net_listen(&userver_sock, - SOCK_DGRAM, IPPROTO_UDP, TEST_SERVER_PORT); - if (rc != 0) - { - d_error("net_udp Error(rc = %d)\n",rc); - return NULL; - } - - udp_server_started = 1; - - while (1) - { - d_trace(1,"Wait for data....\n"); - rc = net_read(userver_sock, buffer, TEST_BUFFER_SIZE, 2); - if (rc >0) - { - d_trace(1,"RECV %d bytes\n", rc); - if (!strncmp(buffer, "QUIT",4)) - { - break; - } - else - { - /* Send received data */ - rc = net_send(userver_sock, buffer, rc); - d_trace(1,"SEND %d bytes\n", rc); - if (rc == -1) - { - printf("error = %d\n", userver_sock->sndrcv_errno); - } - } - } - else if (rc == 0) - { - /* Timeout */ - } - else - { - /* Error occured */ - break; - } - } - - return NULL; -} - -static void start_udp_server() -{ - pthread_create(&userver_tid, NULL, udp_server_main, NULL); - while (udp_server_started == 0) - { - sleep(1); - } - return; -} - -static void stop_udp_server() -{ - net_close(userver_sock); - pthread_join(userver_tid, NULL); -} - -static void netlib1(abts_case *tc, void *data) -{ - int rc = 0; - net_sock_t *net_sock; - char inputbuf[TEST_MAX_NUM][20]; - char outputbuf[TEST_MAX_NUM][20]; - int i; - - /* Start TCP server */ - start_tcp_server(); - - rc = net_open(&net_sock, "127.0.0.1", 0, - TEST_SERVER_PORT, SOCK_STREAM, IPPROTO_TCP); - ABTS_INT_EQUAL(tc, 0, rc); - for (i=0; i< TEST_MAX_NUM; i++) - { - sprintf(inputbuf[i],"asdf%d",i); - rc = net_send(net_sock, inputbuf[i], strlen(inputbuf[i])+1); - ABTS_INT_EQUAL(tc, strlen(inputbuf[i])+1, rc); - } - - for (i=0; i< TEST_MAX_NUM; i++) - { - memset(outputbuf[i], 0, sizeof(outputbuf[i])); - rc = 0; - while (1) - { - int n; - n = net_read(net_sock, outputbuf[i], 6, 1); - rc += n; - if (n == 0 || n == 6) - break; - } - ABTS_INT_EQUAL(tc, 6, rc); - ABTS_INT_EQUAL(tc, 6, strlen(outputbuf[i])+1); - ABTS_STR_EQUAL(tc, inputbuf[i], outputbuf[i]); - } - /* Send QUIT */ - rc = net_send(net_sock, "QUIT", 4); - ABTS_INT_EQUAL(tc, 4, rc); - - /* Close */ - rc = net_close(net_sock); - ABTS_INT_EQUAL(tc, 0, rc); - - /* Stop TCP server */ - stop_tcp_server(); -} - -static void netlib2(abts_case *tc, void *data) -{ - int rc = 0; - net_sock_t *net_sock[TEST_MAX_NUM]; - char inputbuf[TEST_MAX_NUM][20]; - char outputbuf[TEST_MAX_NUM][20]; - int i; - - /* Start TCP server */ - start_tcp_server(); - - /* Connect to invalid port */ - d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FATAL); - for (i =0 ; ih_proto) == proto) - { - d_print_hex(buf, len); - } -} - -static void netlib5(abts_case *tc, void *data) -{ - net_link_t *net_link = NULL; - int promisc = 1; - int rc; - int max_count = 10; - char buf[1024]; - -#if DISABLE_LINKTEST - return; -#endif - rc = net_link_open(&net_link, "eth0", ETH_P_ALL); - ABTS_INT_EQUAL(tc, 0, rc); - ABTS_PTR_NOTNULL(tc, net_link); - rc = net_link_promisc(net_link, promisc); - ABTS_INT_EQUAL(tc, 0, rc); -#if 0 - d_print("HW addr of %s : ",net_link->ifname); - d_print_hex(net_link->hwaddr.sa_data, 6); -#endif - while (max_count-- > 0) - { - rc = net_link_read(net_link, buf, 1024, 1); - ABTS_TRUE(tc, rc > 0); - filter_updu(buf, rc); - } - rc = net_link_close(net_link); - ABTS_INT_EQUAL(tc, 0, rc); -} - -static int make_test_updu(char *src_addr, char *dst_addr, char *buf, int len) -{ - unsigned short proto = 0x88B6; - struct ethhdr *eth_hdr = NULL; - int rc = sizeof(struct ethhdr); - char *ptr = buf; - - eth_hdr = (struct ethhdr *)buf; - memcpy(eth_hdr->h_source, src_addr, 6); - memcpy(eth_hdr->h_dest, dst_addr, 6); - eth_hdr->h_proto = htons(proto); - /* Fill the data */ - rc += sprintf(ptr+rc,"Hellow World"); - d_print_hex(buf, rc); - return rc; -} - -static void netlib6(abts_case *tc, void *data) -{ - net_link_t *net_link = NULL; - int promisc = 1; - int rc; - int max_count = 1; - char buf[1024]; -#if 0 - char dst_addr[6] = {'\x00','\x00','\x00','\x11','\x22','\x33'}; -#else - char dst_addr[6] = {'\xff','\xff','\xff','\xff','\xff','\xff'}; -#endif - -#if DISABLE_LINKTEST - return; -#endif - - rc = net_link_open(&net_link, "eth0", ETH_P_ALL); - ABTS_INT_EQUAL(tc, 0, rc); - ABTS_PTR_NOTNULL(tc, net_link); - rc = net_link_promisc(net_link, promisc); - ABTS_INT_EQUAL(tc, 0, rc); - while (max_count-- > 0) - { - rc = make_test_updu(net_link->hwaddr.sa_data, dst_addr,buf,1024); - - rc = net_link_write(net_link, buf, rc); - ABTS_TRUE(tc, rc > 0); - } - rc = net_link_close(net_link); - ABTS_INT_EQUAL(tc, 0, rc); -} -#endif - -abts_suite *testnetlib(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, netlib1, NULL); - /* - * OpenSUSE OBS - * - Ubuntu 17.04 i586 failed - * - Jinyoung Fixed - * -[ 542s] testnetlib : Line 262: expected <0>, but saw <-1> -[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353) -[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353) -[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353) -[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353) -[ 542s] [10/30 07:48:38.730] ASSERT: !(net_sock && buffer). Invalid params -[ 542s] (net_lib.c:590) -[ 542s] [10/30 07:48:38.730] ASSERT: !(net_sock). net_sock is NULL -[ 542s] (net_lib.c:408) -[ 542s] [10/30 07:48:38.730] ASSERT: !(net_sock). net_sock is NULL - */ - abts_run_test(suite, netlib2, NULL); - abts_run_test(suite, netlib3, NULL); - abts_run_test(suite, netlib4, NULL); -#if LINUX == 1 - abts_run_test(suite, netlib5, NULL); - abts_run_test(suite, netlib6, NULL); -#endif - - return suite; -} diff --git a/lib/core/test/testpkbuf.c b/lib/core/test/testpkbuf.c deleted file mode 100644 index 7d38d2557..000000000 --- a/lib/core/test/testpkbuf.c +++ /dev/null @@ -1,66 +0,0 @@ -#include "core_pkbuf.h" -#include "testutil.h" - -static void pkbuf_test1(abts_case *tc, void *data) -{ - char *ptr = core_malloc(256); - ABTS_PTR_NOTNULL(tc, ptr); - CORE_FREE(ptr); -} - -static void pkbuf_test2(abts_case *tc, void *data) -{ - char *ptr = core_calloc(2, 10); - int i; - for (i = 0; i < 2*10; i++) - { - ABTS_INT_EQUAL(tc, 0, ptr[i]); - } - ABTS_PTR_NOTNULL(tc, ptr); - CORE_FREE(ptr); -} - -static void pkbuf_test3(abts_case *tc, void *data) -{ - char *ptr = core_realloc(0, 10); - ABTS_PTR_NOTNULL(tc, ptr); - CORE_FREE(ptr); - - ptr = core_malloc(20); - ABTS_PTR_NOTNULL(tc, ptr); - ptr = core_realloc(ptr, 0); -} - -static void pkbuf_test4(abts_case *tc, void *data) -{ - char *p, *q; - - p = core_malloc(10); - ABTS_PTR_NOTNULL(tc, p); - memset(p, 1, 10); - - q = core_realloc(p, - CORE_ALIGN(128+MAX_SIZEOF_HEADROOM, SIZEOF_VOIDP) - - SIZEOF_VOIDP-1); - ABTS_TRUE(tc, p == q); - - p = core_realloc(q, - CORE_ALIGN(128+MAX_SIZEOF_HEADROOM, SIZEOF_VOIDP) - - SIZEOF_VOIDP); - ABTS_TRUE(tc, p != q); - ABTS_TRUE(tc, memcmp(p, q, 10) == 0); - CORE_FREE(p); -} - - -abts_suite *testpkbuf(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, pkbuf_test1, NULL); - abts_run_test(suite, pkbuf_test2, NULL); - abts_run_test(suite, pkbuf_test3, NULL); - abts_run_test(suite, pkbuf_test4, NULL); - - return suite; -} diff --git a/lib/core/test/testsctp.c b/lib/core/test/testsctp.c deleted file mode 100644 index c41d9ea2e..000000000 --- a/lib/core/test/testsctp.c +++ /dev/null @@ -1,335 +0,0 @@ -#include "core_debug.h" -#include "core_thread.h" -#include "core_network.h" - -#include "testutil.h" - -#define DATASTR "This is a test" -#define STRLEN 8092 -#define PORT 7777 -#define PORT2 7778 -#define PPID 12345 - -#ifndef AI_PASSIVE -#define AI_PASSIVE 1 -#endif - -static void sctp_test1(abts_case *tc, void *data) -{ - sock_id sctp; - c_sockaddr_t *addr; - status_t rv; - - rv = sctp_socket(&sctp, AF_INET6, SOCK_SEQPACKET); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_STREAM, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_SEQPACKET, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test2_thread; -static void *THREAD_FUNC test2_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id sctp; - char str[STRLEN]; - ssize_t size; - c_uint32_t ppid; - sctp_info_t sinfo; - c_sockaddr_t *addr; - c_sockaddr_t from; - - rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_client(&sctp, SOCK_SEQPACKET, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sctp_test2(abts_case *tc, void *data) -{ - status_t rv; - sock_id sctp, sctp2; - ssize_t size; - c_sockaddr_t *addr; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_STREAM, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test2_thread, NULL, test2_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_accept(&sctp2, sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_sendmsg(sctp2, DATASTR, strlen(DATASTR), NULL, PPID, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - thread_join(&rv, test2_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - rv = sock_delete(sctp2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test3_thread; -static void *THREAD_FUNC test3_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id sctp; - c_sockaddr_t *addr; - c_sockaddr_t *to; - char str[STRLEN]; - ssize_t size; - int rc; - - rv = sctp_socket(&sctp, AF_INET, SOCK_SEQPACKET); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&to, AF_INET, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), to, PPID, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - rv = core_freeaddrinfo(to); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sctp_test3(abts_case *tc, void *data) -{ - sock_id sctp; - status_t rv; - ssize_t size; - c_sockaddr_t from, *addr; - char str[STRLEN]; - char buf[CORE_ADDRSTRLEN]; - sctp_info_t sinfo; - - rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_SEQPACKET, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test3_thread, NULL, test3_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); - - thread_join(&rv, test3_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test4_thread; -static void *THREAD_FUNC test4_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id sctp; - c_sockaddr_t *addr; - char str[STRLEN]; - ssize_t size; - sctp_info_t sinfo; - - rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_client(&sctp, SOCK_STREAM, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), NULL, PPID, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - size = core_sctp_recvdata(sctp, str, STRLEN, NULL, &sinfo); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sctp_test4(abts_case *tc, void *data) -{ - sock_id sctp; - status_t rv; - ssize_t size; - c_sockaddr_t from, *addr; - char str[STRLEN]; - sctp_info_t sinfo; - char buf[CORE_ADDRSTRLEN]; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_SEQPACKET, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test4_thread, NULL, test4_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&from, buf)); - ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); - - size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), &from, PPID, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - thread_join(&rv, test4_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test5_thread; -static void *THREAD_FUNC test5_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id sctp; - char str[STRLEN]; - c_sockaddr_t from, *remote_addr, *addr; - sctp_info_t sinfo; - ssize_t size; - char buf[CORE_ADDRSTRLEN]; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT2, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_SEQPACKET, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_connect(sctp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - remote_addr = sock_remote_addr(sctp); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(remote_addr, buf)); - - size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), - remote_addr, PPID, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&from, buf)); - ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sctp_test5(abts_case *tc, void *data) -{ - sock_id sctp; - status_t rv; - ssize_t size; - c_sockaddr_t from, *addr; - socklen_t addrlen; - char str[STRLEN]; - sctp_info_t sinfo; - char buf[CORE_ADDRSTRLEN]; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = sctp_server(&sctp, SOCK_SEQPACKET, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test5_thread, NULL, test5_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&from, buf)); - ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); - - size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), &from, - sinfo.ppid, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - thread_join(&rv, test5_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(sctp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -abts_suite *testsctp(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, sctp_test1, NULL); - abts_run_test(suite, sctp_test2, NULL); - abts_run_test(suite, sctp_test3, NULL); - abts_run_test(suite, sctp_test4, NULL); - abts_run_test(suite, sctp_test5, NULL); - - return suite; -} diff --git a/lib/core/test/testsha.c b/lib/core/test/testsha.c deleted file mode 100644 index 4a77e3702..000000000 --- a/lib/core/test/testsha.c +++ /dev/null @@ -1,164 +0,0 @@ -#include "core_debug.h" -#include "core_sha1.h" -#include "core_sha2.h" -#include "core_pkbuf.h" -#include "testutil.h" - -static void sha1_test1(abts_case *tc, void *data) -{ - c_uint8_t msg1[] = "abc"; - c_uint8_t msg2[] = "abcdbcdecdefdefgefghfghighij" - "hijkijkljklmklmnlmnomnopnopq"; - - c_uint8_t digest1[] = { - 0xa9,0x99,0x3e,0x36,0x47,0x06,0x81,0x6a, - 0xba,0x3e,0x25,0x71,0x78,0x50,0xc2,0x6c, - 0x9c,0xd0,0xd8,0x9d - }; - c_uint8_t digest2[] = { - 0x84,0x98,0x3e,0x44,0x1c,0x3b,0xd2,0x6e, - 0xba,0xae,0x4a,0xa1,0xf9,0x51,0x29,0xe5, - 0xe5,0x46,0x70,0xf1 - }; - c_uint8_t digest3[] = { - 0x34,0xaa,0x97,0x3c,0xd4,0xc4,0xda,0xa4, - 0xf6,0x1e,0xeb,0x2b,0xdb,0xad,0x27,0x31, - 0x65,0x34,0x01,0x6f, - }; - - c_uint8_t digest[20]; - int i; - - sha1_ctx ctx; - - sha1_init(&ctx); - sha1_update(&ctx, msg1, sizeof(msg1) - 1); - sha1_final(&ctx, digest); - ABTS_INT_EQUAL(tc, 0, memcmp(digest1, digest, 20)); - - sha1_init(&ctx); - sha1_update(&ctx, msg2, sizeof(msg2) - 1); - sha1_final(&ctx, digest); - ABTS_INT_EQUAL(tc, 0, memcmp(digest2, digest, 20)); - - sha1_init(&ctx); - for (i = 0; i < 1000000; i++) - sha1_update(&ctx, (c_uint8_t*)"a", 1); - sha1_final(&ctx, digest); - ABTS_INT_EQUAL(tc, 0, memcmp(digest3, digest, 20)); - -} - -static void sha2_test1(abts_case *tc, void *data) -{ - char *vectors[4][3] = - { /* SHA-224 */ - { - "\x23\x09\x7d\x22\x34\x05\xd8\x22\x86\x42\xa4\x77\xbd\xa2\x55\xb3\x2a\xad\xbc\xe4\xbd\xa0\xb3\xf7\xe3\x6c\x9d\xa7", - "\x75\x38\x8b\x16\x51\x27\x76\xcc\x5d\xba\x5d\xa1\xfd\x89\x01\x50\xb0\xc6\x45\x5c\xb4\xf5\x8b\x19\x52\x52\x25\x25", - "\x20\x79\x46\x55\x98\x0c\x91\xd8\xbb\xb4\xc1\xea\x97\x61\x8a\x4b\xf0\x3f\x42\x58\x19\x48\xb2\xee\x4e\xe7\xad\x67", - }, - /* SHA-\x25\x6 */ - { - "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad", - "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1", - "\xcd\xc7\x6e\x5c\x99\x14\xfb\x92\x81\xa1\xc7\xe2\x84\xd7\x3e\x67\xf1\x80\x9a\x48\xa4\x97\x20\x0e\x04\x6d\x39\xcc\xc7\x11\x2c\xd0", - }, - /* SHA-\x38\x4 */ - { - "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50\x07\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff\x5b\xed" - "\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34\xc8\x25\xa7", - "\x09\x33\x0c\x33\xf7\x11\x47\xe8\x3d\x19\x2f\xc7\x82\xcd\x1b\x47\x53\x11\x1b\x17\x3b\x3b\x05\xd2\x2f\xa0\x80\x86\xe3\xb0\xf7\x12" - "\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91\x74\x60\x39", - "\x9d\x0e\x18\x09\x71\x64\x74\xcb\x08\x6e\x83\x4e\x31\x0a\x4a\x1c\xed\x14\x9e\x9c\x00\xf2\x48\x52\x79\x72\xce\xc5\x70\x4c\x2a\x5b" - "\x07\xb8\xb3\xdc\x38\xec\xc4\xeb\xae\x97\xdd\xd8\x7f\x3d\x89\x85", - }, - /* SHA-\x51\x2 */ - { - "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41\x31\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a" - "\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f", - "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14\x3f\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88\x90\x18" - "\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b\x87\x4b\xe9\x09", - "\xe7\x18\x48\x3d\x0c\xe7\x69\x64\x4e\x2e\x42\xc7\xbc\x15\xb4\x63\x8e\x1f\x98\xb1\x3b\x20\x44\x28\x56\x32\xa8\x03\xaf\xa9\x73\xeb" - "\xde\x0f\xf2\x44\x87\x7e\xa6\x0a\x4c\xb0\x43\x2c\xe5\x77\xc3\x1b\xeb\x00\x9c\x5c\x2c\x49\xaa\x2e\x4e\xad\xb2\x17\xad\x8c\xc0\x9b" - } - }; - - char message1[] = "abc"; - char message2a[] = "abcdbcdecdefdefgefghfghighijhi" - "jkijkljklmklmnlmnomnopnopq"; - char message2b[] = "abcdefghbcdefghicdefghijdefghijkefghij" - "klfghijklmghijklmnhijklmnoijklmnopjklm" - "nopqklmnopqrlmnopqrsmnopqrstnopqrstu"; - unsigned char *message3; - unsigned int message3_len = 1000000; - unsigned char digest[SHA512_DIGEST_SIZE]; - int rc; - - message3 = malloc(message3_len); - if (message3 == NULL) { - fprintf(stderr, "Can't allocate memory\n"); - return; - } - memset(message3, 'a', message3_len); - - /* SHA-2 FIPS 180-2 Validation tests. - * SHA-224 Test vector */ - - sha224((c_uint8_t *)message1, strlen((char *) message1), digest); - rc = memcmp(vectors[0][0], digest, SHA224_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha224((c_uint8_t *)message2a, strlen((char *) message2a), digest); - rc = memcmp(vectors[0][1], digest, SHA224_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha224((c_uint8_t *)message3, message3_len, digest); - rc = memcmp(vectors[0][2], digest, SHA224_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - - /* SHA-256 Test vector */ - - sha256((c_uint8_t *)message1, strlen((char *) message1), digest); - rc = memcmp(vectors[1][0], digest, SHA256_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha256((c_uint8_t *)message2a, strlen((char *) message2a), digest); - rc = memcmp(vectors[1][1], digest, SHA256_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha256((c_uint8_t *)message3, message3_len, digest); - rc = memcmp(vectors[1][2], digest, SHA256_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - - /* SHA-384 Test vector */ - - sha384((c_uint8_t *)message1, strlen((char *) message1), digest); - rc = memcmp(vectors[2][0], digest, SHA384_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha384((c_uint8_t *)message2b, strlen((char *) message2b), digest); - rc = memcmp(vectors[2][1], digest, SHA384_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha384((c_uint8_t *)message3, message3_len, digest); - rc = memcmp(vectors[2][2], digest, SHA384_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - - /* SHA-512 Test vector */ - sha512((c_uint8_t *)message1, strlen((char *) message1), digest); - rc = memcmp(vectors[3][0], digest, SHA512_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha512((c_uint8_t *)message2b, strlen((char *) message2b), digest); - rc = memcmp(vectors[3][1], digest, SHA512_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - sha512((c_uint8_t *)message3, message3_len, digest); - rc = memcmp(vectors[3][2], digest, SHA512_DIGEST_SIZE); - ABTS_INT_EQUAL(tc, 0, rc); - - free(message3); -} - -abts_suite *testsha2(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, sha1_test1, NULL); - abts_run_test(suite, sha2_test1, NULL); - - return suite; -} diff --git a/lib/core/test/testsleep.c b/lib/core/test/testsleep.c deleted file mode 100644 index acab57e48..000000000 --- a/lib/core/test/testsleep.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core_time.h" -#include "testutil.h" - -#define SLEEP_INTERVAL 3 - -static void sleep_one(abts_case *tc, void *data) -{ - time_t pretime = time(NULL); - time_t posttime; - time_t timediff; - - core_sleep(time_from_sec(SLEEP_INTERVAL)); - posttime = time(NULL); - - /* normalize the timediff. We should have slept for SLEEP_INTERVAL, so - * we should just subtract that out. - */ - timediff = posttime - pretime - SLEEP_INTERVAL; - ABTS_TRUE(tc, timediff >= 0); - ABTS_TRUE(tc, timediff <= 1); -} - -abts_suite *testsleep(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, sleep_one, NULL); - - return suite; -} - diff --git a/lib/core/test/testsock.c b/lib/core/test/testsock.c deleted file mode 100644 index b6d6d9bc3..000000000 --- a/lib/core/test/testsock.c +++ /dev/null @@ -1,458 +0,0 @@ -#include "core_debug.h" -#include "core_thread.h" -#include "core_pkbuf.h" - -#include "core_network.h" - -#include "testutil.h" - -#define DATASTR "This is a test" -#define STRLEN 8092 -#define PORT 7777 -#define PORT2 7778 - -#ifndef AI_PASSIVE -#define AI_PASSIVE 1 -#endif - -static void sock_test1(abts_case *tc, void *data) -{ - sock_id udp; - c_sockaddr_t *addr; - status_t rv; - - rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_UNSPEC, "127.0.0.1", PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_UNSPEC, "::1", PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test2_thread; -static void *THREAD_FUNC test2_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id tcp; - c_sockaddr_t *addr; - char str[STRLEN]; - ssize_t size; - - rv = core_getaddrinfo(&addr, AF_UNSPEC, "::1", PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tcp_client(&tcp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_recv(tcp, str, STRLEN, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - rv = sock_delete(tcp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sock_test2(abts_case *tc, void *data) -{ - status_t rv; - sock_id tcp, tcp2; - c_sockaddr_t *addr; - ssize_t size; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tcp_server(&tcp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test2_thread, NULL, test2_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_accept(&tcp2, tcp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_send(tcp2, DATASTR, strlen(DATASTR), 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - thread_join(&rv, test2_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(tcp2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(tcp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test3_thread; -static void *THREAD_FUNC test3_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id udp; - c_sockaddr_t *sa; - char str[STRLEN]; - ssize_t size; - int rc; - char buf[CORE_ADDRSTRLEN]; - - rv = udp_socket(&udp, AF_INET); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&sa, AF_INET, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_sendto(udp, DATASTR, strlen(DATASTR), 0, sa); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - rv = core_freeaddrinfo(sa); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sock_test3(abts_case *tc, void *data) -{ - sock_id udp; - status_t rv; - ssize_t size; - c_sockaddr_t sa, *addr; - socklen_t addrlen; - char str[STRLEN]; - char buf[CORE_ADDRSTRLEN]; - - rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test3_thread, NULL, test3_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_recvfrom(udp, str, STRLEN, 0, &sa); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(&sa, buf)); - - thread_join(&rv, test3_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test4_thread; -static void *THREAD_FUNC test4_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id udp; - c_sockaddr_t *addr; - char str[STRLEN]; - ssize_t size; - - rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_client(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_send(udp, DATASTR, strlen(DATASTR), 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - size = core_recv(udp, str, STRLEN, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sock_test4(abts_case *tc, void *data) -{ - sock_id udp; - status_t rv; - ssize_t size; - c_sockaddr_t sa, *addr; - socklen_t addrlen; - char str[STRLEN]; - char buf[CORE_ADDRSTRLEN]; - - rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test4_thread, NULL, test4_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_recvfrom(udp, str, STRLEN, 0, &sa); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(&sa, buf)); - - size = core_sendto(udp, DATASTR, strlen(DATASTR), 0, &sa); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - thread_join(&rv, test4_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static thread_id test5_thread; -static void *THREAD_FUNC test5_main(thread_id id, void *data) -{ - abts_case *tc = data; - status_t rv; - sock_id udp; - c_sockaddr_t *addr; - char str[STRLEN]; - ssize_t size; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT2, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_connect(udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_send(udp, DATASTR, strlen(DATASTR), 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - size = core_recv(udp, str, STRLEN, 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - thread_exit(id, size); - return NULL; -} - -static void sock_test5(abts_case *tc, void *data) -{ - sock_id udp; - status_t rv; - ssize_t size; - c_sockaddr_t sa, *addr; - socklen_t addrlen; - char str[STRLEN]; - char buf[CORE_ADDRSTRLEN]; - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_server(&udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT2, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = udp_connect(udp, addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = core_freeaddrinfo(addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = thread_create(&test5_thread, NULL, test5_main, tc); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - size = core_recvfrom(udp, str, STRLEN, 0, &sa); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&sa, buf)); - - size = core_send(udp, DATASTR, strlen(DATASTR), 0); - ABTS_INT_EQUAL(tc, strlen(DATASTR), size); - - thread_join(&rv, test5_thread); - ABTS_INT_EQUAL(tc, strlen(DATASTR), rv); - - rv = sock_delete(udp); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static void sock_test6(abts_case *tc, void *data) -{ - c_sockaddr_t addr, *paddr, *dst; - char buf[CORE_ADDRSTRLEN]; - status_t rv; - - rv = core_inet_pton(AF_INET, "127.0.0.1", &addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(&addr, buf)); - - rv = core_inet_pton(AF_INET6, "::1", &addr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&addr, buf)); - - paddr = NULL; - rv = core_addaddrinfo(&paddr, AF_UNSPEC, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_sortaddrinfo(&paddr, AF_INET6); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(paddr, buf)); - ABTS_PTR_NOTNULL(tc, paddr->next); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(paddr->next, buf)); - - rv = core_copyaddrinfo(&dst, paddr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(dst, buf)); - ABTS_PTR_NOTNULL(tc, paddr->next); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(dst->next, buf)); - rv = core_freeaddrinfo(dst); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_sortaddrinfo(&paddr, AF_INET); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(paddr, buf)); - ABTS_PTR_NOTNULL(tc, paddr->next); - ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(paddr->next, buf)); - - rv = core_filteraddrinfo(&paddr, AF_INET); - ABTS_PTR_NOTNULL(tc, paddr); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(paddr, buf)); - - rv = core_copyaddrinfo(&dst, paddr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(dst, buf)); - rv = core_addaddrinfo(&dst, AF_UNSPEC, NULL, PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(dst, buf)); - - rv = core_freeaddrinfo(dst); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_filteraddrinfo(&paddr, AF_INET6); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_PTR_NULL(tc, paddr); - - rv = core_copyaddrinfo(&dst, paddr); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_PTR_NULL(tc, dst); - - paddr = NULL; - rv = core_addaddrinfo(&paddr, AF_INET, "127.0.0.1", PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_addaddrinfo(&paddr, AF_INET, "127.0.0.2", PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_addaddrinfo(&paddr, AF_INET, "127.0.0.3", PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_filteraddrinfo(&paddr, AF_INET6); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static void sock_test7(abts_case *tc, void *data) -{ - status_t rv; - sock_node_t *node; - c_sockaddr_t *addr; - list_t list, list6; - - list_init(&list); - list_init(&list6); - - rv = core_getaddrinfo(&addr, AF_UNSPEC, "localhost", PORT, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = sock_add_node(&list, &node, addr, AF_INET); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - core_freeaddrinfo(addr); - - sock_remove_all_nodes(&list); - - rv = sock_probe_node(&list, &list6, NULL, PORT); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - sock_remove_all_nodes(&list); - sock_remove_all_nodes(&list6); -} - -static void sock_test8(abts_case *tc, void *data) -{ - status_t rv; - ipsubnet_t ipsub; - - rv = core_ipsubnet(&ipsub, "127.0.0.1", "8"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_ipsubnet(&ipsub, "fe80::1", "64"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_ipsubnet(&ipsub, "172.16.0.1", "16"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_ipsubnet(&ipsub, "cafe::1", "64"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_ipsubnet(&ipsub, "172.16.0.1", NULL); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = core_ipsubnet(&ipsub, "cafe::1", NULL); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -abts_suite *testsock(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, sock_test1, NULL); - abts_run_test(suite, sock_test2, NULL); - abts_run_test(suite, sock_test3, NULL); - abts_run_test(suite, sock_test4, NULL); - abts_run_test(suite, sock_test5, NULL); - abts_run_test(suite, sock_test6, NULL); - abts_run_test(suite, sock_test7, NULL); - abts_run_test(suite, sock_test8, NULL); - - return suite; -} diff --git a/lib/core/test/testthread.c b/lib/core/test/testthread.c deleted file mode 100644 index d562ea9ca..000000000 --- a/lib/core/test/testthread.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "core_mutex.h" -#include "core_thread.h" -#include "testutil.h" - -static mutex_id lock; -static int x = 0; - -static status_t exit_ret_val = 123; - -static thread_id t1; -static thread_id t2; -static thread_id t3; -static thread_id t4; - -static void *THREAD_FUNC thread_func1(thread_id id, void *data) -{ - int i; - - for (i = 0; i < 10000; i++) - { - mutex_lock(lock); - x++; - mutex_unlock(lock); - } - thread_exit(id, exit_ret_val); - return NULL; -} - -static void init_thread(abts_case *tc, void *data) -{ - status_t rv; - - rv = mutex_create(&lock, MUTEX_DEFAULT); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static void create_threads(abts_case *tc, void *data) -{ - status_t rv; - - rv = thread_create(&t1, NULL, thread_func1, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = thread_create(&t2, NULL, thread_func1, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = thread_create(&t3, NULL, thread_func1, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = thread_create(&t4, NULL, thread_func1, NULL); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -static void join_threads(abts_case *tc, void *data) -{ - status_t s; - - thread_join(&s, t1); - ABTS_INT_EQUAL(tc, exit_ret_val, s); - thread_join(&s, t2); - ABTS_INT_EQUAL(tc, exit_ret_val, s); - thread_join(&s, t3); - ABTS_INT_EQUAL(tc, exit_ret_val, s); - thread_join(&s, t4); - ABTS_INT_EQUAL(tc, exit_ret_val, s); -} - -static void check_locks(abts_case *tc, void *data) -{ - ABTS_INT_EQUAL(tc, 40000, x); -} - -static void final_thread(abts_case *tc, void *data) -{ - status_t rv; - - rv = mutex_delete(lock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); -} - -abts_suite *testthread(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, init_thread, NULL); - abts_run_test(suite, create_threads, NULL); - abts_run_test(suite, join_threads, NULL); - abts_run_test(suite, check_locks, NULL); - abts_run_test(suite, final_thread, NULL); - - return suite; -} - diff --git a/lib/core/test/testtime.c b/lib/core/test/testtime.c deleted file mode 100644 index d5049c046..000000000 --- a/lib/core/test/testtime.c +++ /dev/null @@ -1,289 +0,0 @@ -#include "core_time.h" -#include "testutil.h" - -#define STR_SIZE 100 - -/* The time value is used throughout the tests, so just make this a global. - * Also, we need a single value that we can test for the positive tests, so - * I chose the number below, it corresponds to: - * 2002-08-14 12:05:36.186711 -25200 [257 Sat]. - * Which happens to be when I wrote the new tests. - */ -static c_time_t now = C_INT64_C(1032030336186711); - -static void test_now(abts_case *tc, void *data) -{ - c_time_t timediff; - c_time_t current; - time_t os_now; - - current = time_now(); - time(&os_now); - - timediff = os_now - (current / USEC_PER_SEC); - /* Even though these are called so close together, there is the chance - * that the time will be slightly off, so accept anything between -1 and - * 1 second. - */ - ABTS_ASSERT(tc, "core_time and OS time do not agree", - (timediff > -2) && (timediff < 2)); -} - -static void test_gmtstr(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - char str[STR_SIZE+1]; - - rv = time_exp_gmt(&xt, now); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "time_exp_gmt"); - } - ABTS_TRUE(tc, rv == CORE_OK); - sprintf(str, "%04d-%02d-%02d %02d:%02d:%02d.%06d %+05d [%d %s]%s", - xt.tm_year + 1900, - xt.tm_mon, - xt.tm_mday, - xt.tm_hour, - xt.tm_min, - xt.tm_sec, - xt.tm_usec, - xt.tm_gmtoff, - xt.tm_yday + 1, - day_snames[xt.tm_wday], - (xt.tm_isdst ? " DST" : "")); - ABTS_STR_EQUAL(tc, "2002-08-14 19:05:36.186711 +0000 [257 Sat]", str); -} - -static void test_exp_lt(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - time_t posix_secs = (time_t)time_sec(now); - struct tm *posix_exp = localtime(&posix_secs); - - rv = time_exp_lt(&xt, now); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "time_exp_lt"); - } - ABTS_TRUE(tc, rv == CORE_OK); - -#define CHK_FIELD(f) \ - ABTS_ASSERT(tc, "Mismatch in " #f, posix_exp->f == xt.f) - - CHK_FIELD(tm_sec); - CHK_FIELD(tm_min); - CHK_FIELD(tm_hour); - CHK_FIELD(tm_mday); - CHK_FIELD(tm_mon); - CHK_FIELD(tm_year); - CHK_FIELD(tm_wday); - CHK_FIELD(tm_yday); - CHK_FIELD(tm_isdst); -#undef CHK_FIELD -} - -static void test_exp_get_gmt(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - c_time_t imp; - c_int64_t hr_off_64; - - rv = time_exp_gmt(&xt, now); - ABTS_TRUE(tc, rv == CORE_OK); - rv = time_exp_get(&imp, &xt); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "time_exp_get"); - } - ABTS_TRUE(tc, rv == CORE_OK); - hr_off_64 = (c_int64_t) xt.tm_gmtoff * USEC_PER_SEC; - ABTS_TRUE(tc, now + hr_off_64 == imp); -} - -static void test_exp_get_lt(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - c_time_t imp; - c_int64_t hr_off_64; - - rv = time_exp_lt(&xt, now); - ABTS_TRUE(tc, rv == CORE_OK); - rv = time_exp_get(&imp, &xt); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "time_exp_get"); - } - ABTS_TRUE(tc, rv == CORE_OK); - hr_off_64 = (c_int64_t) xt.tm_gmtoff * USEC_PER_SEC; - ABTS_TRUE(tc, now + hr_off_64 == imp); -} - -static void test_imp_gmt(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - c_time_t imp; - - rv = time_exp_gmt(&xt, now); - ABTS_TRUE(tc, rv == CORE_OK); - rv = time_exp_gmt_get(&imp, &xt); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "time_exp_gmt_get"); - } - ABTS_TRUE(tc, rv == CORE_OK); - ABTS_TRUE(tc, now == imp); -} - -static void test_rfcstr(abts_case *tc, void *data) -{ - status_t rv; - char str[STR_SIZE]; - - rv = rfc822_date(str, now); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "rfc822_date"); - } - ABTS_TRUE(tc, rv == CORE_OK); - ABTS_STR_EQUAL(tc, "Sat, 14 Sep 2002 19:05:36 GMT", str); -} - -static void test_ctime(abts_case *tc, void *data) -{ - status_t rv; - char core_str[STR_SIZE]; - char libc_str[STR_SIZE]; - c_time_t now_sec = time_sec(now); - time_t posix_sec = (time_t) now_sec; - - rv = core_ctime(core_str, now); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "core_ctime"); - } - ABTS_TRUE(tc, rv == CORE_OK); - strcpy(libc_str, ctime(&posix_sec)); - *strchr(libc_str, '\n') = '\0'; - - ABTS_STR_EQUAL(tc, libc_str, core_str); -} - -static void test_strftime(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - char str[STR_SIZE+1]; - size_t sz; - - rv = time_exp_gmt(&xt, now); - rv = core_strftime(str, &sz, STR_SIZE, "%R %A %d %B %Y", &xt); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "core_strftime"); - } - ABTS_TRUE(tc, rv == CORE_OK); - ABTS_STR_EQUAL(tc, "19:05 Saturday 14 September 2002", str); -} - -static void test_strftimesmall(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - char str[STR_SIZE]; - size_t sz; - - rv = time_exp_gmt(&xt, now); - rv = core_strftime(str, &sz, STR_SIZE, "%T", &xt); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "core_strftime"); - } - ABTS_TRUE(tc, rv == CORE_OK); - ABTS_STR_EQUAL(tc, "19:05:36", str); -} - -static void test_exp_tz(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - c_int32_t hr_off = -5 * 3600; /* 5 hours in seconds */ - - rv = time_exp_tz(&xt, now, hr_off); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "time_exp_tz"); - } - ABTS_TRUE(tc, rv == CORE_OK); - ABTS_TRUE(tc, (xt.tm_usec == 186711) && - (xt.tm_sec == 36) && - (xt.tm_min == 5) && - (xt.tm_hour == 14) && - (xt.tm_mday == 14) && - (xt.tm_mon == 8) && - (xt.tm_year == 102) && - (xt.tm_wday == 6) && - (xt.tm_yday == 256)); -} - -static void test_strftimeoffset(abts_case *tc, void *data) -{ - status_t rv; - time_exp_t xt; - char str[STR_SIZE]; - size_t sz; - c_int32_t hr_off = -5 * 3600; /* 5 hours in seconds */ - - time_exp_tz(&xt, now, hr_off); - rv = core_strftime(str, &sz, STR_SIZE, "%T", &xt); - if (rv == CORE_ENOTIMPL) - { - ABTS_NOT_IMPL(tc, "core_strftime"); - } - ABTS_TRUE(tc, rv == CORE_OK); -} - -/* 0.9.4 and earlier rejected valid dates in 2038 */ -static void test_2038(abts_case *tc, void *data) -{ - time_exp_t xt; - c_time_t t; - - /* 2038-01-19T03:14:07.000000Z */ - xt.tm_year = 138; - xt.tm_mon = 0; - xt.tm_mday = 19; - xt.tm_hour = 3; - xt.tm_min = 14; - xt.tm_sec = 7; - - CORE_ASSERT_OK(tc, "explode January 19th, 2038", - time_exp_get(&t, &xt)); -} - -abts_suite *testtime(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, test_now, NULL); - abts_run_test(suite, test_gmtstr, NULL); - abts_run_test(suite, test_exp_lt, NULL); - abts_run_test(suite, test_exp_get_gmt, NULL); - abts_run_test(suite, test_exp_get_lt, NULL); - abts_run_test(suite, test_imp_gmt, NULL); - abts_run_test(suite, test_rfcstr, NULL); - abts_run_test(suite, test_ctime, NULL); - abts_run_test(suite, test_strftime, NULL); - abts_run_test(suite, test_strftimesmall, NULL); - abts_run_test(suite, test_exp_tz, NULL); - abts_run_test(suite, test_strftimeoffset, NULL); - abts_run_test(suite, test_2038, NULL); - - return suite; -} - diff --git a/lib/core/test/testtimer.c b/lib/core/test/testtimer.c deleted file mode 100644 index f4dc0c1f7..000000000 --- a/lib/core/test/testtimer.c +++ /dev/null @@ -1,397 +0,0 @@ -#include "core_time.h" -#include "core_timer.h" -#include "core_param.h" -#include "testutil.h" - -#define TEST_TIMER_NUM 200 -#define TEST_TIMER_PRECISION 20 /* 2ms precision */ -#define TEST_DURATION 400 - -c_uint8_t expire_check[TEST_DURATION/TEST_TIMER_PRECISION]; - -typedef struct _test_timer_eliment -{ - c_uint8_t type; - c_uint32_t duration; -} test_timer_eliment; - - -test_timer_eliment timer_eliment[] ={ - {TIMER_TYPE_ONE_SHOT, 500}, - {TIMER_TYPE_ONE_SHOT, 50}, - {TIMER_TYPE_ONE_SHOT, 200}, - {TIMER_TYPE_ONE_SHOT, 90}, - {TIMER_TYPE_ONE_SHOT, 800} -}; - - -void test_expire_func_1(c_uintptr_t data, - c_uintptr_t param1, c_uintptr_t param2, c_uintptr_t param3, - c_uintptr_t param4, c_uintptr_t param5, c_uintptr_t param6) -{ - c_uint32_t index = param2; - - expire_check[index] = TRUE; -} - -void test_expire_func_2(c_uintptr_t data, - c_uintptr_t param1, c_uintptr_t param2, c_uintptr_t param3, - c_uintptr_t param4, c_uintptr_t param5, c_uintptr_t param6) -{ - c_uint32_t index = param2; - - expire_check[index]++; -} - -static void test_now(abts_case *tc, void *data) -{ - c_time_t timediff; - c_time_t current; - time_t os_now; - - current = time_now(); - time(&os_now); - - timediff = os_now - (current / USEC_PER_SEC); - /* Even though these are called so close together, there is the chance - * that the time will be slightly off, so accept anything between -1 and - * 1 second. - */ - ABTS_ASSERT(tc, "core_time and OS time do not agree", - (timediff > -2) && (timediff < 2)); -} - - -/* basic timer Test */ -static void timer_test_1(abts_case *tc, void *data) -{ - - int n = 0; - tm_block_id id_array[100]; - tm_block_id id; - tm_service_t tm_service; - - memset((char*)id_array, 0x00, sizeof(tm_service)); - memset(expire_check, 0x00, sizeof(expire_check)); - - /* init tm_service */ - tm_service_init(&tm_service); - - for(n = 0; n < sizeof(timer_eliment) / sizeof(test_timer_eliment); n++) - { - id_array[n] = tm_create(&tm_service, TIMER_TYPE_ONE_SHOT, - timer_eliment[n].duration, test_expire_func_1); - - tm_set_param1(id_array[n], (c_uintptr_t)id_array[n]); - tm_set_param2(id_array[n], n); - } - - - for(n = 0; n < sizeof(timer_eliment) / sizeof(test_timer_eliment); n++) - { - tm_start(id_array[n]); - } - - id = (tm_block_id)list_first(&tm_service.idle_list); - ABTS_INT_EQUAL(tc, id, 0); - - id = (tm_block_id)list_first(&tm_service.active_list); - ABTS_INT_NEQUAL(tc, id, 0); - ABTS_INT_EQUAL(tc, id, id_array[1]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[3]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[2]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[0]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[4]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - core_sleep(70000); - tm_execute_tm_service(&tm_service, 0); - - id = (tm_block_id)list_first(&tm_service.idle_list); - ABTS_INT_EQUAL(tc, id, id_array[1]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - id = (tm_block_id)list_first(&tm_service.active_list); - ABTS_INT_NEQUAL(tc, id, 0); - ABTS_INT_EQUAL(tc, id, id_array[3]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[2]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[0]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[4]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - ABTS_INT_EQUAL(tc, expire_check[0], 0); - ABTS_INT_EQUAL(tc, expire_check[1], 1); - ABTS_INT_EQUAL(tc, expire_check[2], 0); - ABTS_INT_EQUAL(tc, expire_check[3], 0); - ABTS_INT_EQUAL(tc, expire_check[4], 0); - - - core_sleep(40000); - tm_execute_tm_service(&tm_service, 0); - - id = (tm_block_id)list_first(&tm_service.idle_list); - ABTS_INT_EQUAL(tc, id, id_array[1]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[3]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - id = (tm_block_id)list_first(&tm_service.active_list); - ABTS_INT_NEQUAL(tc, id, 0); - ABTS_INT_EQUAL(tc, id, id_array[2]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[0]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[4]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - ABTS_INT_EQUAL(tc, expire_check[0], 0); - ABTS_INT_EQUAL(tc, expire_check[1], 1); - ABTS_INT_EQUAL(tc, expire_check[2], 0); - ABTS_INT_EQUAL(tc, expire_check[3], 1); - ABTS_INT_EQUAL(tc, expire_check[4], 0); - - - core_sleep(140000); - tm_execute_tm_service(&tm_service, 0); - - id = (tm_block_id)list_first(&tm_service.idle_list); - ABTS_INT_EQUAL(tc, id, id_array[1]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[3]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[2]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - id = (tm_block_id)list_first(&tm_service.active_list); - ABTS_INT_NEQUAL(tc, id, 0); - ABTS_INT_EQUAL(tc, id, id_array[0]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[4]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - ABTS_INT_EQUAL(tc, expire_check[0], 0); - ABTS_INT_EQUAL(tc, expire_check[1], 1); - ABTS_INT_EQUAL(tc, expire_check[2], 1); - ABTS_INT_EQUAL(tc, expire_check[3], 1); - ABTS_INT_EQUAL(tc, expire_check[4], 0); - - - core_sleep(300000); - tm_execute_tm_service(&tm_service, 0); - - id = (tm_block_id)list_first(&tm_service.idle_list); - ABTS_INT_EQUAL(tc, id, id_array[1]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[3]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[2]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[0]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - id = (tm_block_id)list_first(&tm_service.active_list); - ABTS_INT_NEQUAL(tc, id, 0); - ABTS_INT_EQUAL(tc, id, id_array[4]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - ABTS_INT_EQUAL(tc, expire_check[0], 1); - ABTS_INT_EQUAL(tc, expire_check[1], 1); - ABTS_INT_EQUAL(tc, expire_check[2], 1); - ABTS_INT_EQUAL(tc, expire_check[3], 1); - ABTS_INT_EQUAL(tc, expire_check[4], 0); - - - core_sleep(300000); - tm_execute_tm_service(&tm_service, 0); - - id = (tm_block_id)list_first(&tm_service.idle_list); - ABTS_INT_EQUAL(tc, id, id_array[1]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[3]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[2]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[0]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, id_array[4]); if(tc->failed) return; - id = (tm_block_id)list_next(id); - ABTS_INT_EQUAL(tc, id, 0); - - id = (tm_block_id)list_first(&tm_service.active_list); - ABTS_INT_EQUAL(tc, id, 0); - - ABTS_INT_EQUAL(tc, expire_check[0], 1); - ABTS_INT_EQUAL(tc, expire_check[1], 1); - ABTS_INT_EQUAL(tc, expire_check[2], 1); - ABTS_INT_EQUAL(tc, expire_check[3], 1); - ABTS_INT_EQUAL(tc, expire_check[4], 1); - - for( n = 0; n < sizeof(timer_eliment) / sizeof(test_timer_eliment); n++) - { - tm_delete(id_array[n]); - } - - ABTS_INT_EQUAL(tc, tm_pool_avail(), MAX_NUM_OF_TIMER); - - return; -} - - -static void timer_test_2(abts_case *tc, void *data) -{ - - int n = 0; - tm_block_id id_array[TEST_TIMER_NUM]; - tm_service_t tm_service; - int duration; - int tm_num[TEST_DURATION/TEST_TIMER_PRECISION]; - int tm_idx; - - memset((char*)id_array, 0x00, sizeof(tm_service)); - memset(expire_check, 0x00, sizeof(expire_check)); - memset(tm_num, 0x00, sizeof(tm_num)); - - /* init tm_service */ - tm_service_init(&tm_service); - - for(n = 0; n < TEST_TIMER_NUM; n++) - { - duration = (rand() % (TEST_DURATION/TEST_TIMER_PRECISION)) - * TEST_TIMER_PRECISION; - - tm_idx = duration/TEST_TIMER_PRECISION; - tm_num[tm_idx]++; - duration += (TEST_TIMER_PRECISION >> 1); - - id_array[n] = tm_create(&tm_service, - TIMER_TYPE_ONE_SHOT, duration, test_expire_func_2); - tm_set_param1(id_array[n], (c_uintptr_t)id_array[n]); - tm_set_param2(id_array[n], tm_idx); - } - - for(n = 0; n < TEST_TIMER_NUM; n++) - { - tm_start(id_array[n]); - } - - for(n = 0; n < TEST_DURATION/TEST_TIMER_PRECISION; n++) - { - core_sleep(TEST_TIMER_PRECISION * 1000); - tm_execute_tm_service(&tm_service, 0); - ABTS_INT_EQUAL(tc, tm_num[n], expire_check[n]); - } - - for(n = 0; n < TEST_TIMER_NUM; n++) - { - tm_delete(id_array[n]); - } - - ABTS_INT_EQUAL(tc, tm_pool_avail(), MAX_NUM_OF_TIMER); - - return; -} - - -static void timer_test_3(abts_case *tc, void *data) -{ - c_uint32_t n = 0; - tm_block_id id_array[TEST_TIMER_NUM]; - tm_service_t tm_service; - int id_duration[TEST_TIMER_NUM]; - int duration; - int tm_num[TEST_DURATION/TEST_TIMER_PRECISION]; - int tm_idx, tm_check_id; - - memset((char*)id_array, 0x00, sizeof(tm_service)); - memset(expire_check, 0x00, sizeof(expire_check)); - memset(tm_num, 0x00, sizeof(tm_num)); - - /* init tm_service */ - tm_service_init(&tm_service); - - for(n = 0; n < TEST_TIMER_NUM; n++) - { - duration = (rand() % (TEST_DURATION/TEST_TIMER_PRECISION)) - * TEST_TIMER_PRECISION; - tm_idx = duration/TEST_TIMER_PRECISION; - tm_num[tm_idx]++; - id_duration[n] = duration; - duration += (TEST_TIMER_PRECISION >> 1); - - id_array[n] = tm_create(&tm_service, - TIMER_TYPE_ONE_SHOT, duration, test_expire_func_2); - tm_set_param1(id_array[n], (c_uintptr_t)id_array[n]); - tm_set_param2(id_array[n], tm_idx); - } - - for(n = 0; n < TEST_TIMER_NUM; n++) - { - tm_start(id_array[n]); - } - - for(n = 0; n < TEST_TIMER_NUM / 10; n++) - { - tm_idx = n*10 + rand()%10; - tm_check_id = id_duration[tm_idx]/TEST_TIMER_PRECISION; - tm_num[tm_check_id]--; - tm_delete(id_array[tm_idx]); - id_array[tm_idx] = 0; - } - - for(n = 0; n < TEST_DURATION/TEST_TIMER_PRECISION; n++) - { - core_sleep(TEST_TIMER_PRECISION * 1000); - tm_execute_tm_service(&tm_service, 0); - ABTS_INT_EQUAL(tc, tm_num[n], expire_check[n]); - } - - for(n = 0; n < TEST_TIMER_NUM; n++) - { - if(id_array[n] != 0) - { - tm_delete(id_array[n]); - } - } - - ABTS_INT_EQUAL(tc, tm_pool_avail(), MAX_NUM_OF_TIMER); - - return; -} - -abts_suite *testtimer(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - /* - * OpenSUSE OBS - * - Ubuntu 16.10 i586 failed - * - It is probably VM issue - * [ 661s] testtimer : Line 176: expected <1449351760>, but saw <0> - * [ 661s] Line 305: expected <1019>, but saw <1024> - * [ 661s] Line 372: expected <1019>, but saw <1024> - * [ 661s] FAILED 3 of 4 - */ - abts_run_test(suite, test_now, NULL); - abts_run_test(suite, timer_test_1, NULL); - abts_run_test(suite, timer_test_2, NULL); - abts_run_test(suite, timer_test_3, NULL); - - return suite; -} - diff --git a/lib/core/test/testtlv.c b/lib/core/test/testtlv.c deleted file mode 100644 index e526a743a..000000000 --- a/lib/core/test/testtlv.c +++ /dev/null @@ -1,875 +0,0 @@ -#include "core_tlv.h" -#include "core_tlv_msg.h" -#include "core_lib.h" - -#include "core_debug.h" - -#include "testutil.h" - -#define TLV_0_LEN 10 -#define TLV_1_LEN 20 -#define TLV_2_LEN 100 -#define TLV_3_LEN 200 -#define TLV_4_LEN 2 -#define TLV_5_LEN 2000 -#define TLV_0_INSTANCE 0 -#define TLV_1_INSTANCE 1 -#define TLV_2_INSTANCE 2 -#define TLV_3_INSTANCE 3 -#define TLV_4_INSTANCE 4 -#define TLV_5_INSTANCE 5 -#define TLV_VALUE_ARRAY_SIZE 3000 - -#define EMBED_TLV_TYPE 20 -#define EMBED_TLV_INSTANCE 7 - -typedef struct _test_tlv_element -{ - c_uint8_t type; - c_uint32_t length; - c_uint8_t instance; - c_uint8_t *value; - c_uint8_t val_char; -} test_tlv_element; - -c_uint8_t test_tlv_value[TLV_VALUE_ARRAY_SIZE]; - -test_tlv_element tlv_element[] ={ - {1, TLV_0_LEN, TLV_0_INSTANCE, 0, 0x0a}, - {50, TLV_1_LEN, TLV_1_INSTANCE, 0, 0x0b}, - {255, TLV_2_LEN, TLV_2_INSTANCE, 0, 0x0c}, - {254, TLV_3_LEN, TLV_3_INSTANCE, 0, 0x0d}, - {5, TLV_4_LEN, TLV_4_INSTANCE, 0, 0x0e}, - {30, TLV_5_LEN, TLV_5_INSTANCE, 0, 0x0f} -}; - -void tlv_test_set_tlv_value(void) -{ - c_uint32_t inc = 0; - - /* set test tlv value */ - tlv_element[0].value = test_tlv_value; - memset(tlv_element[0].value, tlv_element[0].val_char, tlv_element[0].length); - inc += tlv_element[0].length; - - tlv_element[1].value = test_tlv_value + inc; - memset(tlv_element[1].value, tlv_element[1].val_char, tlv_element[1].length); - inc += tlv_element[1].length; - - tlv_element[2].value = test_tlv_value + inc; - memset(tlv_element[2].value, tlv_element[2].val_char, tlv_element[2].length); - inc += tlv_element[2].length; - - tlv_element[3].value = test_tlv_value + inc; - memset(tlv_element[3].value, tlv_element[3].val_char, tlv_element[3].length); - inc += tlv_element[3].length; - - tlv_element[4].value = test_tlv_value + inc; - memset(tlv_element[4].value, tlv_element[4].val_char, tlv_element[4].length); - inc += tlv_element[4].length; - - return; -} - -void tlv_test_check_embed_tlv_test(abts_case *tc, tlv_t *root_tlv, int mode) -{ - c_uint32_t m; - c_uint32_t parent_block_len; - tlv_t *pTlv; - tlv_t *embed_tlv = NULL, *parent_tlv = NULL, *parsed_tlv = NULL; - c_uint8_t parent_block[4000]; - c_uint8_t *pos = NULL; - int result; - - memset(parent_block, 0x00, sizeof(parent_block)); - - parent_block_len = tlv_render(root_tlv, parent_block, - sizeof(parent_block), mode); - - tlv_free_all(root_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - pos = parent_block; - - switch(mode) - { - case TLV_MODE_T2_L2: - { - ABTS_INT_EQUAL(tc, 332, parent_block_len); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].type >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].length & 0xFF); - for(m = 0; m < tlv_element[0].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].val_char); - - ABTS_INT_EQUAL(tc, *(pos++), EMBED_TLV_TYPE >> 8); - ABTS_INT_EQUAL(tc, *(pos++), EMBED_TLV_TYPE & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), (308 >> 8)); - ABTS_INT_EQUAL(tc, *(pos++), 308 & 0xFF); - - /* embedded tlv_t */ - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].type >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].length & 0xFF); - for(m = 0; m < tlv_element[2].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].val_char); - - - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].type >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].length & 0xFF); - for(m = 0; m < tlv_element[3].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].val_char); - - - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].type >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].length & 0xFF); - - for(m = 0; m < tlv_element[4].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), 0x0e); - break; - } - case TLV_MODE_T1_L2: - { - ABTS_INT_EQUAL(tc, 327, parent_block_len); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].length & 0xFF); - for(m = 0; m < tlv_element[0].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].val_char); - - ABTS_INT_EQUAL(tc, *(pos++), EMBED_TLV_TYPE & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), (306 >> 8)); - ABTS_INT_EQUAL(tc, *(pos++), 306 & 0xFF); - - /* embedded tlv_t */ - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].length & 0xFF); - for(m = 0; m < tlv_element[2].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].val_char); - - - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].length & 0xFF); - for(m = 0; m < tlv_element[3].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].val_char); - - - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].length & 0xFF); - - for(m = 0; m < tlv_element[4].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), 0x0e); - break; - } - case TLV_MODE_T1_L2_I1: - { - ABTS_INT_EQUAL(tc, 332, parent_block_len); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].length & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].instance & 0xFF); - for(m = 0; m < tlv_element[0].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[0].val_char); - - ABTS_INT_EQUAL(tc, *(pos++), EMBED_TLV_TYPE & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), (308 >> 8)); - ABTS_INT_EQUAL(tc, *(pos++), 308 & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), EMBED_TLV_INSTANCE); - - /* embedded tlv_t */ - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].length & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].instance & 0xFF); - for(m = 0; m < tlv_element[2].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[2].val_char); - - - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].length & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].instance & 0xFF); - for(m = 0; m < tlv_element[3].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[3].val_char); - - - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].type & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].length >> 8); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].length & 0xFF); - ABTS_INT_EQUAL(tc, *(pos++), tlv_element[4].instance & 0xFF); - - for(m = 0; m < tlv_element[4].length; m++) - ABTS_INT_EQUAL(tc, *(pos++), 0x0e); - break; - } - default: - { - ABTS_TRUE(tc, 0); - break; - } - } - - parsed_tlv = tlv_parse_block(parent_block_len, - parent_block, mode); - ABTS_PTR_NOTNULL(tc, parsed_tlv); - - pTlv = parsed_tlv; - - ABTS_INT_EQUAL(tc, pTlv->type, tlv_element[0].type); - ABTS_INT_EQUAL(tc, pTlv->length, tlv_element[0].length); - ABTS_INT_EQUAL(tc, pTlv->instance, tlv_element[0].instance); - result = memcmp(pTlv->value, tlv_element[0].value, tlv_element[0].length); - ABTS_INT_EQUAL(tc, result, 0); - pTlv = pTlv->next; - - ABTS_INT_EQUAL(tc, pTlv->type, 20); - switch(mode) - { - case TLV_MODE_T2_L2: - case TLV_MODE_T1_L2_I1: - ABTS_INT_EQUAL(tc, pTlv->length, 308); - break; - case TLV_MODE_T1_L2: - ABTS_INT_EQUAL(tc, pTlv->length, 306); - break; - default: - ABTS_TRUE(tc, 0); - break; - } - pTlv = pTlv->next; - - ABTS_INT_EQUAL(tc, pTlv->type, tlv_element[4].type); - ABTS_INT_EQUAL(tc, pTlv->length, tlv_element[4].length); - if (mode == TLV_MODE_T1_L2_I1) - ABTS_INT_EQUAL(tc, pTlv->instance, tlv_element[4].instance); - else - ABTS_INT_EQUAL(tc, pTlv->instance, 0); - result = memcmp(pTlv->value, tlv_element[4].value, tlv_element[4].length); - ABTS_INT_EQUAL(tc, result, 0); - pTlv = pTlv->next; - - ABTS_PTR_NULL(tc, pTlv); - - parent_tlv = tlv_find(parsed_tlv,20); - ABTS_PTR_NOTNULL(tc, parent_tlv); - - tlv_parse_embedded_block(parent_tlv, mode); - embed_tlv = parent_tlv->embedded; - ABTS_PTR_NOTNULL(tc, embed_tlv); - - ABTS_INT_EQUAL(tc, embed_tlv->type, tlv_element[2].type); - ABTS_INT_EQUAL(tc, embed_tlv->length, tlv_element[2].length); - if (mode == TLV_MODE_T1_L2_I1) - ABTS_INT_EQUAL(tc, embed_tlv->instance, tlv_element[2].instance); - else - ABTS_INT_EQUAL(tc, embed_tlv->instance, 0); - for(m = 0; m < tlv_element[2].length; m++) - { - ABTS_INT_EQUAL(tc, *((c_uint8_t*)(embed_tlv->value+m)), - tlv_element[2].val_char); - } - embed_tlv = embed_tlv->next; - - ABTS_INT_EQUAL(tc, embed_tlv->type, tlv_element[3].type); - ABTS_INT_EQUAL(tc, embed_tlv->length, tlv_element[3].length); - if (mode == TLV_MODE_T1_L2_I1) - ABTS_INT_EQUAL(tc, embed_tlv->instance, tlv_element[3].instance); - else - ABTS_INT_EQUAL(tc, embed_tlv->instance, 0); - for(m = 0; m < tlv_element[3].length; m++) - { - ABTS_INT_EQUAL(tc, *((c_uint8_t*)(embed_tlv->value+m)), - tlv_element[3].val_char); - } - embed_tlv = embed_tlv->next; - - ABTS_PTR_NULL(tc, embed_tlv); - - embed_tlv = tlv_find(parsed_tlv,254); - ABTS_PTR_NOTNULL(tc, embed_tlv); - - embed_tlv = tlv_find(parsed_tlv,253); - ABTS_PTR_NULL(tc, embed_tlv); - - tlv_free_all(parsed_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - return; -} - -/* basic encoding/decoding/finding Test */ -static void tlv_test_1(abts_case *tc, void *data) -{ - c_uint32_t idx, m, parent_block_len; - tlv_t *root_tlv = NULL, *parsed_tlv = NULL, *pTlv; - c_uint8_t parent_block[4000]; - c_uint8_t *pos = NULL; - c_uint8_t mode = (c_uintptr_t)data; - - tlv_test_set_tlv_value(); - - /* tlv encoding for test */ - root_tlv = tlv_add(NULL,tlv_element[0].type, - tlv_element[0].length, tlv_element[0].instance, tlv_element[0].value); - - for(idx = 1; idx < 4; idx++) - { - tlv_add(root_tlv, tlv_element[idx].type, - tlv_element[idx].length, tlv_element[idx].instance, - tlv_element[idx].value); - } - - memset(parent_block, 0x00, sizeof(parent_block)); - parent_block_len = tlv_render(root_tlv, parent_block, - sizeof(parent_block), mode); - - switch(mode) - { - case TLV_MODE_T2_L2: - case TLV_MODE_T1_L2_I1: - ABTS_INT_EQUAL(tc, 346, parent_block_len); - break; - case TLV_MODE_T1_L2: - ABTS_INT_EQUAL(tc, 342, parent_block_len); - break; - case TLV_MODE_T1_L1: - ABTS_INT_EQUAL(tc, 338, parent_block_len); - break; - default: - ABTS_TRUE(tc, 0); - break; - } - - tlv_free_all(root_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - pos = parent_block; - - for(idx = 0; idx < 4; idx++) - { - switch(mode) - { - case TLV_MODE_T2_L2: - ABTS_INT_EQUAL(tc, (tlv_element[idx].type >> 8), *(pos++)); - ABTS_INT_EQUAL(tc, tlv_element[idx].type & 0xFF, *(pos++)); - ABTS_INT_EQUAL(tc, (tlv_element[idx].length >> 8), *(pos++)); - ABTS_INT_EQUAL(tc, tlv_element[idx].length & 0xFF, *(pos++)); - break; - case TLV_MODE_T1_L2: - ABTS_INT_EQUAL(tc, tlv_element[idx].type & 0xFF, *(pos++)); - ABTS_INT_EQUAL(tc, (tlv_element[idx].length >> 8), *(pos++)); - ABTS_INT_EQUAL(tc, tlv_element[idx].length & 0xFF, *(pos++)); - break; - case TLV_MODE_T1_L1: - ABTS_INT_EQUAL(tc, tlv_element[idx].type & 0xFF, *(pos++)); - ABTS_INT_EQUAL(tc, tlv_element[idx].length & 0xFF, *(pos++)); - break; - case TLV_MODE_T1_L2_I1: - ABTS_INT_EQUAL(tc, tlv_element[idx].type & 0xFF, *(pos++)); - ABTS_INT_EQUAL(tc, (tlv_element[idx].length >> 8), *(pos++)); - ABTS_INT_EQUAL(tc, tlv_element[idx].length & 0xFF, *(pos++)); - ABTS_INT_EQUAL(tc, tlv_element[idx].instance & 0xFF, *(pos++)); - break; - default: - ABTS_TRUE(tc, 0); - break; - } - - for(m = 0; m < tlv_element[idx].length; m++) - ABTS_INT_EQUAL(tc, tlv_element[idx].val_char, *(pos++)); - } - - parsed_tlv = tlv_parse_block(parent_block_len,parent_block, mode); - ABTS_PTR_NOTNULL(tc, parsed_tlv); - - pTlv = parsed_tlv; - - idx = 0; - while(pTlv) - { - int result; - ABTS_INT_EQUAL(tc, pTlv->type, tlv_element[idx].type); - ABTS_INT_EQUAL(tc, pTlv->length, tlv_element[idx].length); - if (mode == TLV_MODE_T1_L2_I1) - ABTS_INT_EQUAL(tc, pTlv->instance, tlv_element[idx].instance); - else - ABTS_INT_EQUAL(tc, pTlv->instance, 0); - result = memcmp(pTlv->value, tlv_element[idx].value, tlv_element[idx].length); - ABTS_INT_EQUAL(tc, result, 0); - - pTlv = pTlv->next; - idx++; - } - - ABTS_INT_EQUAL(tc, idx, 4); - - pTlv = tlv_find(parsed_tlv, 255); - ABTS_PTR_NOTNULL(tc, pTlv); - - pTlv = tlv_find(parsed_tlv, 253); - ABTS_PTR_NULL(tc, pTlv); - - tlv_free_all(parsed_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - return; -} - -/* embedded tlv_t test : first, make embedded tlv block for embeded tlv - and then make whole tlv block using embedded tlv block previously made*/ -static void tlv_test_2(abts_case *tc, void *data) -{ - c_uint32_t embed_block_len; - tlv_t *root_tlv = NULL; - tlv_t *embed_tlv = NULL; - c_uint8_t embed_block[1000];; - c_uint8_t mode = (c_uintptr_t)data; - - tlv_test_set_tlv_value(); - - /* Tlv Encoding for embeded tlv_t */ - embed_tlv = tlv_add(NULL, tlv_element[2].type, - tlv_element[2].length, tlv_element[2].instance, tlv_element[2].value); - tlv_add(embed_tlv,tlv_element[3].type, - tlv_element[3].length, tlv_element[3].instance, tlv_element[3].value); - - embed_block_len = tlv_render(embed_tlv, embed_block, - sizeof(embed_block), mode); - switch(mode) - { - case TLV_MODE_T2_L2: - case TLV_MODE_T1_L2_I1: - ABTS_INT_EQUAL(tc, embed_block_len, 308); - break; - case TLV_MODE_T1_L2: - ABTS_INT_EQUAL(tc, embed_block_len, 306); - break; - default: - ABTS_TRUE(tc, 0); - break; - } - - tlv_free_all(embed_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - root_tlv = tlv_add(NULL,tlv_element[0].type, - tlv_element[0].length, tlv_element[0].instance, tlv_element[0].value); - - tlv_add(root_tlv, EMBED_TLV_TYPE, embed_block_len, - EMBED_TLV_INSTANCE, embed_block); - tlv_add(root_tlv,tlv_element[4].type, - tlv_element[4].length, tlv_element[4].instance, tlv_element[4].value); - - tlv_test_check_embed_tlv_test(tc, root_tlv, mode); - - return; -} - - -/* embedded tlv_t test : make parent and embedded tlv and then tlv_render - functions makes whole tlv block. the value member of each tlv must - point to vaild address at the time using tlv_rendering function */ -static void tlv_test_3(abts_case *tc, void *data) -{ - tlv_t *root_tlv = NULL, *parent_tlv = NULL; - c_uint8_t mode = (c_uintptr_t)data; - - tlv_test_set_tlv_value(); - - /* Tlv Encoding for embeded tlv_t */ - root_tlv = tlv_add(NULL,tlv_element[0].type, - tlv_element[0].length, tlv_element[0].instance, tlv_element[0].value); - parent_tlv= tlv_add(root_tlv, EMBED_TLV_TYPE, 0, EMBED_TLV_INSTANCE, NULL); - tlv_add(root_tlv,tlv_element[4].type, - tlv_element[4].length, tlv_element[4].instance, tlv_element[4].value); - - tlv_embed(parent_tlv,tlv_element[2].type, - tlv_element[2].length, tlv_element[2].instance, tlv_element[2].value); - tlv_embed(parent_tlv,tlv_element[3].type, - tlv_element[3].length, tlv_element[3].instance, tlv_element[3].value); - - tlv_test_check_embed_tlv_test(tc, root_tlv, mode); - - return; -} - - -/* embedded tlv_t test : make parent and embedded tlv and then tlv_render - functions makes whole tlv block. The value member of each tlv is copied - to the buff of the root tlv_t, so the allocated resource for the value - member of each tlv can be deallocated after executing tlv_add or tlv embed - function*/ -static void tlv_test_4(abts_case *tc, void *data) -{ - tlv_t *root_tlv = NULL, *parent_tlv = NULL; - c_uint8_t tlv_buff[2000]; - c_uint8_t mode = (c_uintptr_t)data; - - tlv_test_set_tlv_value(); - - root_tlv = tlv_copy(tlv_buff, sizeof(tlv_buff), - tlv_element[0].type, tlv_element[0].length, - tlv_element[0].instance, tlv_element[0].value); - parent_tlv = tlv_add(root_tlv, EMBED_TLV_TYPE, 0, EMBED_TLV_INSTANCE, NULL); - tlv_add(root_tlv, tlv_element[4].type, tlv_element[4].length, - tlv_element[4].instance, tlv_element[4].value); - - tlv_embed(parent_tlv,tlv_element[2].type, - tlv_element[2].length, tlv_element[2].instance, tlv_element[2].value); - tlv_embed(parent_tlv,tlv_element[3].type, - tlv_element[3].length, tlv_element[3].instance, tlv_element[3].value); - - memset(tlv_element[2].value, 0x00, tlv_element[2].length); - memset(tlv_element[3].value, 0xf0, tlv_element[3].length); - - tlv_test_check_embed_tlv_test(tc, root_tlv, mode); - - return; -} - -/* endian check test */ -static void tlv_test_5(abts_case *tc, void *data) -{ - c_uint32_t parent_block_len; - tlv_t *root_tlv = NULL, *parsed_tlv = NULL, *p_tlv; - c_uint8_t parent_block[4000]; - c_uint8_t *pos = NULL; - c_uint16_t c_16 = 0x1122; - c_uint32_t c_32 = 0x11223344; - c_uint8_t mode = (c_uintptr_t)data; - - /* tlv encoding for test */ - c_16 = htons(c_16); - root_tlv = tlv_add(NULL, 10, 2, 0, (c_uint8_t*)&c_16); - c_32 = htonl(c_32); - tlv_add(root_tlv, 20, 4, 0, (c_uint8_t*)&c_32); - - memset(parent_block, 0x00, sizeof(parent_block)); - parent_block_len = tlv_render(root_tlv, parent_block, - sizeof(parent_block), mode); - - tlv_free_all(root_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - pos = parent_block; - - switch(mode) - { - case TLV_MODE_T2_L2: - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 10); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 2); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 20); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 4); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 0x33); - ABTS_INT_EQUAL(tc, *(pos++), 0x44); - break; - case TLV_MODE_T1_L2: - ABTS_INT_EQUAL(tc, *(pos++), 10); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 2); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 20); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 4); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 0x33); - ABTS_INT_EQUAL(tc, *(pos++), 0x44); - break; - case TLV_MODE_T1_L2_I1: - ABTS_INT_EQUAL(tc, *(pos++), 10); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 2); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 20); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 4); - ABTS_INT_EQUAL(tc, *(pos++), 0); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 0x33); - ABTS_INT_EQUAL(tc, *(pos++), 0x44); - break; - case TLV_MODE_T1_L1: - ABTS_INT_EQUAL(tc, *(pos++), 10); - ABTS_INT_EQUAL(tc, *(pos++), 2); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 20); - ABTS_INT_EQUAL(tc, *(pos++), 4); - ABTS_INT_EQUAL(tc, *(pos++), 0x11); - ABTS_INT_EQUAL(tc, *(pos++), 0x22); - ABTS_INT_EQUAL(tc, *(pos++), 0x33); - ABTS_INT_EQUAL(tc, *(pos++), 0x44); - break; - default: - ABTS_TRUE(tc, 0); - break; - } - - p_tlv = parsed_tlv = tlv_parse_block(parent_block_len,parent_block, - mode); - ABTS_INT_EQUAL(tc, tlv_value_16(p_tlv), 0x1122); - p_tlv = parsed_tlv->next; - ABTS_INT_EQUAL(tc, tlv_value_32(p_tlv), 0x11223344); - - tlv_free_all(parsed_tlv); - ABTS_INT_EQUAL(tc, tlv_pool_avail(), NUM_OF_TLV_NODE); - - return; -} - -/* Sample header for tlv_msg */ -#define TLV_AUTHORIZATION_POLICY_SUPPORT_TYPE 21 -#define TLV_AUTHORIZATION_POLICY_SUPPORT_LEN 1 -typedef tlv_uint8_t tlv_authorization_policy_support_t; -extern tlv_desc_t tlv_desc_authorization_policy_support; - -#define TLV_CLIENT_SECURITY_HISTORY_TYPE 108 -#define TLV_CLIENT_SECURITY_HISTORY_LEN TLV_VARIABLE_LEN -typedef struct _tlv_client_security_history_t { - tlv_presence_t presence; - tlv_authorization_policy_support_t authorization_policy_support0; - tlv_authorization_policy_support_t authorization_policy_support2; -} tlv_client_security_history_t; -extern tlv_desc_t tlv_desc_client_security_history; - -#define TLV_CLIENT_INFO_TYPE 103 -#define TLV_CLIENT_INFO_LEN TLV_VARIABLE_LEN -typedef struct _tlv_client_info_t { - tlv_presence_t presence; - tlv_client_security_history_t client_security_history; -} tlv_client_info_t; -extern tlv_desc_t tlv_desc_client_info; - -#define TLV_SERVER_NAME_TYPE 25 -#define TLV_SERVER_NAME_LEN TLV_VARIABLE_LEN -typedef tlv_octet_t tlv_server_name_t; -extern tlv_desc_t tlv_desc_server_name; - -#define TLV_SERVER_INFO_TYPE 26 -#define TLV_SERVER_INFO_LEN TLV_VARIABLE_LEN -typedef struct _tlv_server_info_t { - tlv_presence_t presence; - tlv_server_name_t TLV_1_OR_MORE(server_name); -} tlv_server_info_t; -extern tlv_desc_t tlv_desc_server_info; - -typedef struct _tlv_attach_req { - tlv_client_info_t client_info; - tlv_server_info_t server_info; -} tlv_attach_req; - -extern tlv_desc_t tlv_desc_attach_req; - -/* Sample source for tlv_msg */ -tlv_desc_t tlv_desc_authorization_policy_support0 = -{ - TLV_UINT8, - "Auth Policy0", - TLV_AUTHORIZATION_POLICY_SUPPORT_TYPE, - TLV_AUTHORIZATION_POLICY_SUPPORT_LEN, - 0, - sizeof(tlv_authorization_policy_support_t), - { NULL } -}; -tlv_desc_t tlv_desc_authorization_policy_support2 = -{ - TLV_UINT8, - "Auth Policy2", - TLV_AUTHORIZATION_POLICY_SUPPORT_TYPE, - TLV_AUTHORIZATION_POLICY_SUPPORT_LEN, - 2, - sizeof(tlv_authorization_policy_support_t), - { NULL } -}; - -tlv_desc_t tlv_desc_client_security_history = -{ - TLV_COMPOUND, - "Sec History", - TLV_CLIENT_SECURITY_HISTORY_TYPE, - TLV_CLIENT_SECURITY_HISTORY_LEN, - 0, - sizeof(tlv_client_security_history_t), - { - &tlv_desc_authorization_policy_support0, - &tlv_desc_authorization_policy_support2, - NULL, - } -}; - -tlv_desc_t tlv_desc_client_info = -{ - TLV_COMPOUND, - "Client Info", - TLV_CLIENT_INFO_TYPE, - TLV_CLIENT_INFO_LEN, - 0, - sizeof(tlv_client_info_t), - { - &tlv_desc_client_security_history, - NULL, - } -}; - -tlv_desc_t tlv_desc_server_name = -{ - TLV_VAR_STR, - "Server Name", - TLV_SERVER_NAME_TYPE, - TLV_SERVER_NAME_LEN, - 0, - sizeof(tlv_server_name_t), - { NULL } -}; - -tlv_desc_t tlv_desc_server_info = -{ - TLV_COMPOUND, - "Server Info", - TLV_SERVER_INFO_TYPE, - TLV_SERVER_INFO_LEN, - 0, - sizeof(tlv_server_info_t), - { - &tlv_desc_server_name, &tlv_desc_more2, - NULL, - } -}; - -tlv_desc_t tlv_desc_attach_req = { - TLV_MESSAGE, "Attach Req", 0, 0, 0, 0, { - &tlv_desc_client_info, - &tlv_desc_server_info, - NULL, -}}; - -static void tlv_test_6(abts_case *tc, void *data) -{ - tlv_attach_req reqv; - tlv_attach_req reqv2; - - pkbuf_t *req = NULL; - char testbuf[1024]; - - /* Initialize message value structure */ - memset(&reqv, 0, sizeof(tlv_attach_req)); - - /* Set nessary members of message */ - reqv.client_info.presence = 1; - reqv.client_info.client_security_history.presence = 1; - reqv.client_info.client_security_history. - authorization_policy_support0.presence = 1; - reqv.client_info.client_security_history. - authorization_policy_support0.u8 = 0x3; - reqv.client_info.client_security_history. - authorization_policy_support2.presence = 1; - reqv.client_info.client_security_history. - authorization_policy_support2.u8 = 0x9; - - reqv.server_info.presence = 1; - reqv.server_info.server_name[0].presence = 1; - reqv.server_info.server_name[0].data = - (c_uint8_t*)"\x11\x22\x33\x44\x55\x66"; - reqv.server_info.server_name[0].len = 6; - - reqv.server_info.presence = 1; - reqv.server_info.server_name[1].presence = 1; - reqv.server_info.server_name[1].data = - (c_uint8_t*)"\xaa\xbb\xcc\xdd\xee\xff"; - reqv.server_info.server_name[1].len = 6; - - /* Build message */ - tlv_build_msg(&req, &tlv_desc_attach_req, &reqv, TLV_MODE_T1_L2_I1); -#define TEST_TLV_BUILD_MSG \ - "67000e00 6c000a00 15000100 03150001" \ - "02091a00 14001900 06001122 33445566" \ - "19000600 aabbccdd eeff" - - ABTS_INT_EQUAL(tc, 42, req->len); - ABTS_TRUE(tc, memcmp(req->payload, - CORE_HEX(TEST_TLV_BUILD_MSG, strlen(TEST_TLV_BUILD_MSG), testbuf), - req->len) == 0); - - /* Initialize message value structure */ - memset(&reqv2, 0, sizeof(tlv_attach_req)); - - /* Parse message */ - tlv_parse_msg(&reqv2, &tlv_desc_attach_req, req, - TLV_MODE_T1_L2_I1); - - ABTS_INT_EQUAL(tc, 1, reqv2.client_info.presence); - ABTS_INT_EQUAL(tc, 1, - reqv2.client_info.client_security_history.presence); - ABTS_INT_EQUAL(tc, 1, - reqv2.client_info.client_security_history. - authorization_policy_support0.presence); - ABTS_INT_EQUAL(tc, 0x3, reqv2.client_info. - client_security_history.authorization_policy_support0.u8); - ABTS_INT_EQUAL(tc, 1, - reqv2.client_info.client_security_history. - authorization_policy_support2.presence); - ABTS_INT_EQUAL(tc, 0x9, reqv2.client_info. - client_security_history.authorization_policy_support2.u8); - - ABTS_INT_EQUAL(tc, 1, reqv2.server_info.presence); - ABTS_INT_EQUAL(tc, 1, reqv2.server_info.server_name[0].presence); - ABTS_INT_EQUAL(tc, 1, reqv2.server_info.server_name[1].presence); - ABTS_INT_EQUAL(tc, 6, reqv2.server_info.server_name[0].len); - ABTS_TRUE(tc, memcmp(reqv2.server_info.server_name[0].data, - (c_uint8_t*)"\x11\x22\x33\x44\x55\x66", 6) == 0); - ABTS_INT_EQUAL(tc, 6, reqv2.server_info.server_name[1].len); - ABTS_TRUE(tc, memcmp(reqv2.server_info.server_name[1].data, - (c_uint8_t*)"\xaa\xbb\xcc\xdd\xee\xff", 6) == 0); - - pkbuf_free(req); -} - -abts_suite *testtlv(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, tlv_test_1, (void*)TLV_MODE_T2_L2); - abts_run_test(suite, tlv_test_2, (void*)TLV_MODE_T2_L2); - abts_run_test(suite, tlv_test_3, (void*)TLV_MODE_T2_L2); - abts_run_test(suite, tlv_test_4, (void*)TLV_MODE_T2_L2); - abts_run_test(suite, tlv_test_5, (void*)TLV_MODE_T2_L2); - abts_run_test(suite, tlv_test_1, (void*)TLV_MODE_T1_L1); - abts_run_test(suite, tlv_test_5, (void*)TLV_MODE_T1_L1); - abts_run_test(suite, tlv_test_1, (void*)TLV_MODE_T1_L2); - abts_run_test(suite, tlv_test_2, (void*)TLV_MODE_T1_L2); - abts_run_test(suite, tlv_test_3, (void*)TLV_MODE_T1_L2); - abts_run_test(suite, tlv_test_4, (void*)TLV_MODE_T1_L2); - abts_run_test(suite, tlv_test_5, (void*)TLV_MODE_T1_L2); - abts_run_test(suite, tlv_test_1, (void*)TLV_MODE_T1_L2_I1); - abts_run_test(suite, tlv_test_2, (void*)TLV_MODE_T1_L2_I1); - abts_run_test(suite, tlv_test_3, (void*)TLV_MODE_T1_L2_I1); - abts_run_test(suite, tlv_test_4, (void*)TLV_MODE_T1_L2_I1); - abts_run_test(suite, tlv_test_5, (void*)TLV_MODE_T1_L2_I1); - - abts_run_test(suite, tlv_test_6, NULL); - - return suite; -} - diff --git a/lib/core/test/testutil.c b/lib/core/test/testutil.c deleted file mode 100644 index c34b0655d..000000000 --- a/lib/core/test/testutil.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core.h" -#include "abts.h" -#include "testutil.h" - -void core_assert_ok(abts_case* tc, const char* context, status_t rv, - int lineno) -{ - if (rv == CORE_ENOTIMPL) - { - abts_not_impl(tc, context, lineno); - } else if (rv != CORE_OK) - { - char buf[STRING_MAX], ebuf[128]; - sprintf(buf, "%s (%d): %s\n", context, rv, - core_strerror(rv, ebuf, sizeof ebuf)); - abts_fail(tc, buf, lineno); - } -} - -void test_initialize(void) -{ - core_initialize(); - atexit(core_terminate); -} - diff --git a/lib/core/test/testutil.h b/lib/core/test/testutil.h deleted file mode 100644 index 0e4f6e1bf..000000000 --- a/lib/core/test/testutil.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core_general.h" -#include "abts.h" - -#ifndef __APR_TEST_UTIL__ -#define __APR_TEST_UTIL__ - -/* XXX: FIXME - these all should become much more utilitarian - * and part of core, itself - */ - -#ifdef WIN32 -#ifdef BINPATH -#define TESTBINPATH APR_STRINGIFY(BINPATH) "/" -#else -#define TESTBINPATH "" -#endif -#else -#define TESTBINPATH "./" -#endif - -#ifdef WIN32 -#define EXTENSION ".exe" -#elif NETWARE -#define EXTENSION ".nlm" -#else -#define EXTENSION -#endif - -#define STRING_MAX 8096 - -/* Some simple functions to make the test apps easier to write and - * a bit more consistent... - */ - -/* Assert that RV is an CORE_OK value; else fail giving strerror - * for RV and CONTEXT message. */ -void core_assert_ok(abts_case* tc, const char *context, - status_t rv, int lineno); -#define CORE_ASSERT_OK(tc, ctxt, rv) \ - core_assert_ok(tc, ctxt, rv, __LINE__) - -void test_initialize(void); - -abts_suite *testds(abts_suite *suite); -abts_suite *testfsm(abts_suite *suite); -abts_suite *testtlv(abts_suite *suite); -abts_suite *testaes(abts_suite *suite); -abts_suite *testsha2(abts_suite *suite); -abts_suite *testsock(abts_suite *suite); -abts_suite *testsctp(abts_suite *suite); -abts_suite *testtime(abts_suite *suite); -abts_suite *testtimer(abts_suite *suite); -abts_suite *testthread(abts_suite *suite); -abts_suite *testlock(abts_suite *suite); -abts_suite *testatomic(abts_suite *suite); -abts_suite *testfile(abts_suite *suite); -abts_suite *testfilecopy(abts_suite *suite); -abts_suite *testdir(abts_suite *suite); -abts_suite *testmsgq(abts_suite *suite); -abts_suite *testsleep(abts_suite *suite); -abts_suite *testpkbuf(abts_suite *suite); -abts_suite *testmisc(abts_suite *suite); -abts_suite *testhash(abts_suite *suite); -abts_suite *test3gpp(abts_suite *suite); - -#endif /* CORE_TEST_INCLUDES */ diff --git a/lib/fd/Makefile.am b/lib/fd/Makefile.am index 362a06826..6bb4211f0 100644 --- a/lib/fd/Makefile.am +++ b/lib/fd/Makefile.am @@ -1,4 +1,19 @@ -## Process this file with automake to produce Makefile.in +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . pkglib_LTLIBRARIES = libfd.la @@ -17,29 +32,25 @@ libfd_la_SOURCES = \ $(NULL) libfd_la_DEPENDENCIES = \ - $(top_srcdir)/lib/core/src/libcore.la \ + @OGSCORE_LIBS@ \ $(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdcore/libfdcore.la \ $(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdproto/libfdproto.la \ + $(top_srcdir)/lib/base/libbase.la \ $(NULL) libfd_la_LIBADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ + @OGSCORE_LIBS@ \ $(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdcore/libfdcore.la \ $(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdproto/libfdproto.la \ - $(NULL) - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ \ + $(top_srcdir)/lib/base/libbase.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \ $(NULL) AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/lib/fd/fd_config.c b/lib/fd/fd_config.c index 45238487a..f2f5ea7df 100644 --- a/lib/fd/fd_config.c +++ b/lib/fd/fd_config.c @@ -1,20 +1,36 @@ -#define TRACE_MODULE _fd_config - -#include "core_debug.h" -#include "core_lib.h" -#include "core_file.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "fd_lib.h" -static status_t fd_config_apply(fd_config_t *fd_config) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_fd_domain + +static int fd_config_apply(fd_config_t *fd_config) { struct addrinfo hints, *ai; int ret; int i; - d_assert(fd_config->cnf_diamid, return CORE_ERROR,); - d_assert(fd_config->cnf_diamrlm, return CORE_ERROR,); - d_assert(fd_config->cnf_addr, return CORE_ERROR,); + ogs_assert(fd_config->cnf_diamid); + ogs_assert(fd_config->cnf_diamrlm); + ogs_assert(fd_config->cnf_addr); /******************************************************************** * Diameter Server @@ -31,13 +47,13 @@ static status_t fd_config_apply(fd_config_t *fd_config) ret = getaddrinfo(fd_config->cnf_addr, NULL, &hints, &ai); if (ret) { - d_error("getaddrinfo() [%s] failed(%d:%s)", + ogs_error("getaddrinfo() [%s] failed(%d:%s)", fd_config->cnf_addr, errno, strerror(errno)); - return CORE_ERROR; + return OGS_ERROR; } CHECK_FCT_DO( fd_ep_add_merge( &fd_g_config->cnf_endpoints, - ai->ai_addr, ai->ai_addrlen, EP_FL_CONF), return CORE_ERROR ); + ai->ai_addr, ai->ai_addrlen, EP_FL_CONF), return OGS_ERROR ); freeaddrinfo(ai); if (fd_config->cnf_port) @@ -56,7 +72,7 @@ static status_t fd_config_apply(fd_config_t *fd_config) int disc = 0; struct peer_info fddpi; - d_assert(fd_config->conn[i].addr, return CORE_ERROR,); + ogs_assert(fd_config->conn[i].addr); memset(&fddpi, 0, sizeof(fddpi)); fddpi.config.pic_flags.persist = PI_PRST_ALWAYS; @@ -75,16 +91,16 @@ static status_t fd_config_apply(fd_config_t *fd_config) ret = getaddrinfo(fd_config->conn[i].addr, NULL, &hints, &ai); if (ret) { - d_error("getaddrinfo() [%s] failed(%d:%s)", + ogs_error("getaddrinfo() [%s] failed(%d:%s)", fd_config->conn[i].addr, errno, strerror(errno)); - return CORE_ERROR; + return OGS_ERROR; } CHECK_FCT_DO( fd_ep_add_merge( &fddpi.pi_endpoints, ai->ai_addr, ai->ai_addrlen, - EP_FL_CONF | (disc ?: EP_ACCEPTALL) ), return CORE_ERROR); + EP_FL_CONF | (disc ?: EP_ACCEPTALL) ), return OGS_ERROR); CHECK_FCT_DO( fd_peer_add ( &fddpi, NULL, NULL, NULL ), - return CORE_ERROR); + return OGS_ERROR); freeaddrinfo(ai); } @@ -99,13 +115,13 @@ static status_t fd_config_apply(fd_config_t *fd_config) FILE *fd; fname = strdup(fd_config->ext[i].module); - d_assert(fname, return CORE_ERROR,); + ogs_assert(fname); fd = fopen(fname, "r"); if ((fd == NULL) && (*fname != '/')) { char *bkp = fname; fname = malloc(strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2); - d_assert(fname, return CORE_ERROR,); + ogs_assert(fname); sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp); fd = fopen(fname, "r"); if (fd == NULL) @@ -126,13 +142,13 @@ static status_t fd_config_apply(fd_config_t *fd_config) if (cfname) { cfname = strdup(fd_config->ext[i].conf); - d_assert(cfname, return CORE_ERROR,); + ogs_assert(cfname); fd = fopen(cfname, "r"); if ((fd == NULL) && (*cfname != '/')) { char *test = NULL; test = malloc( strlen(cfname) + strlen(DEFAULT_CONF_PATH) + 2); - d_assert(test, return CORE_ERROR,); + ogs_assert(test); sprintf(test, DEFAULT_CONF_PATH "/%s", cfname); fd = fopen(test, "r"); if (fd) @@ -151,13 +167,13 @@ static status_t fd_config_apply(fd_config_t *fd_config) } extern int fd_ext_add( char * filename, char * conffile ); - CHECK_FCT_DO( fd_ext_add( fname, cfname ), return CORE_ERROR ); + CHECK_FCT_DO( fd_ext_add( fname, cfname ), return OGS_ERROR ); } - return CORE_OK; + return OGS_OK; } -status_t fd_config_init(fd_config_t *fd_config) +int fd_config_init(fd_config_t *fd_config) { char * buf = NULL, *b; size_t len = 0; @@ -182,6 +198,6 @@ status_t fd_config_init(fd_config_t *fd_config) int fd_msg_init(void); CHECK_FCT( fd_msg_init() ); - return CORE_OK; + return OGS_OK; } diff --git a/lib/fd/fd_init.c b/lib/fd/fd_init.c index e13c881d8..60da3fcd1 100644 --- a/lib/fd/fd_init.c +++ b/lib/fd/fd_init.c @@ -1,13 +1,27 @@ -#define TRACE_MODULE _fd_init - -#include "core_debug.h" -#include "core_param.h" -#include "core_signal.h" -#include "core_semaphore.h" - +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "fd_logger.h" #include "fd_lib.h" +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_fd_domain + static void fd_gnutls_log_func(int level, const char *str); static void fd_log_func(int printlevel, const char *format, va_list ap); @@ -15,32 +29,21 @@ int fd_init(int mode, const char *conffile, fd_config_t *fd_config) { int ret; - fd_g_debug_lvl = FD_LOG_ERROR; - if (g_trace_mask) - { - if (TRACE_MODULE >= 25) - gnutls_global_set_log_level(TRACE_MODULE-24); - - if (TRACE_MODULE >= 25 && TRACE_MODULE < 27) - fd_g_debug_lvl = FD_LOG_NOTICE; - else if (TRACE_MODULE >= 27 && TRACE_MODULE < 29) - fd_g_debug_lvl = FD_LOG_DEBUG; - else if (TRACE_MODULE >= 29) - fd_g_debug_lvl = FD_LOG_ANNOYING; - } - + gnutls_global_set_log_level(0); gnutls_global_set_log_function(fd_gnutls_log_func); + + fd_g_debug_lvl = FD_LOG_ERROR; ret = fd_log_handler_register(fd_log_func); if (ret != 0) { - d_error("fd_log_handler_register() failed"); + ogs_error("fd_log_handler_register() failed"); return ret; } ret = fd_core_initialize(); if (ret != 0) { - d_error("fd_core_initialize() failed"); + ogs_error("fd_core_initialize() failed"); return ret; } @@ -79,45 +82,45 @@ void fd_final() { fd_logger_final(); - CHECK_FCT_DO( fd_core_shutdown(), d_error("fd_core_shutdown() failed") ); + CHECK_FCT_DO( fd_core_shutdown(), ogs_error("fd_core_shutdown() failed") ); CHECK_FCT_DO( fd_core_wait_shutdown_complete(), - d_error("fd_core_wait_shutdown_complete() failed")); + ogs_error("fd_core_wait_shutdown_complete() failed")); } static void fd_gnutls_log_func(int level, const char *str) { - d_trace(25-level, "gnutls[%d]: %s", level, str); + ogs_trace("gnutls[%d]: %s", level, str); } static void fd_log_func(int printlevel, const char *format, va_list ap) { - char buffer[HUGE_STRING_LEN]; + char buffer[OGS_HUGE_LEN]; int ret = 0; - ret = vsnprintf(buffer, HUGE_STRING_LEN, format, ap); - if (ret < 0 || ret > HUGE_STRING_LEN) + ret = vsnprintf(buffer, OGS_HUGE_LEN, format, ap); + if (ret < 0 || ret > OGS_HUGE_LEN) { - d_error("vsnprintf() failed"); + ogs_error("vsnprintf() failed"); return; } switch(printlevel) { case FD_LOG_ANNOYING: - d_trace(29, "freeDiameter[%d]: %s\n", printlevel, buffer); + ogs_trace("freeDiameter[%d]: %s", printlevel, buffer); break; case FD_LOG_DEBUG: - d_trace(27, "freeDiameter[%d]: %s\n", printlevel, buffer); + ogs_trace("freeDiameter[%d]: %s", printlevel, buffer); break; case FD_LOG_NOTICE: - d_trace(25, "freeDiameter[%d]: %s\n", printlevel, buffer); + ogs_trace("freeDiameter[%d]: %s", printlevel, buffer); break; case FD_LOG_ERROR: - d_error("%s", buffer); + ogs_error("%s", buffer); if (!strcmp(buffer, " - The certificate is expired.")) { - d_error("You can renew CERT as follows:"); - d_error("./support/freeDiameter/make_certs.sh " + ogs_error("You can renew CERT as follows:"); + ogs_error("./support/freeDiameter/make_certs.sh " "./install/etc/nextepc/freeDiameter"); } break; @@ -125,13 +128,13 @@ static void fd_log_func(int printlevel, const char *format, va_list ap) { char *except = "Initiating freeDiameter shutdown sequence"; if (strncmp(buffer, except, strlen(except)) == 0) - d_trace(1, "freeDiameter[%d]: %s\n", printlevel, buffer); + ogs_info("freeDiameter[%d]: %s", printlevel, buffer); else - d_fatal("%s", buffer); + ogs_fatal("%s", buffer); } break; default: - d_warn("%s", buffer); + ogs_warn("%s", buffer); break; } } diff --git a/lib/fd/fd_lib.h b/lib/fd/fd_lib.h index 7b14e7b0d..8d49dc93c 100644 --- a/lib/fd/fd_lib.h +++ b/lib/fd/fd_lib.h @@ -1,11 +1,32 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __FD_LIB_H__ #define __FD_LIB_H__ -#include "core_errno.h" +#include "ogs-core.h" #include "freeDiameter/freeDiameter-host.h" #include "freeDiameter/libfdcore.h" +#include "base/context.h" + #include "fd_message.h" #include "fd_logger.h" @@ -24,9 +45,9 @@ typedef struct _fd_config_t { const char *cnf_addr; /* the local port for legacy Diameter (default: 3868) in host byte order */ - c_uint16_t cnf_port; + uint16_t cnf_port; /* the local port for Diameter/TLS (default: 5658) in host byte order */ - c_uint16_t cnf_port_tls; + uint16_t cnf_port_tls; struct { unsigned no_sctp: 1; /* disable the use of SCTP */ @@ -45,16 +66,15 @@ typedef struct _fd_config_t { struct { const char *identity; const char *addr; /* IP address of the remote peer */ - c_uint16_t port; /* port to connect to. 0: default. */ + uint16_t port; /* port to connect to. 0: default. */ } conn[MAX_NUM_OF_FD_CONN]; int num_of_conn; } fd_config_t; -CORE_DECLARE(int) fd_init( - int mode, const char *conffile, fd_config_t *fd_config); -CORE_DECLARE(void) fd_final(void); +int fd_init(int mode, const char *conffile, fd_config_t *fd_config); +void fd_final(void); -CORE_DECLARE(int) fd_config_init(fd_config_t *fd_config); +int fd_config_init(fd_config_t *fd_config); int fd_avp_search_avp ( struct avp * groupedavp, struct dict_object * what, struct avp ** avp ); diff --git a/lib/fd/fd_logger.c b/lib/fd/fd_logger.c index e310059fb..9f808b70a 100644 --- a/lib/fd/fd_logger.c +++ b/lib/fd/fd_logger.c @@ -1,9 +1,29 @@ -#define TRACE_MODULE _fd_logger - -#include "core_debug.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ogs-core.h" +#include "base/context.h" #include "fd_logger.h" +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_fd_domain + static struct fd_logger_t self; static struct fd_hook_hdl *logger_hdl = NULL; @@ -90,11 +110,11 @@ static void fd_logger_cb(enum fd_hook_type type, struct msg * msg, protobuf[0] = '-'; protobuf[1] = '\0'; } - d_info("CONNECTED TO '%s' (%s):", peer_name, protobuf); + ogs_info("CONNECTED TO '%s' (%s):", peer_name, protobuf); } break; default: - d_warn("Unknown type(%d)", type); + ogs_warn("Unknown type(%d)", type); break; } @@ -124,37 +144,37 @@ static void * fd_stats_worker(void * arg) CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &now), ); /* Now, display everything */ - d_trace(15, "------- fd statistics ---------\n"); + ogs_trace("------- fd statistics ---------"); if (now.tv_nsec >= start.tv_nsec) { - d_trace(15, " Executing for: %d.%06ld sec\n", + ogs_trace(" Executing for: %d.%06ld sec", (int)(now.tv_sec - start.tv_sec), (long)(now.tv_nsec - start.tv_nsec) / 1000); } else { - d_trace(15, " Executing for: %d.%06ld sec\n", + ogs_trace(" Executing for: %d.%06ld sec", (int)(now.tv_sec - 1 - start.tv_sec), (long)(now.tv_nsec + 1000000000 - start.tv_nsec) / 1000); } if (self.mode & FD_MODE_SERVER) { - d_trace(15, " Server: %llu message(s) echoed\n", + ogs_trace(" Server: %llu message(s) echoed", copy.nb_echoed); } if (self.mode & FD_MODE_CLIENT) { - d_trace(15, " Client:\n"); - d_trace(15, " %llu message(s) sent\n", copy.nb_sent); - d_trace(15, " %llu error(s) received\n", copy.nb_errs); - d_trace(15, " %llu answer(s) received\n", copy.nb_recv); - d_trace(15, " fastest: %ld.%06ld sec.\n", + ogs_trace(" Client:"); + ogs_trace(" %llu message(s) sent", copy.nb_sent); + ogs_trace(" %llu error(s) received", copy.nb_errs); + ogs_trace(" %llu answer(s) received", copy.nb_recv); + ogs_trace(" fastest: %ld.%06ld sec.", copy.shortest / 1000000, copy.shortest % 1000000); - d_trace(15, " slowest: %ld.%06ld sec.\n", + ogs_trace(" slowest: %ld.%06ld sec.", copy.longest / 1000000, copy.longest % 1000000); - d_trace(15, " Average: %ld.%06ld sec.\n", + ogs_trace(" Average: %ld.%06ld sec.", copy.avg / 1000000, copy.avg % 1000000); } - d_trace(15, "-------------------------------------\n"); + ogs_trace("-------------------------------------"); } return NULL; /* never called */ diff --git a/lib/fd/fd_logger.h b/lib/fd/fd_logger.h index 9c74e8411..7268e8dbd 100644 --- a/lib/fd/fd_logger.h +++ b/lib/fd/fd_logger.h @@ -1,7 +1,26 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __FD_LOGGER_H__ #define __FD_LOGGER_H__ -#include "core_errno.h" +#include "ogs-core.h" #include "freeDiameter/freeDiameter-host.h" #include "freeDiameter/libfdcore.h" @@ -30,19 +49,19 @@ struct fd_logger_t { pthread_mutex_t stats_lock; }; -CORE_DECLARE(int) fd_logger_init(int mode); -CORE_DECLARE(void) fd_logger_final(); +int fd_logger_init(int mode); +void fd_logger_final(); -CORE_DECLARE(struct fd_logger_t*) fd_logger_self(); +struct fd_logger_t* fd_logger_self(); -CORE_DECLARE(int) fd_logger_stats_start(); +int fd_logger_stats_start(); typedef void (*fd_logger_user_handler)( enum fd_hook_type type, struct msg *msg, struct peer_hdr *peer, void *other, struct fd_hook_permsgdata *pmd, void *regdata); -CORE_DECLARE(void) fd_logger_register(fd_logger_user_handler instance); -CORE_DECLARE(void) fd_logger_unregister(); +void fd_logger_register(fd_logger_user_handler instance); +void fd_logger_unregister(); #ifdef __cplusplus } diff --git a/lib/fd/fd_message.c b/lib/fd/fd_message.c index 78b3bd6a7..e0b8d3c40 100644 --- a/lib/fd/fd_message.c +++ b/lib/fd/fd_message.c @@ -1,4 +1,21 @@ -#define TRACE_MODULE _fd_message +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "fd_message.h" @@ -55,7 +72,7 @@ int fd_message_init() } int fd_message_session_id_set( - struct msg *msg, c_uint8_t *sid, size_t sidlen) + struct msg *msg, uint8_t *sid, size_t sidlen) { struct avp *avp; union avp_value val; @@ -76,7 +93,7 @@ int fd_message_session_id_set( } int fd_message_experimental_rescode_set( - struct msg *msg, c_uint32_t result_code) + struct msg *msg, uint32_t result_code) { struct avp *avp; struct avp *avp_vendor; @@ -104,7 +121,7 @@ int fd_message_experimental_rescode_set( return 0; } -int fd_message_vendor_specific_appid_set(struct msg *msg, c_uint32_t app_id) +int fd_message_vendor_specific_appid_set(struct msg *msg, uint32_t app_id) { struct avp *avp; struct avp *avp_vendor; diff --git a/lib/fd/fd_message.h b/lib/fd/fd_message.h index 98d3bf1b2..6bcfbb3ae 100644 --- a/lib/fd/fd_message.h +++ b/lib/fd/fd_message.h @@ -1,8 +1,25 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __FD_MESSAGE_H__ #define __FD_MESSAGE_H__ -#include "core_errno.h" - #include "freeDiameter/freeDiameter-host.h" #include "freeDiameter/libfdcore.h" @@ -48,13 +65,11 @@ extern struct dict_object *fd_mip_home_agent_address; extern struct dict_object *fd_vendor; extern struct dict_object *fd_vendor_id; -CORE_DECLARE(int) fd_message_init(void); -CORE_DECLARE(int) fd_message_session_id_set( - struct msg *msg, c_uint8_t *sid, size_t sidlen); -CORE_DECLARE(int) fd_message_experimental_rescode_set( - struct msg *msg, c_uint32_t result_code); -CORE_DECLARE(int) fd_message_vendor_specific_appid_set( - struct msg *msg, c_uint32_t app_id); +int fd_message_init(void); +int fd_message_session_id_set(struct msg *msg, uint8_t *sid, size_t sidlen); +int fd_message_experimental_rescode_set( + struct msg *msg, uint32_t result_code); +int fd_message_vendor_specific_appid_set(struct msg *msg, uint32_t app_id); #ifdef __cplusplus } diff --git a/lib/fd/gx/dict_init.c b/lib/fd/gx/dict_init.c index f5941734b..f30f26ff9 100644 --- a/lib/fd/gx/dict_init.c +++ b/lib/fd/gx/dict_init.c @@ -1,4 +1,22 @@ -#define TRACE_MODULE _gx_dict + +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "gx_dict.h" diff --git a/lib/fd/gx/gx_dict.h b/lib/fd/gx/gx_dict.h index 9c3390364..faa42fce9 100644 --- a/lib/fd/gx/gx_dict.h +++ b/lib/fd/gx/gx_dict.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GX_DICT_H__ #define __GX_DICT_H__ diff --git a/lib/fd/gx/gx_message.c b/lib/fd/gx/gx_message.c index 1ce9a5921..5284512fa 100644 --- a/lib/fd/gx/gx_message.c +++ b/lib/fd/gx/gx_message.c @@ -1,7 +1,21 @@ -#define TRACE_MODULE _gx_message - -#include "core_debug.h" -#include "core_pkbuf.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "gx_message.h" @@ -9,7 +23,7 @@ void gx_message_free(gx_message_t *gx_message) { int i; - d_assert(gx_message, return,); + ogs_assert(gx_message); for (i = 0; i < gx_message->num_of_pcc_rule; i++) { diff --git a/lib/fd/gx/gx_message.h b/lib/fd/gx/gx_message.h index dba417f23..059749eb8 100644 --- a/lib/fd/gx/gx_message.h +++ b/lib/fd/gx/gx_message.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GX_MESSAGE_H__ #define __GX_MESSAGE_H__ @@ -5,12 +24,12 @@ extern "C" { #endif /* __cplusplus */ -#include "3gpp_types.h" +#include "base/types.h" typedef struct _gx_message_t { #define GX_CMD_CODE_CREDIT_CONTROL 272 #define GX_CMD_RE_AUTH 258 - c_uint16_t cmd_code; + uint16_t cmd_code; /* Experimental-Result-Codes */ #define GX_DIAMETER_ERROR_LATE_OVERLAPPING_REQUEST 5453 @@ -23,20 +42,20 @@ typedef struct _gx_message_t { #define GX_DIAMETER_ERROR_CONFLICTING_REQUEST 5147 #define GX_DIAMETER_ADC_RULE_EVENT 5148 #define GX_DIAMETER_ERROR_NBIFOM_NOT_AUTHORIZED 5149 - c_uint32_t result_code; + uint32_t result_code; #define GX_CC_REQUEST_TYPE_INITIAL_REQUEST 1 #define GX_CC_REQUEST_TYPE_UPDATE_REQUEST 2 #define GX_CC_REQUEST_TYPE_TERMINATION_REQUEST 3 #define GX_CC_REQUEST_TYPE_EVENT_REQUEST 4 - c_uint32_t cc_request_type; + uint32_t cc_request_type; pdn_t pdn; pcc_rule_t pcc_rule[MAX_NUM_OF_PCC_RULE]; int num_of_pcc_rule; } gx_message_t; -CORE_DECLARE(void) gx_message_free(gx_message_t *gx_message); +void gx_message_free(gx_message_t *gx_message); #ifdef __cplusplus } diff --git a/lib/fd/rx/dict_init.c b/lib/fd/rx/dict_init.c index ce59e397a..7770b3a92 100644 --- a/lib/fd/rx/dict_init.c +++ b/lib/fd/rx/dict_init.c @@ -1,4 +1,21 @@ -#define TRACE_MODULE _rx_dict +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "rx_dict.h" diff --git a/lib/fd/rx/rx_dict.h b/lib/fd/rx/rx_dict.h index 520f67379..e785944da 100644 --- a/lib/fd/rx/rx_dict.h +++ b/lib/fd/rx/rx_dict.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __RX_DICT_H__ #define __RX_DICT_H__ diff --git a/lib/fd/rx/rx_message.c b/lib/fd/rx/rx_message.c index 6b649ad73..74e6305ba 100644 --- a/lib/fd/rx/rx_message.c +++ b/lib/fd/rx/rx_message.c @@ -1,7 +1,21 @@ -#define TRACE_MODULE _rx_message - -#include "core_debug.h" -#include "core_pkbuf.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "rx_message.h" @@ -9,7 +23,7 @@ void rx_message_free(rx_message_t *rx_message) { int i, j, k; - d_assert(rx_message, return, "Null param"); + ogs_assert(rx_message); for (i = 0; i < rx_message->num_of_media_component; i++) { @@ -26,10 +40,10 @@ void rx_message_free(rx_message_t *rx_message) if (flow->description) { - CORE_FREE(flow->description); + ogs_free(flow->description); } else - d_assert(0,, "Null param"); + ogs_assert_if_reached(); } } } diff --git a/lib/fd/rx/rx_message.h b/lib/fd/rx/rx_message.h index 7cac912fa..a3a7a52f0 100644 --- a/lib/fd/rx/rx_message.h +++ b/lib/fd/rx/rx_message.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __RX_MESSAGE_H__ #define __RX_MESSAGE_H__ @@ -5,20 +24,20 @@ extern "C" { #endif /* __cplusplus */ -#include "3gpp_types.h" +#include "base/types.h" typedef struct _rx_media_sub_component_t { - c_uint32_t flow_number; + uint32_t flow_number; #define RX_FLOW_USAGE_NO_INFORMATION 0 #define RX_FLOW_USAGE_RTCP 1 #define RX_FLOW_USAGE_AF_SIGNALLING 2 - c_uint32_t flow_usage; + uint32_t flow_usage; flow_t flow[MAX_NUM_OF_FLOW]; int num_of_flow; } rx_media_sub_component_t; typedef struct _rx_media_component_t { - c_uint32_t media_component_number; + uint32_t media_component_number; #define RX_MEDIA_TYPE_AUDIO 0 #define RX_MEDIA_TYPE_VIDEO 1 #define RX_MEDIA_TYPE_DATA 2 @@ -27,14 +46,14 @@ typedef struct _rx_media_component_t { #define RX_MEDIA_TYPE_TEXT 5 #define RX_MEDIA_TYPE_MESSAGE 6 #define RX_MEDIA_TYPE_OTHER 0xFFFFFFFF - c_uint32_t media_type; + uint32_t media_type; - c_uint64_t max_requested_bandwidth_dl; - c_uint64_t max_requested_bandwidth_ul; - c_uint64_t min_requested_bandwidth_dl; - c_uint64_t min_requested_bandwidth_ul; - c_uint64_t rr_bandwidth; - c_uint64_t rs_bandwidth; + uint64_t max_requested_bandwidth_dl; + uint64_t max_requested_bandwidth_ul; + uint64_t min_requested_bandwidth_dl; + uint64_t min_requested_bandwidth_ul; + uint64_t rr_bandwidth; + uint64_t rs_bandwidth; #define MAX_NUM_OF_MEDIA_SUB_COMPONENT 8 rx_media_sub_component_t sub[MAX_NUM_OF_MEDIA_SUB_COMPONENT]; @@ -44,7 +63,7 @@ typedef struct _rx_media_component_t { typedef struct _rx_message_t { #define RX_CMD_CODE_AA 265 #define RX_CMD_CODE_SESSION_TERMINATION 275 - c_uint16_t cmd_code; + uint16_t cmd_code; /* Experimental-Result-Codes */ #define RX_DIAMETER_INVALID_SERVICE_INFORMATION 5061 @@ -55,14 +74,14 @@ typedef struct _rx_message_t { #define RX_DIAMETER_UNAUTHORIZED_NON_EMERGENCY_SESSION 5066 #define RX_DIAMETER_UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY 5067 #define RX_DIAMETER_TEMPORARY_NETWORK_FAILURE 5068 - c_uint32_t result_code; + uint32_t result_code; #define MAX_NUM_OF_MEDIA_COMPONENT 16 rx_media_component_t media_component[MAX_NUM_OF_MEDIA_COMPONENT]; int num_of_media_component; } rx_message_t; -CORE_DECLARE(void) rx_message_free(rx_message_t *rx_message); +void rx_message_free(rx_message_t *rx_message); #ifdef __cplusplus } diff --git a/lib/fd/s6a/dict_init.c b/lib/fd/s6a/dict_init.c index 12e3ba4c5..95804433b 100644 --- a/lib/fd/s6a/dict_init.c +++ b/lib/fd/s6a/dict_init.c @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "s6a_dict.h" #define CHECK_dict_search( _type, _criteria, _what, _result ) \ diff --git a/lib/fd/s6a/s6a_dict.h b/lib/fd/s6a/s6a_dict.h index 782973aab..68c2675cf 100644 --- a/lib/fd/s6a/s6a_dict.h +++ b/lib/fd/s6a/s6a_dict.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __S6A_LIB_H__ #define __S6A_LIB_H__ diff --git a/lib/fd/s6a/s6a_message.h b/lib/fd/s6a/s6a_message.h index 4ab1aeb7e..8e791a2e8 100644 --- a/lib/fd/s6a/s6a_message.h +++ b/lib/fd/s6a/s6a_message.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __S6A_MESSAGE_H__ #define __S6A_MESSAGE_H__ @@ -5,16 +24,16 @@ extern "C" { #endif /* __cplusplus */ -#include "core_sha2.h" +#include "ogs-crypt.h" -#include "3gpp_types.h" +#include "base/types.h" typedef struct _e_utran_vector_t { - c_uint8_t xres[MAX_RES_LEN]; - c_uint8_t xres_len; - c_uint8_t kasme[SHA256_DIGEST_SIZE]; - c_uint8_t rand[RAND_LEN]; - c_uint8_t autn[AUTN_LEN]; + uint8_t xres[MAX_RES_LEN]; + uint8_t xres_len; + uint8_t kasme[OGS_SHA256_DIGEST_SIZE]; + uint8_t rand[RAND_LEN]; + uint8_t autn[AUTN_LEN]; } e_utran_vector_t; typedef struct _s6a_aia_message_t { @@ -29,19 +48,19 @@ typedef struct _s6a_subscription_data_t { #define HSS_ACCESS_RESTRICTION_WB_E_UTRAN_NOT_ALLOWED (1<<4) #define HSS_ACCESS_RESTRICTION_HO_TO_NON_3GPP_ACCESS_NOT_ALLOWED (1<<5) #define HSS_ACCESS_RESTRICTION_NB_IOT_NOT_ALLOWED (1<<6) - c_uint32_t access_restriction_data; + uint32_t access_restriction_data; #define HSS_SUBSCRIBER_STATUS_SERVICE_GRANTED 0 #define HSS_SUBSCRIBER_STATUS_OPERATOR_DETERMINED_BARRING 1 - c_uint32_t subscriber_status; + uint32_t subscriber_status; #define HSS_NETWORK_ACCESS_MODE_PACKET_AND_CIRCUIT 0 #define HSS_NETWORK_ACCESS_MODE_RESERVED 1 #define HSS_NETWORK_ACCESS_MODE_ONLY_PACKET 2 - c_uint32_t network_access_mode; + uint32_t network_access_mode; bitrate_t ambr; /* UE-AMBR */ - c_uint32_t subscribed_rau_tau_timer; /* unit : minutes */ + uint32_t subscribed_rau_tau_timer; /* unit : minutes */ - c_uint32_t context_identifier; /* default APN */ + uint32_t context_identifier; /* default APN */ pdn_t pdn[MAX_NUM_OF_SESS]; int num_of_pdn; } s6a_subscription_data_t; @@ -49,14 +68,14 @@ typedef struct _s6a_subscription_data_t { typedef struct _s6a_ula_message_t { #define S6A_ULA_FLAGS_SEPARATION_INDICATION (0) #define S6A_ULA_FLAGS_MME_REGISTERED_FOR_SMS (1) - c_uint32_t ula_flags; + uint32_t ula_flags; s6a_subscription_data_t subscription_data; } s6a_ula_message_t; typedef struct _s6a_message_t { #define S6A_CMD_CODE_UPDATE_LOCATION 316 #define S6A_CMD_CODE_AUTHENTICATION_INFORMATION 318 - c_uint16_t cmd_code; + uint16_t cmd_code; /* Experimental Result Code */ #define S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE 4181 @@ -66,7 +85,7 @@ typedef struct _s6a_message_t { #define S6A_DIAMETER_ERROR_RAT_NOT_ALLOWED 5421 #define S6A_DIAMETER_ERROR_EQUIPMENT_UNKNOWN 5422 #define S6A_DIAMETER_ERROR_UNKOWN_SERVING_NODE 5423 - c_uint32_t result_code; + uint32_t result_code; s6a_aia_message_t aia_message; s6a_ula_message_t ula_message; diff --git a/lib/freeDiameter-1.2.1/Makefile.am b/lib/freeDiameter-1.2.1/Makefile.am index 7021f408c..d3ba1d6fc 100644 --- a/lib/freeDiameter-1.2.1/Makefile.am +++ b/lib/freeDiameter-1.2.1/Makefile.am @@ -1,17 +1,10 @@ ## Process this file with automake to produce Makefile.in ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST= \ + include/freeDiameter/libfdcore.h \ + include/freeDiameter/libfdproto.h \ + include/freeDiameter/extension.h \ + $(NULL) SUBDIRS = libfdproto libfdcore extensions - -MAINTAINERCLEANFILES = \ - configure include/freeDiameter/config.h.in \ - aclocal.m4 m4/ltsugar.m4 m4/libtool.m4 m4/ltversion.m4 \ - m4/lt~obsolete.m4 m4/ltoptions.m4 \ - build-aux/ar-lib build-aux/config.guess build-aux/depcomp \ - build-aux/ltmain.sh build-aux/test-driver build-aux/compile \ - build-aux/config.sub build-aux/missing build-aux/install-sh \ - build-aux/ylwrap \ - Makefile.in \ - include/freeDiameter/version.h libfdcore/fdd.tab.y libfdcore/lex.fdd.l -MOSTLYCLEANFILES = core *.stackdump diff --git a/lib/freeDiameter-1.2.1/configure.ac b/lib/freeDiameter-1.2.1/configure.ac index 56494ace8..cd24958e8 100644 --- a/lib/freeDiameter-1.2.1/configure.ac +++ b/lib/freeDiameter-1.2.1/configure.ac @@ -10,9 +10,6 @@ dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. AC_INIT([nextepc], [1.2.1], [acetcom@gmail.com]) -AC_SUBST(LIBVERSION) -LIBVERSION=1:0:0 - dnl Must come before AM_INIT_AUTOMAKE. AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign]) diff --git a/lib/freeDiameter-1.2.1/contrib/OpenWRT/packages/freeDiameter/Makefile b/lib/freeDiameter-1.2.1/contrib/OpenWRT/packages/freeDiameter/Makefile deleted file mode 100644 index d06502c01..000000000 --- a/lib/freeDiameter-1.2.1/contrib/OpenWRT/packages/freeDiameter/Makefile +++ /dev/null @@ -1,241 +0,0 @@ -# -# Software License Agreement (BSD License) -# -# Copyright (c) 2013, WIDE Project and NICT -# All rights reserved. -# -# See LICENSE file from freeDiameter source package for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=freeDiameter -PKG_REV:=696 -PKG_VERSION:=r$(PKG_REV) -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=hg -PKG_SOURCE_VERSION:=$(PKG_REV) -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://www.freediameter.net/hg/freeDiameter -# PKG_MD5SUM:= - -PKG_FIXUP:=libtool -PKG_INSTALL:=1 - -include $(INCLUDE_DIR)/package.mk - -define Package/freeDiameter - SECTION:=freeDiameter - CATEGORY:=Network - TITLE:=freeDiameter - URL:=http://www.freediameter.net - DEPENDS:=+sctp +libgnutls +libpthread +kmod-ipv6 -endef - -define Package/freeDiameter-test - SECTION:=freeDiameter - CATEGORY:=Network - TITLE:=freeDiameter-test - URL:=http://www.freediameter.net - DEPENDS:=+freeDiameter -endef - -define Package/freeDiameter/description - freeDiameter + RADIUS/Diameter gateway extension package. -endef - -define Package/freeDiameter-test/description - The app_test.fdx extension for freeDiameter, useful only to perform some -tests between freeDiameter peers (ping-like for Diameter). -endef - -define Package/freeDiameter/conffiles -/etc/freeDiameter/freeDiameter.conf -/etc/freeDiameter/rgw.conf -endef - -define Build/Configure - IN_OPENWRT=1 \ - AR="$(TARGET_CROSS)ar" \ - AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \ - LD="$(TARGET_CROSS)ld" \ - NM="$(TARGET_CROSS)nm" \ - CC="$(TARGET_CC)" \ - GCC="$(TARGET_CC)" \ - CXX="$(TARGET_CROSS)g++" \ - RANLIB="$(TARGET_CROSS)ranlib" \ - STRIP="$(TARGET_CROSS)strip" \ - OBJCOPY="$(TARGET_CROSS)objcopy" \ - OBJDUMP="$(TARGET_CROSS)objdump" \ - TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \ - TARGET_CFLAGS="$(TARGET_CFLAGS)" \ - TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \ - cmake \ - -DCMAKE_PREFIX_PATH:PATH=$(STAGING_DIR)/usr \ - -DCMAKE_INSTALL_PREFIX:PATH=/usr \ - -DDIAMID_IDNA_REJECT:BOOL=ON \ - -DBUILD_TESTING:BOOL=OFF \ - -DCMAKE_BUILD_TYPE:STRING=DebianPackage \ - -DDEFAULT_CONF_PATH:PATH=/etc/freeDiameter \ - -DBUILD_APP_RADGW:BOOL=ON \ - -DBUILD_DBG_MONITOR:BOOL=ON \ - -DBUILD_TEST_APP:BOOL=ON \ - VERBOSE=1 \ - $(PKG_BUILD_DIR)/CMakeLists.txt -endef - -TARGET_LDFLAGS := -L$(STAGING_DIR)/usr/lib $(TARGET_LDFLAGS) -define Package/freeDiameter/install - # binaries - $(INSTALL_DIR) $(1)/usr/bin - $(CP) \ - $(PKG_INSTALL_DIR)/usr/bin/freeDiameterd* \ - $(1)/usr/bin/ - # libraries & extensions - $(INSTALL_DIR) $(1)/usr/lib/ - $(CP) \ - $(PKG_INSTALL_DIR)/usr/lib/* \ - $(1)/usr/lib/ - # Remove the test_app from the main package (see freeDiameter-test) - $(RM) $(1)/usr/lib/freeDiameter/test_app* - - # configuration files - $(INSTALL_DIR) $(1)/etc/freeDiameter - $(INSTALL_CONF) \ - $(PKG_BUILD_DIR)/doc/freediameter.conf.sample \ - $(1)/etc/freeDiameter/freeDiameter.conf - $(SED) 's,TLS_Cred,#TLS_Cred,g' $(1)/etc/freeDiameter/freeDiameter.conf - echo "" >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "### OPENWRT specific" >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "TLS_Cred = \"/etc/freeDiameter/freeDiameter.pem\", \"/etc/freeDiameter/freeDiameter.key\";" \ - >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "TLS_CA = \"/etc/freeDiameter/freeDiameter.ca.pem\";" \ - >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "TLS_DH_File = \"/etc/freeDiameter/dh.pem\";" \ - >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "SCTP_streams = 3;" >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "LoadExtension = \"dict_nasreq.fdx\";" >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "LoadExtension = \"dict_eap.fdx\";" >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "LoadExtension = \"app_radgw.fdx\":\"rgw.conf\";" \ - >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "# test_app.fdx provided in freeDiameter-test package:" \ - >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "# LoadExtension = \"test_app.fdx\";" >> $(1)/etc/freeDiameter/freeDiameter.conf - echo "## Add overrides below this point" >> $(1)/etc/freeDiameter/freeDiameter.conf - - - $(INSTALL_CONF) \ - $(PKG_BUILD_DIR)/doc/app_radgw.conf.sample \ - $(1)/etc/freeDiameter/rgw.conf - $(SED) 's,RGWX,#RGWX,g' $(1)/etc/freeDiameter/rgw.conf - echo "" >> $(1)/etc/freeDiameter/rgw.conf - echo "### OPENWRT specific" >> $(1)/etc/freeDiameter/rgw.conf - echo " RGWX = \"auth.rgwx\" : auth;" >> $(1)/etc/freeDiameter/rgw.conf - echo " RGWX = \"acct.rgwx\" : acct;" >> $(1)/etc/freeDiameter/rgw.conf - echo "" >> $(1)/etc/freeDiameter/rgw.conf - echo " cli = 127.0.0.1 / \"secret key\" ;" >> $(1)/etc/freeDiameter/rgw.conf - echo " auth_server_ip4 = 127.0.0.1;" >> $(1)/etc/freeDiameter/rgw.conf - echo " auth_server_ip6 = ::1 ;" >> $(1)/etc/freeDiameter/rgw.conf - echo " acct_server_ip4 = 127.0.0.1;" >> $(1)/etc/freeDiameter/rgw.conf - echo " acct_server_ip6 = ::1 ;" >> $(1)/etc/freeDiameter/rgw.conf -endef - -define Package/freeDiameter-test/install - # Only the test_app extension - $(INSTALL_DIR) $(1)/usr/lib/freeDiameter/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeDiameter/test_app* \ - $(1)/usr/lib/freeDiameter/ -endef - -define Package/freeDiameter/postinst -#!/bin/sh - -# Test if the configuration file contains the local identity already -localid=`sed -n -r -e "s/^[[:space:]]*Identity[[:space:]]*=[[:space:]]*\"([^\"]*)\"[[:space:]]*;/\1/p" /etc/freeDiameter/freeDiameter.conf` -if [ -z "$$localid" ]; then - # Ask for the local name - echo -n "Full name of your access point? (openwrt.localdomain) : " - read localid - if [ -z "$$localid" ]; then - localid="openwrt.localdomain" - fi - echo "Identity = \"$$localid\";" >> /etc/freeDiameter/freeDiameter.conf -fi - -# Is there already a ConnectPeer directive? -grep -q -E -e "^[[:space:]]*ConnectPeer[[:space:]]*=" /etc/freeDiameter/freeDiameter.conf -if [ "$$?" -eq "1" ]; then - echo -n "Diameter Identity of your Diameter server: " - read serverid - if [ -z "$$serverid" ]; then - echo "Skipped. Please add ConnectPeer directive to your /etc/freeDiameter/freeDiameter.conf file later." - else - echo -n "IP or IPv6 address of your Diameter server? (leave blank for dynamic resolution) " - read serverip - connstr="" - if [ -n "$$serverip" ]; then - connstr=" { ConnectTo = \"$$serverip\"; }" - fi - echo "ConnectPeer = \"$$serverid\"$$connstr;" >> /etc/freeDiameter/freeDiameter.conf - fi -fi - -# Certificate configuration -if [ ! -f "/usr/bin/certtool" ]; then - echo "certtool is not installed, skipping creation of default certificate and DH parameters." - echo "The following files are expected by freeDiameter:" - echo " /etc/freeDiameter/freeDiameter.key" - echo " /etc/freeDiameter/freeDiameter.pem" - echo " /etc/freeDiameter/freeDiameter.ca.pem" - echo " /etc/freeDiameter/dh.pem" - exit 0 -fi -if [ ! -f "/etc/freeDiameter/freeDiameter.key" ]; then - echo "Creating a new private key for freeDiameter, please wait" - certtool -p --outfile /etc/freeDiameter/freeDiameter.key -fi -if [ ! -f "/etc/freeDiameter/freeDiameter.pem" ]; then - echo "organization = freeDiameter" > /tmp/template.cnf - echo "unit = OpenWRT" >>/tmp/template.cnf - echo "state = internet" >>/tmp/template.cnf - echo "country = net" >>/tmp/template.cnf - echo "cn = $$localid" >>/tmp/template.cnf - echo "expiration_days = 3650" >>/tmp/template.cnf - echo "signing_key" >>/tmp/template.cnf - echo "encryption_key" >>/tmp/template.cnf - if [ ! -f "/etc/freeDiameter/freeDiameter.csr" ]; then - echo "Creating a new CSR (use if you have a separate CA)" - certtool -q --load-privkey /etc/freeDiameter/freeDiameter.key \ - --outfile /etc/freeDiameter/freeDiameter.csr \ - --template /tmp/template.cnf - fi - echo "Creating a new certificate for freeDiameter" - certtool -s --load-privkey /etc/freeDiameter/freeDiameter.key \ - --outfile /etc/freeDiameter/freeDiameter.pem \ - --template /tmp/template.cnf - rm -f /tmp/template.cnf - cat /etc/freeDiameter/freeDiameter.pem >> /etc/freeDiameter/freeDiameter.ca.pem - echo "Done." - echo "========================================================================" - echo "To enable TLS communication, you should either:" - echo " - use a real certificate signed by your server's CA:" - echo " Use the CSR provided in /etc/freeDiameter/freeDiameter.csr" - echo " Save the new certificate as /etc/freeDiameter/freeDiameter.pem" - echo " Replace the contents of /etc/freeDiameter/freeDiameter.ca.pem with your CA's certificate" - echo " - or, declare the certificates as trusted as follow: " - echo " Add your server's CA certificate into /etc/freeDiameter/freeDiameter.ca.pem" - echo " Add the content of /etc/freeDiameter/freeDiameter.pem into your server's trusted CA file" - echo "========================================================================" -fi -if [ ! -f "/etc/freeDiameter/dh.pem" ]; then - echo "Creating new Diffie-Hellman parameters file. This operation takes a while..." - certtool --generate-dh-params --outfile /etc/freeDiameter/dh.pem - echo "Done." -fi -echo "freeDiameter configuration completed and stored in /etc/freeDiameter/." -endef - -$(eval $(call BuildPackage,freeDiameter)) -$(eval $(call BuildPackage,freeDiameter-test)) diff --git a/lib/freeDiameter-1.2.1/contrib/OpenWRT/test_required/Makefile b/lib/freeDiameter-1.2.1/contrib/OpenWRT/test_required/Makefile deleted file mode 100644 index d13cc919d..000000000 --- a/lib/freeDiameter-1.2.1/contrib/OpenWRT/test_required/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -OWRT_ENV_ROOT=/root/openwrt-env/openwrt -STAGING_UCLIBC_ROOT=$(OWRT_ENV_ROOT)/staging_dir/target-mipsel_uClibc-0.9.31 -STAGING_GCC_ROOT=$(OWRT_ENV_ROOT)/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.31 - -CFLAGS=-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float -I$(STAGING_UCLIBC_ROOT)/usr/include -I$(STAGING_UCLIBC_ROOT)/include -I$(STAGING_GCC_ROOT)/usr/include -I$(STAGING_GCC_ROOT)/include -LDFLAGS=-L$(STAGING_UCLIBC_ROOT)/usr/lib -L$(STAGING_UCLIBC_ROOT)/lib -L$(STAGING_GCC_ROOT)/usr/lib -L$(STAGING_GCC_ROOT)/lib - -GCC=mipsel-openwrt-linux-uclibc-gcc -PATH:=$(STAGING_GCC_ROOT)/bin/:$(PATH) - -testcase: testcase.o - $(GCC) $(LDFLAGS) -lpthread testcase.o -o testcase - -testcase.o: testcase.c - $(GCC) $(CFLAGS) -o testcase.o -c testcase.c diff --git a/lib/freeDiameter-1.2.1/contrib/PKI/ca_script/Makefile b/lib/freeDiameter-1.2.1/contrib/PKI/ca_script/Makefile deleted file mode 100644 index 70476d474..000000000 --- a/lib/freeDiameter-1.2.1/contrib/PKI/ca_script/Makefile +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/make -s -# -# This file is designed to automatize the CA tasks such as: -# -> init : create the initial CA tree and the CA root certificate. -# -> newcsr: create a new private key and csr. $name and $email must be set. C, ST, L, O, OU may be overwitten (example: make newcsr C=FR) -# -> cert : sign a pending CSR and generate the certificate. $name must be provided. -# -> revoke: revoke a certificate. $name must be provided. -# -> gencrl: update/create the CRL. -# -# The file should be located in the directory STATIC_DIR as defined below. -# The DIR directory will contain the data of the CA. It might be placed in /var. -# The DIR should also be configured in openssl.cnf file under [ CA_default ]->dir. -# -# Here are the steps to install the CA scripts in default environment: -## mkdir /etc/openssl-ca.static -## cp Makefile openssl.cnf /etc/openssl-ca.static -# ( configure the default parameters of your CA in /etc/openssl-ca/openssl.cnf ) ## -## mkdir /etc/openssl-ca -## make -f /etc/openssl-ca.static/Makefile destroy force=y -## cd /etc/openssl-ca -## make init -## make help - -DIR = /home/thedoc/testbed.aaa/ca -STATIC_DIR = /home/thedoc/testbed.aaa/ca -CONFIG = -config $(DIR)/openssl.cnf - -#Defaults for new CSR -C = JP -ST = Tokyo -L = Koganei -O = WIDE -OU = "AAA WG" - -#Default lifetime -DAYS = 365 - -#Values for the CA -CA_CN = mgr.testbed.aaa -CA_mail = sdecugis@freediameter.net - -#Disable "make destroy" -force = - - -# Default: print the help -all: help - -# Help message -help: - @echo "\n\ -Default values (can be overwritten on command-line):\n\ - [C=$(C)] [ST=$(ST)] [L=$(L)] [O=$(O)] [OU=$(OU)]\n\ - [CA_CN=$(CA_CN)] [CA_mail=$(CA_mail)]\n\n\ -Available commands:\n\ - make init\n\ - Creates the initial CA structure in $(DIR)\n\ - make gencrl\n\ - Regenerates the CRL. Should be run at least once a month.\n\ - make newcsr name=foo email=b@r [type=ca]\n\ - Create private key and csr in clients subdir (named foo.*)\n\ - make cert name=foo\n\ - Signs the CSR foo.csr and creates the certificate foo.cert.\n\ - make revoke name=foo\n\ - Revokes the certificate foo.cert and regenerates the CRL.\n\ -\n\ -Notes:\n\ - Content from public-www should be available from Internet. \n\ - The URL to CRL should be set in openssl.cnf.\n\ - A cron job should execute make gencrl once a month.\n\ -"; - -# Destroy the CA completely. Use with care. -destroy: - @if [ -z "$(force)" ]; then echo "Restart disabled, use: make destroy force=y"; exit 1; fi - @if [ ! -d $(STATIC_DIR) ]; then echo "Error in setup"; exit 1; fi - @echo "Removing everything (for debug purpose)..." - @rm -rf $(DIR)/* - @ln -sf $(STATIC_DIR)/Makefile $(DIR) - @ln -sf $(STATIC_DIR)/openssl.cnf $(DIR) - -# Initialize the CA structure and keys. -init: - @if [ -d $(DIR)/private ]; then echo "CA already initialized."; exit 1; fi - @echo "Creating CA structure..." - @mkdir $(DIR)/crl - @mkdir $(DIR)/certs - @mkdir $(DIR)/newcerts - @mkdir $(DIR)/public-www - @mkdir $(DIR)/private - @chmod 700 $(DIR)/private - @mkdir $(DIR)/clients - @mkdir $(DIR)/clients/privkeys - @mkdir $(DIR)/clients/csr - @mkdir $(DIR)/clients/certs - @echo "01" > $(DIR)/serial - @touch $(DIR)/index.txt - @openssl req $(CONFIG) -new -batch -x509 -days 3650 -nodes -newkey rsa:2048 -out $(DIR)/public-www/cacert.pem \ - -keyout $(DIR)/private/cakey.pem -subj /C=$(C)/ST=$(ST)/L=$(L)/O=$(O)/OU=$(OU)/CN=$(CA_CN)/emailAddress=$(CA_mail) - @ln -s $(DIR)/public-www/cacert.pem $(DIR)/certs/`openssl x509 -noout -hash < $(DIR)/public-www/cacert.pem`.0 - @$(MAKE) -f $(DIR)/Makefile gencrl - -# Regenerate the Certificate Revocation List. -# This list should be available publicly -gencrl: - @openssl ca $(CONFIG) -gencrl -out $(DIR)/public-www/crl.pem - @ln -sf $(DIR)/public-www/crl.pem $(DIR)/crl/`openssl crl -noout -hash < $(DIR)/public-www/crl.pem`.r0 - -# Create a new private key and a CSR, in case the client does not provide the CSR by another mean. -# Usage is: make newcsr name=peer.client.fqdn email=admin@client.fqdn -newcsr: - @if [ -z "$(name)" -o -z "$(email)" ]; then echo "Please provide certificate name and email address: make newcsr name=mn.nautilus.org email=you@mail.com"; exit 1; fi - @if [ -e $(DIR)/clients/csr/$(name).csr ]; then echo "There is already a pending csr for this name."; exit 1; fi - @if [ ! -e $(DIR)/clients/privkeys/$(name).key.pem ]; \ - then echo "Generating a private key for $(name) ..."; \ - openssl genrsa -out $(DIR)/clients/privkeys/$(name).key.pem 1024; \ - fi; - @echo "Creating the CSR in $(DIR)/clients/csr/$(name).csr"; - @openssl req $(CONFIG) -new -batch -out $(DIR)/clients/csr/$(name).csr \ - -key $(DIR)/clients/privkeys/$(name).key.pem \ - -subj /C=$(C)/ST=$(ST)/L=$(L)/O=$(O)/OU=$(OU)/CN=$(name)/emailAddress=$(email) - -# Process a CSR to create a x509 certificate. The certificate is valid for 1 year. -# It should be sent to the client by any mean. -cert: - @if [ -z "$(name)" ]; then echo "name must be provided: make cert name=mn.n6.org"; exit 1; fi - @if [ ! -e $(DIR)/clients/csr/$(name).csr ]; then echo "Could not find CSR in $(DIR)/clients/csr/$(name).csr."; exit 1; fi - @if [ -e $(DIR)/clients/certs/$(name).cert ]; \ - then echo "Revoking old certificate..."; \ - $(MAKE) revoke name=$(name); \ - fi; - @openssl ca $(CONFIG) -in $(DIR)/clients/csr/$(name).csr \ - -out $(DIR)/clients/certs/$(name).cert \ - -days $(DAYS) \ - -batch - @ln -s $(DIR)/clients/certs/$(name).cert $(DIR)/certs/`openssl x509 -noout -hash < $(DIR)/clients/certs/$(name).cert`.0 - -# Revoke a certificate. -revoke: - @if [ -z "$(name)" ]; then echo "name must be provided: make revoke name=mn.n6.org"; exit 1; fi - @if [ ! -e $(DIR)/clients/certs/$(name).cert ]; \ - then echo "$(DIR)/clients/certs/$(name).cert not found"; \ - exit 1; \ - fi; - @openssl ca $(CONFIG) -revoke $(DIR)/clients/certs/$(name).cert; - @rm -f $(DIR)/certs/`openssl x509 -noout -hash < $(DIR)/clients/certs/$(name).cert`.0 - @$(MAKE) gencrl - -# End of file... diff --git a/lib/freeDiameter-1.2.1/contrib/PKI/ca_script2/Makefile b/lib/freeDiameter-1.2.1/contrib/PKI/ca_script2/Makefile deleted file mode 100644 index 845176eca..000000000 --- a/lib/freeDiameter-1.2.1/contrib/PKI/ca_script2/Makefile +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/make -s -# -# This file is inspired from freeDiameter's contrib/ca_script and -# improved to handle multiple CA in a hierarchical fashion. -# Warning: the directory structure is flat, does not reflect the CA hierarchy - -SCRIPT_DIR = . -DATA_DIR = ./ca_data - -CONFIG = -config $(SCRIPT_DIR)/openssl.cnf -REMAKE = $(MAKE) -f $(SCRIPT_DIR)/Makefile - -#Disable "make destroy" -- overwrite on command line -force = - -#RSA key sizes, can be overwritten on command line -cakeysize = 2048 -keysize = 1024 - -# Save current date -DATE=`date +%Y%m%d-%H%M%S` - -# Default: print the help -all: help - -# Help message -help: - @echo "\n\ -Available commands:\n\ - make init topca=name\n\ - Creates the initial top-level CA structure\n\ - make newca name=newcaname ca=parentca\n\ - Creates a new sub-CA that can be used for certificates later.\n\ - make newcert name=foo ca=parentca\n\ - Create private key and csr, then issue the certificate (named foo.*)\n\ - make p12 name=foo ca=parentca\n\ - Same as newcert, but additionnaly creates a pkcs12 file to ship client certificate to Windows or Mac\n\ - make ship name=foo ca=parentca\n\ - Create an archive with the data for the client (useful for freeDiameter peers)\n\ - make revoke name=foo ca=parentca\n\ - Revokes the certificate foo.cert issued by parentca and regenerates the CRL.\n\ - make gencrl ca=caname\n\ - Regenerates the CRL of CA caname. Should be run periodically.\n\ -\n\ -"; - -# Destroy the CA hierarchy completely. Use with care. -destroy: - @if [ -z "$(force)" ]; then echo "Destroy disabled, use: make destroy force=y"; exit 1; fi - @if [ ! -d $(SCRIPT_DIR) ]; then echo "Error in setup"; exit 1; fi - @echo "Removing everything (for debug purpose)..." - @rm -rf $(DATA_DIR)/* - -# Initialize the CA structure -structure: - @if [ -z "$(caname)" ]; then echo "Internal error: caname is missing"; exit 1; fi - @if [ -d $(DATA_DIR)/$(caname) ]; then echo "CA $(caname) already exists."; exit 1; fi - # Creating CA structure - @mkdir -p $(DATA_DIR)/$(caname) - @mkdir $(DATA_DIR)/$(caname)/public - @mkdir $(DATA_DIR)/$(caname)/public/crl - @mkdir $(DATA_DIR)/$(caname)/private - @chmod 700 $(DATA_DIR)/$(caname)/private - @mkdir $(DATA_DIR)/$(caname)/clients - @echo "01" > $(DATA_DIR)/$(caname)/serial - @echo "01" > $(DATA_DIR)/$(caname)/crlnumber - @touch $(DATA_DIR)/$(caname)/index.txt - -# Initialize the top-level CA structure and keys. -init: - @if [ -z "$(topca)" ]; then echo "Please specify the name of the root CA. Ex: make init topca=rootca.testbed.aaa"; exit 1; fi - # Create the folder hierarchy - @$(REMAKE) structure caname=$(topca) - # Generate the self-signed certificate - @CA_ROOT_DIR=$(DATA_DIR)/$(topca) openssl req $(CONFIG) -new -batch -x509 -days 3650 -nodes -newkey rsa:$(cakeysize) -out $(DATA_DIR)/$(topca)/public/cacert.pem \ - -keyout $(DATA_DIR)/$(topca)/private/cakey.pem -extensions ca_cert -subj /CN=$(topca) - @ln -s cacert.pem $(DATA_DIR)/$(topca)/public/`openssl x509 -noout -hash < $(DATA_DIR)/$(topca)/public/cacert.pem`.0 - @touch $(DATA_DIR)/$(topca)/public/cachain.pem - @ln -s ../../$(topca)/public/cacert.pem $(DATA_DIR)/$(topca)/public/caroot.pem - @$(REMAKE) gencrl ca=$(topca) - -# Create a secondary CA -newca: - @if [ -z "$(name)" -o -z "$(ca)" ]; then echo "Missing parameter. Ex: make newca name=subca.testbed.aaa ca=rootca.testbed.aaa"; exit 1; fi - @if [ ! -e $(DATA_DIR)/$(ca)/private/cakey.pem ]; then echo "The parent CA $(ca) does not exist."; exit 1; fi - @if [ ! -d $(DATA_DIR)/$(name) ]; then $(REMAKE) structure caname=$(name); fi - # Generate the private key and CSR for the new CA if needed - @if [ ! -e $(DATA_DIR)/$(name)/private/cakey.pem ]; then \ - openssl genrsa -out $(DATA_DIR)/$(name)/private/cakey.pem $(cakeysize) ; fi - @if [ ! -e $(DATA_DIR)/$(name)/private/cacsr.pem ]; then \ - CA_ROOT_DIR=$(DATA_DIR)/$(name) openssl req $(CONFIG) -new -batch -out $(DATA_DIR)/$(name)/private/cacsr.pem \ - -key $(DATA_DIR)/$(name)/private/cakey.pem \ - -subj /CN=$(name) -reqexts v3_req_ca; fi - # Revoke a previous certificate for this CA if any - @if [ -e $(DATA_DIR)/$(name)/public/cacert.pem ]; then \ - echo "Revoking previous certificate ..."; \ - $(REMAKE) revoke name=$(name) ca=$(ca); \ - mv $(DATA_DIR)/$(name)/public/cacert.pem $(DATA_DIR)/$(name)/public/cacert-$(DATE).pem; fi - # Issue the new CA certificate - @CA_ROOT_DIR=$(DATA_DIR)/$(ca) openssl ca $(CONFIG) -in $(DATA_DIR)/$(name)/private/cacsr.pem \ - -out $(DATA_DIR)/$(name)/public/cacert.pem \ - -batch -extensions ca_cert - # Hash and link to parent - @ln -s cacert.pem $(DATA_DIR)/$(ca)/public/`openssl x509 -noout -hash < $(DATA_DIR)/$(name)/public/cacert.pem`.0 - @rm -f $(DATA_DIR)/$(name)/parent - @ln -s ../$(ca) $(DATA_DIR)/$(name)/parent - @cat $(DATA_DIR)/$(name)/public/cacert.pem $(DATA_DIR)/$(ca)/public/cachain.pem > $(DATA_DIR)/$(name)/public/cachain.pem - @ln -s ../../$(ca)/public/caroot.pem $(DATA_DIR)/$(name)/public/caroot.pem - @for CRLFILE in `cd $(DATA_DIR)/$(ca)/public/crl && ls -1`; do ln -sf ../../../$(ca)/public/crl/$$CRLFILE $(DATA_DIR)/$(name)/public/crl/$$CRLFILE; done - @$(REMAKE) gencrl ca=$(name) - -# Create a new certificate for use in TLS communications and other terminal usages -newcert: - @if [ -z "$(name)" -o -z "$(ca)" ]; then echo "Missing parameter. Ex: make newcert name=service.testbed.aaa ca=ca.testbed.aaa"; exit 1; fi - @if [ ! -e $(DATA_DIR)/$(ca)/private/cakey.pem ]; then echo "The parent CA $(ca) does not exist."; exit 1; fi - @if [ ! -d $(DATA_DIR)/$(ca)/clients/$(name) ]; then mkdir $(DATA_DIR)/$(ca)/clients/$(name); fi - # Create a private key if needed - @if [ ! -e $(DATA_DIR)/$(ca)/clients/$(name)/privkey.pem ]; then \ - openssl genrsa -out $(DATA_DIR)/$(ca)/clients/$(name)/privkey.pem $(keysize); fi - # Create a CSR if needed - @if [ ! -e $(DATA_DIR)/$(ca)/clients/$(name)/csr.pem ]; then \ - CA_ROOT_DIR=$(DATA_DIR)/$(ca) openssl req $(CONFIG) -new -batch -out $(DATA_DIR)/$(ca)/clients/$(name)/csr.pem \ - -key $(DATA_DIR)/$(ca)/clients/$(name)/privkey.pem \ - -subj /CN=$(name); fi - # Revoke a previous certificate if any - @if [ -e $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem ]; then \ - $(REMAKE) revoke name=$(name) ca=$(ca); \ - mv $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem $(DATA_DIR)/$(ca)/clients/$(name)/cert-$(DATE).pem; fi - # Now sign the new certificate with the CA key - @CA_ROOT_DIR=$(DATA_DIR)/$(ca) openssl ca $(CONFIG) -in $(DATA_DIR)/$(ca)/clients/$(name)/csr.pem \ - -out $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem \ - -batch - # Hash - @ln -sf `cat $(DATA_DIR)/$(ca)/serial.old`.pem $(DATA_DIR)/$(ca)/public/`openssl x509 -noout -hash < $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem`.0 - # Compiled informations for the client - @cat $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem $(DATA_DIR)/$(ca)/public/cachain.pem > $(DATA_DIR)/$(ca)/clients/$(name)/certchain.pem - @ln -sf ../../public/crl $(DATA_DIR)/$(ca)/clients/$(name)/crl - @ln -sf ../../public/caroot.pem $(DATA_DIR)/$(ca)/clients/$(name)/ca.pem - -# Create a PKCS#12 file containing the client's information -p12: newcert - # Create the PKCS#12 file - @cat $(DATA_DIR)/$(ca)/clients/$(name)/privkey.pem \ - $(DATA_DIR)/$(ca)/clients/$(name)/certchain.pem \ - $(DATA_DIR)/$(ca)/clients/$(name)/ca.pem \ - | openssl pkcs12 -export -out $(DATA_DIR)/$(ca)/clients/$(name)/$(name).p12 - @echo "Client certificate is created in $(DATA_DIR)/$(ca)/clients/$(name)/$(name).p12" - -# Create an archive to send the data to the client node -ship: - @if [ -z "$(name)" -o -z "$(ca)" ]; then echo "Missing parameter. Ex: make ship name=service.testbed.aaa ca=ca.testbed.aaa"; exit 1; fi - @if [ ! -e $(DATA_DIR)/$(ca)/private/cakey.pem ]; then echo "The parent CA $(ca) does not exist."; exit 1; fi - @if [ ! -e $(DATA_DIR)/$(ca)/clients/$(name)/privkey.pem ]; then echo "The client $(name) does not exist, use 'make newcert' first."; exit 1; fi - # Ship the data - @tar -c -C $(DATA_DIR)/$(ca)/clients/$(name) -z -f $(ca)_$(name).tar.gz -h . - @echo "The files have been packaged into archive: $(ca)_$(name).tar.gz" - -# Revoke a certificate -revoke: - @if [ -z "$(name)" -o -z "$(ca)" ]; then echo "Missing parameter. Ex: make revoke name=service.testbed.aaa ca=ca.testbed.aaa"; exit 1; fi - @if [ ! -e $(DATA_DIR)/$(ca)/private/cakey.pem ]; then echo "The parent CA $(ca) does not exist."; exit 1; fi - @if [ ! -e $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem ]; \ - then echo "$(DATA_DIR)/$(ca)/clients/$(name)/cert.pem not found"; \ - exit 1; \ - fi; - # Revoke the certificate - @CA_ROOT_DIR=$(DATA_DIR)/$(ca) openssl ca $(CONFIG) -revoke $(DATA_DIR)/$(ca)/clients/$(name)/cert.pem; - @$(REMAKE) gencrl ca=$(ca) - -# Regenerate the Certificate Revocation List. -gencrl: - @if [ -z "$(ca)" ]; then echo "Missing parameter. Ex: make gencrl ca=ca.testbed.aaa"; exit 1; fi - # Create the CRL - @CA_ROOT_DIR=$(DATA_DIR)/$(ca) openssl ca $(CONFIG) -gencrl -out $(DATA_DIR)/$(ca)/public/crl/$(ca).pem - @ln -s crl/$(ca).pem $(DATA_DIR)/$(ca)/public/local.pem - @ln -s local.pem $(DATA_DIR)/$(ca)/public/`openssl crl -noout -hash < $(DATA_DIR)/$(ca)/public/crl/$(ca).pem`.r0 - -# End of file... diff --git a/lib/freeDiameter-1.2.1/contrib/app_acct_tools/app_acct.conf b/lib/freeDiameter-1.2.1/contrib/app_acct_tools/app_acct.conf deleted file mode 100644 index 0c9cdb89f..000000000 --- a/lib/freeDiameter-1.2.1/contrib/app_acct_tools/app_acct.conf +++ /dev/null @@ -1,68 +0,0 @@ - -# This is the configuration for use with the database created by 'database.sql' file. -# One should take care of configuring the ConnInfo properly. -ConnInfo = ""; - -# The table and special fields names: -Table = "incoming"; -Timestamp_field = "recorded_on"; -Server_name_field = "recorded_serv"; - -# The AVPs that are saved in the table: -"Origin-Host"; -"Origin-Realm"; -"Destination-Realm"; -"Destination-Host"; -"Session-Id"; -"Origin-State-Id"; -"Accounting-Record-Type"; -"Accounting-Record-Number"; -"User-Name"; -"Event-Timestamp"; -"Acct-Application-Id"; -"Accounting-Sub-Session-Id"; -"Acct-Session-Id"; -"Acct-Multi-Session-Id"; -"Origin-AAA-Protocol"; -"Acct-Delay-Time"; -"NAS-Identifier"; -"NAS-IP-Address"; -"NAS-IPv6-Address"; -"NAS-Port"; -"NAS-Port-Id"; -"NAS-Port-Type"; -"Service-Type"; -"Termination-Cause"; -"Accounting-Input-Octets"; -"Accounting-Input-Packets"; -"Accounting-Output-Octets"; -"Accounting-Output-Packets"; -"Acct-Authentic"; -"Acct-Link-Count"; -"Acct-Session-Time"; -"Acct-Tunnel-Connection"; -"Acct-Tunnel-Packets-Lost"; -"Callback-Id"; -"Callback-Number"; -"Called-Station-Id"; -"Calling-Station-Id"; -"Connect-Info"; -"Originating-Line-Info"; -"Authorization-Lifetime"; -"Session-Timeout"; -"Idle-Timeout"; -"Port-Limit"; -"Accounting-Realtime-Required"; -"Acct-Interim-Interval"; -"Filter-Id"; -"NAS-Filter-Rule"; -"QoS-Filter-Rule"; -"Login-IP-Host"; -"Login-IPv6-Host"; -"Login-LAT-Group"; -"Login-LAT-Node"; -"Login-LAT-Port"; -"Login-LAT-Service"; -"Login-Service"; -"Login-TCP-Port"; -"Route-Record" = { multi=5; }; diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/alldefault.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/alldefault.conf deleted file mode 100644 index 037691834..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/alldefault.conf +++ /dev/null @@ -1,2 +0,0 @@ - -set(CTEST_BUILD_NAME "Default") diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allext.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allext.conf deleted file mode 100644 index ba94a0906..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allext.conf +++ /dev/null @@ -1,9 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(CTEST_BUILD_NAME "All extensions (default)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdbg.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdbg.conf deleted file mode 100644 index 60e9df655..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdbg.conf +++ /dev/null @@ -1,11 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(WITH_COVERAGE TRUE) -set(CTEST_BUILD_NAME "All extensions (Debug)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DCMAKE_BUILD_TYPE:STRING=Debug") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdeb.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdeb.conf deleted file mode 100644 index 876baafef..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextdeb.conf +++ /dev/null @@ -1,10 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(CTEST_BUILD_NAME "All extensions (DebianPackage)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DCMAKE_BUILD_TYPE:STRING=DebianPackage") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextmax.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextmax.conf deleted file mode 100644 index a67468e47..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextmax.conf +++ /dev/null @@ -1,10 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(CTEST_BUILD_NAME "All extensions (MaxPerformance)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DCMAKE_BUILD_TYPE:STRING=MaxPerformance") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextprof.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextprof.conf deleted file mode 100644 index 9d6d66c13..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextprof.conf +++ /dev/null @@ -1,11 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(WITH_COVERAGE TRUE) -set(CTEST_BUILD_NAME "All extensions (Profiling)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DCMAKE_BUILD_TYPE:STRING=Profiling") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextrel.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextrel.conf deleted file mode 100644 index 60457cbd0..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextrel.conf +++ /dev/null @@ -1,10 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(CTEST_BUILD_NAME "All extensions (Release)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DCMAKE_BUILD_TYPE:STRING=Release") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextval.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextval.conf deleted file mode 100644 index 48e32aafc..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/allextval.conf +++ /dev/null @@ -1,11 +0,0 @@ - -# This configuration compiles all the extensions. It also performs a coverage test. -# For this to pass, you need to setup the pg database for app_acct test. - -set(WITH_COVERAGE TRUE) -set(CTEST_BUILD_NAME "All extensions (DebugValgrind)") - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DCMAKE_BUILD_TYPE:STRING=DebugValgrind") -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test") - diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/idnaignore.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/idnaignore.conf deleted file mode 100644 index 5c344ac5f..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/idnaignore.conf +++ /dev/null @@ -1,4 +0,0 @@ - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DDIAMID_IDNA_IGNORE:BOOL=ON") - -set(CTEST_BUILD_NAME "IDNA Ignore") diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/idnareject.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/idnareject.conf deleted file mode 100644 index dbcbe6902..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/idnareject.conf +++ /dev/null @@ -1,4 +0,0 @@ - -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DDIAMID_IDNA_REJECT:BOOL=ON") - -set(CTEST_BUILD_NAME "IDNA Reject") diff --git a/lib/freeDiameter-1.2.1/contrib/nightly_tests/nosctp.conf b/lib/freeDiameter-1.2.1/contrib/nightly_tests/nosctp.conf deleted file mode 100644 index f37aa3eee..000000000 --- a/lib/freeDiameter-1.2.1/contrib/nightly_tests/nosctp.conf +++ /dev/null @@ -1,5 +0,0 @@ - -# Remove SCTP support at compilation -set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DDISABLE_SCTP:BOOL=ON") - -set(CTEST_BUILD_NAME "No SCTP") diff --git a/lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-1.conf b/lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-1.conf deleted file mode 100644 index ed344f9b0..000000000 --- a/lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-1.conf +++ /dev/null @@ -1,16 +0,0 @@ - -# -------- Test configuration --------- - -Identity = "peer1.localdomain"; -Realm = "localdomain"; -# Port = 3868; -# SecPort = 3869; - -TLS_Cred = "peer1.cert.pem", - "peer1.key.pem"; -TLS_CA = "cacert.pem"; - -LoadExtension = "extensions/test_app.fdx" : "test_app1.conf"; - -ConnectPeer = "peer2.localdomain" { ConnectTo = "127.0.0.1"; No_TLS; port = 30868; }; - diff --git a/lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-2.conf b/lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-2.conf deleted file mode 100644 index f41e988ad..000000000 --- a/lib/freeDiameter-1.2.1/doc/single_host/freeDiameter-2.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -------- Test configuration --------- - -Identity = "peer2.localdomain"; -Realm = "localdomain"; -Port = 30868; -SecPort = 30869; - -TLS_Cred = "peer2.cert.pem", - "peer2.key.pem"; -TLS_CA = "cacert.pem"; - -LoadExtension = "extensions/test_app.fdx" : "test_app2.conf"; - -ConnectPeer = "peer1.localdomain" { ConnectTo = "127.0.0.1"; No_TLS; }; - diff --git a/lib/freeDiameter-1.2.1/doc/single_host/test_app1.conf b/lib/freeDiameter-1.2.1/doc/single_host/test_app1.conf deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/freeDiameter-1.2.1/doc/single_host/test_app2.conf b/lib/freeDiameter-1.2.1/doc/single_host/test_app2.conf deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/freeDiameter-1.2.1/extensions/Makefile.am b/lib/freeDiameter-1.2.1/extensions/Makefile.am index 4a6b2216f..7fe4cc19d 100644 --- a/lib/freeDiameter-1.2.1/extensions/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/Makefile.am @@ -3,7 +3,5 @@ SUBDIRS = \ dbg_msg_dumps dict_rfc5777 dict_mip6i \ dict_nasreq dict_nas_mipv6 \ - dict_dcca dict_dcca_3gpp dict_s6a - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + dict_dcca dict_dcca_3gpp dict_s6a \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dbg_msg_dumps/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dbg_msg_dumps/Makefile.am index a90a3ff3d..d880b7ecf 100644 --- a/lib/freeDiameter-1.2.1/extensions/dbg_msg_dumps/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dbg_msg_dumps/Makefile.am @@ -2,25 +2,26 @@ extlib_LTLIBRARIES = dbg_msg_dumps.la -dbg_msg_dumps_la_SOURCES = \ - dbg_msg_dumps.c +dbg_msg_dumps_la_SOURCES = dbg_msg_dumps.c dbg_msg_dumps_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dbg_msg_dumps_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_dcca/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_dcca/Makefile.am index a9fabc9f2..57da4881a 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_dcca/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_dcca/Makefile.am @@ -2,25 +2,26 @@ extlib_LTLIBRARIES = dict_dcca.la -dict_dcca_la_SOURCES = \ - dict_dcca.c +dict_dcca_la_SOURCES = dict_dcca.c dict_dcca_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_dcca_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_dcca_3gpp/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_dcca_3gpp/Makefile.am index 26c7a4590..facc16798 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_dcca_3gpp/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_dcca_3gpp/Makefile.am @@ -7,20 +7,22 @@ dict_dcca_3gpp_la_SOURCES = \ dict_dcca_3gpp_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_dcca_3gpp_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_mip6i/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_mip6i/Makefile.am index b0c9bf6e1..5a8a6f4f0 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_mip6i/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_mip6i/Makefile.am @@ -2,25 +2,26 @@ extlib_LTLIBRARIES = dict_mip6i.la -dict_mip6i_la_SOURCES = \ - dict_mip6i.c +dict_mip6i_la_SOURCES = dict_mip6i.c dict_mip6i_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_mip6i_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_nas_mipv6/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_nas_mipv6/Makefile.am index 947d5d05c..f274def02 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_nas_mipv6/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_nas_mipv6/Makefile.am @@ -2,25 +2,26 @@ extlib_LTLIBRARIES = dict_nas_mipv6.la -dict_nas_mipv6_la_SOURCES = \ - dict_nas_mipv6.c +dict_nas_mipv6_la_SOURCES = dict_nas_mipv6.c dict_nas_mipv6_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_nas_mipv6_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_nasreq/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_nasreq/Makefile.am index a04469efc..18cde9205 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_nasreq/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_nasreq/Makefile.am @@ -2,25 +2,26 @@ extlib_LTLIBRARIES = dict_nasreq.la -dict_nasreq_la_SOURCES = \ - dict_nasreq.c +dict_nasreq_la_SOURCES = dict_nasreq.c dict_nasreq_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_nasreq_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_rfc5777/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_rfc5777/Makefile.am index 1900744f9..d3aff5c70 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_rfc5777/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_rfc5777/Makefile.am @@ -7,20 +7,22 @@ dict_rfc5777_la_SOURCES = \ dict_rfc5777_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_rfc5777_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/extensions/dict_s6a/Makefile.am b/lib/freeDiameter-1.2.1/extensions/dict_s6a/Makefile.am index 2f62c97b6..2c9e63a50 100644 --- a/lib/freeDiameter-1.2.1/extensions/dict_s6a/Makefile.am +++ b/lib/freeDiameter-1.2.1/extensions/dict_s6a/Makefile.am @@ -7,20 +7,22 @@ dict_s6a_la_SOURCES = \ dict_s6a_la_DEPENDENCIES = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) dict_s6a_la_LIBADD = \ $(top_srcdir)/libfdcore/libfdcore.la \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) AM_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + $(NULL) AM_CFLAGS = \ - -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -Wall -Werror \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/libfdcore/Makefile.am b/lib/freeDiameter-1.2.1/libfdcore/Makefile.am index 1bf6fddf2..755da81fe 100644 --- a/lib/freeDiameter-1.2.1/libfdcore/Makefile.am +++ b/lib/freeDiameter-1.2.1/libfdcore/Makefile.am @@ -1,5 +1,7 @@ ## Process this file with automake to produce Makefile.in +EXTRA_DIST = fdd.y fdd.l + pkglib_LTLIBRARIES = libfdcore.la libfdcore_la_SOURCES = \ @@ -8,13 +10,16 @@ libfdcore_la_SOURCES = \ extensions.c fifo_stats.c hooks.c dict_base_proto.c messages.c \ queues.c peers.c p_ce.c p_cnx.c p_dw.c p_dp.c p_expiry.c \ p_out.c p_psm.c p_sr.c routing_dispatch.c server.c tcp.c \ - fdd.tab.y lex.fdd.l version.c + fdd.tab.y lex.fdd.l version.c \ + $(NULL) libfdcore_la_DEPENDENCIES = \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) libfdcore_la_LIBADD = \ - $(top_srcdir)/libfdproto/libfdproto.la + $(top_srcdir)/libfdproto/libfdproto.la \ + $(NULL) if SCTP libfdcore_la_SOURCES += sctp.c sctp3436.c @@ -25,13 +30,6 @@ AM_LFLAGS = -p -Cem -Pfdd BUILT_SOURCES = fdd.tab.h -AM_LDFLAGS = \ - -version-info @LIBVERSION@ - AM_CPPFLAGS = \ - -I$(top_srcdir)/include - -AM_CFLAGS = - -MAINTAINERCLEANFILES = version.h fdd.c Makefile.in -MOSTLYCLEANFILES = *.stackdump + -I$(top_srcdir)/include \ + $(NULL) diff --git a/lib/freeDiameter-1.2.1/libfdproto/Makefile.am b/lib/freeDiameter-1.2.1/libfdproto/Makefile.am index b2a85561e..e50a11421 100644 --- a/lib/freeDiameter-1.2.1/libfdproto/Makefile.am +++ b/lib/freeDiameter-1.2.1/libfdproto/Makefile.am @@ -6,15 +6,9 @@ libfdproto_la_SOURCES = \ fdproto-internal.h \ dictionary.c dictionary_functions.c dispatch.c fifo.c init.c \ lists.c log.c messages.c ostr.c portability.c rt_data.c \ - sessions.c utils.c version.c - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ + sessions.c utils.c version.c \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/include - -AM_CFLAGS = - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump + -I$(top_srcdir)/include \ + $(NULL) diff --git a/lib/gtp/Makefile.am b/lib/gtp/Makefile.am index e506819ce..3d1b69671 100644 --- a/lib/gtp/Makefile.am +++ b/lib/gtp/Makefile.am @@ -1,31 +1,44 @@ -## Process this file with automake to produce Makefile.in +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . pkglib_LTLIBRARIES = libgtp.la libgtp_la_SOURCES = \ - gtp_message.h gtp_types.h gtp_conv.h gtp_node.h gtp_path.h gtp_xact.h \ - gtp_message.c gtp_types.c gtp_conv.c gtp_node.c gtp_path.c gtp_xact.c \ + gtp_tlv.h gtp_message.h gtp_types.h gtp_conv.h \ + gtp_node.h gtp_path.h gtp_xact.h \ + gtp_tlv.c gtp_message.c gtp_types.c gtp_conv.c \ + gtp_node.c gtp_path.c gtp_xact.c \ $(NULL) libgtp_la_DEPENDENCIES = \ - $(top_srcdir)/lib/core/src/libcore.la \ + @OGSCORE_LIBS@ \ + $(top_srcdir)/lib/base/libbase.la \ $(NULL) libgtp_la_LIBADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(NULL) - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ \ + @OGSCORE_LIBS@ \ + $(top_srcdir)/lib/base/libbase.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ + -I$(top_srcdir)/lib \ $(NULL) AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/lib/gtp/gtp_conv.c b/lib/gtp/gtp_conv.c index e5d578804..6c806b237 100644 --- a/lib/gtp/gtp_conv.c +++ b/lib/gtp/gtp_conv.c @@ -1,7 +1,21 @@ -#define TRACE_MODULE _gtp_conv - -#include "core_debug.h" -#include "core_network.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "gtp_message.h" #include "gtp_types.h" @@ -42,21 +56,21 @@ void gtp_bearers_in_create_indirect_tunnel_response( (*bearers)[10] = &rsp->bearer_context_10; } -status_t gtp_f_teid_to_sockaddr( - gtp_f_teid_t *f_teid, c_uint16_t port, c_sockaddr_t **list) +int gtp_f_teid_to_sockaddr( + gtp_f_teid_t *f_teid, uint16_t port, ogs_sockaddr_t **list) { - c_sockaddr_t *addr = NULL, *addr6 = NULL; + ogs_sockaddr_t *addr = NULL, *addr6 = NULL; - d_assert(f_teid, return CORE_ERROR,); - d_assert(list, return CORE_ERROR,); + ogs_assert(f_teid); + ogs_assert(list); - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, return CORE_ERROR,); + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); addr->c_sa_family = AF_INET; addr->c_sa_port = htons(port); - addr6 = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr6, return CORE_ERROR,); + addr6 = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr6); addr6->c_sa_family = AF_INET6; addr6->c_sa_port = htons(port); @@ -72,31 +86,31 @@ status_t gtp_f_teid_to_sockaddr( else if (f_teid->ipv4) { addr->sin.sin_addr.s_addr = f_teid->addr; - CORE_FREE(addr6); + ogs_free(addr6); *list = addr; } else if (f_teid->ipv6) { memcpy(addr6->sin6.sin6_addr.s6_addr, f_teid->addr6, IPV6_LEN); - CORE_FREE(addr); + ogs_free(addr); *list = addr6; } else { - CORE_FREE(addr); - CORE_FREE(addr6); - d_assert(0, return CORE_ERROR,); + ogs_free(addr); + ogs_free(addr6); + ogs_assert_if_reached(); } - return CORE_OK; + return OGS_OK; } -status_t gtp_sockaddr_to_f_teid( - c_sockaddr_t *addr, c_sockaddr_t *addr6, gtp_f_teid_t *f_teid, int *len) +int gtp_sockaddr_to_f_teid( + ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6, gtp_f_teid_t *f_teid, int *len) { - d_assert(f_teid, return CORE_ERROR,); + ogs_assert(f_teid); if (addr && addr6) { @@ -121,15 +135,15 @@ status_t gtp_sockaddr_to_f_teid( *len = GTP_F_TEID_IPV6_LEN; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - return CORE_OK; + return OGS_OK; } -status_t gtp_f_teid_to_ip(gtp_f_teid_t *f_teid, ip_t *ip) +int gtp_f_teid_to_ip(gtp_f_teid_t *f_teid, ip_t *ip) { - d_assert(ip, return CORE_ERROR,); - d_assert(f_teid, return CORE_ERROR,); + ogs_assert(ip); + ogs_assert(f_teid); memset(ip, 0, sizeof(ip_t)); @@ -153,15 +167,15 @@ status_t gtp_f_teid_to_ip(gtp_f_teid_t *f_teid, ip_t *ip) ip->len = IPV6_LEN; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - return CORE_OK; + return OGS_OK; } -status_t gtp_ip_to_f_teid(ip_t *ip, gtp_f_teid_t *f_teid, int *len) +int gtp_ip_to_f_teid(ip_t *ip, gtp_f_teid_t *f_teid, int *len) { - d_assert(ip, return CORE_ERROR,); - d_assert(f_teid, return CORE_ERROR,); + ogs_assert(ip); + ogs_assert(f_teid); f_teid->ipv4 = ip->ipv4; f_teid->ipv6 = ip->ipv6; @@ -183,7 +197,7 @@ status_t gtp_ip_to_f_teid(ip_t *ip, gtp_f_teid_t *f_teid, int *len) *len = GTP_F_TEID_IPV6_LEN; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - return CORE_OK; + return OGS_OK; } diff --git a/lib/gtp/gtp_conv.h b/lib/gtp/gtp_conv.h index 03eb1a2df..fbe2f68b8 100644 --- a/lib/gtp/gtp_conv.h +++ b/lib/gtp/gtp_conv.h @@ -1,12 +1,31 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GTP_CONV_H__ #define __GTP_CONV_H__ -#include "core_errno.h" +#include "ogs-core.h" +typedef struct ogs_sockaddr_s ogs_sockaddr_t; typedef struct _tlv_bearer_context_t tlv_bearer_context_t; typedef struct _gtp_create_indirect_data_forwarding_tunnel_request_t gtp_create_indirect_data_forwarding_tunnel_request_t; typedef struct _gtp_create_indirect_data_forwarding_tunnel_response_t gtp_create_indirect_data_forwarding_tunnel_response_t; -typedef struct c_sockaddr_t c_sockaddr_t; typedef struct _gtp_f_teid_t gtp_f_teid_t; typedef struct _ip_t ip_t; @@ -17,20 +36,19 @@ extern "C" { #define GTP_MAX_NUM_OF_INDIRECT_TUNNEL 11 /* Create Indirect Data Forwarding Tunnel Request/Response */ -CORE_DECLARE(void) gtp_bearers_in_create_indirect_tunnel_request( +void gtp_bearers_in_create_indirect_tunnel_request( tlv_bearer_context_t *bearers[][GTP_MAX_NUM_OF_INDIRECT_TUNNEL], gtp_create_indirect_data_forwarding_tunnel_request_t *req); -CORE_DECLARE(void) gtp_bearers_in_create_indirect_tunnel_response( +void gtp_bearers_in_create_indirect_tunnel_response( tlv_bearer_context_t *bearers[][GTP_MAX_NUM_OF_INDIRECT_TUNNEL], gtp_create_indirect_data_forwarding_tunnel_response_t *rsp); -CORE_DECLARE(status_t) gtp_f_teid_to_sockaddr( - gtp_f_teid_t *f_teid, c_uint16_t port, c_sockaddr_t **list); -CORE_DECLARE(status_t) gtp_sockaddr_to_f_teid( - c_sockaddr_t *addr, c_sockaddr_t *addr6, gtp_f_teid_t *f_teid, int *len); -CORE_DECLARE(status_t) gtp_f_teid_to_ip(gtp_f_teid_t *f_teid, ip_t *ip); -CORE_DECLARE(status_t) gtp_ip_to_f_teid( - ip_t *ip, gtp_f_teid_t *f_teid, int *len); +int gtp_f_teid_to_sockaddr( + gtp_f_teid_t *f_teid, uint16_t port, ogs_sockaddr_t **list); +int gtp_sockaddr_to_f_teid( + ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6, gtp_f_teid_t *f_teid, int *len); +int gtp_f_teid_to_ip(gtp_f_teid_t *f_teid, ip_t *ip); +int gtp_ip_to_f_teid(ip_t *ip, gtp_f_teid_t *f_teid, int *len); #ifdef __cplusplus } diff --git a/lib/gtp/gtp_message.c b/lib/gtp/gtp_message.c index e9e20eaf3..69c82d946 100644 --- a/lib/gtp/gtp_message.c +++ b/lib/gtp/gtp_message.c @@ -1,37 +1,29 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by gtp_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2018-01-23 16:32:53.073144 by acetcom + * Created on: 2019-03-06 12:20:52.446761 by acetcom * from 29274-d80.docx ******************************************************************************/ -#define TRACE_MODULE _gtp_message -#include "core_debug.h" #include "gtp_message.h" tlv_desc_t tlv_desc_imsi_0 = @@ -2769,21 +2761,18 @@ tlv_desc_t tlv_desc_modify_access_bearers_response = }}; -status_t gtp_parse_msg(gtp_message_t *gtp_message, pkbuf_t *pkbuf) +int gtp_parse_msg(gtp_message_t *gtp_message, ogs_pkbuf_t *pkbuf) { - status_t rv = CORE_ERROR; + int rv = OGS_ERROR; gtp_header_t *h = NULL; - c_uint16_t size = 0; + uint16_t size = 0; - d_assert(gtp_message, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(gtp_message); + ogs_assert(pkbuf); + ogs_assert(pkbuf->len); - d_trace(50, "[GTPv2] RECV : "); - d_trace_hex(50, pkbuf->payload, pkbuf->len); - - h = pkbuf->payload; - d_assert(h, return CORE_ERROR, "Null param"); + h = pkbuf->data; + ogs_assert(h); memset(gtp_message, 0, sizeof(gtp_message_t)); @@ -2792,276 +2781,269 @@ status_t gtp_parse_msg(gtp_message_t *gtp_message, pkbuf_t *pkbuf) else size = GTPV2C_HEADER_LEN-GTP_TEID_LEN; - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); - memcpy(>p_message->h, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(>p_message->h, pkbuf->data - size, size); if (h->teid_presence) gtp_message->h.teid = ntohl(gtp_message->h.teid); if (pkbuf->len == 0) - return CORE_OK; + return OGS_OK; switch(gtp_message->h.type) { case GTP_ECHO_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->echo_request, - &tlv_desc_echo_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_echo_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_ECHO_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->echo_response, - &tlv_desc_echo_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_echo_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_SESSION_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->create_session_request, - &tlv_desc_create_session_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_create_session_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_SESSION_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->create_session_response, - &tlv_desc_create_session_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_create_session_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->modify_bearer_request, - &tlv_desc_modify_bearer_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_modify_bearer_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->modify_bearer_response, - &tlv_desc_modify_bearer_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_modify_bearer_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_SESSION_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->delete_session_request, - &tlv_desc_delete_session_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_session_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_SESSION_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->delete_session_response, - &tlv_desc_delete_session_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_session_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_COMMAND_TYPE: rv = tlv_parse_msg(>p_message->modify_bearer_command, - &tlv_desc_modify_bearer_command, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_modify_bearer_command, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_FAILURE_INDICATION_TYPE: rv = tlv_parse_msg(>p_message->modify_bearer_failure_indication, - &tlv_desc_modify_bearer_failure_indication, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_modify_bearer_failure_indication, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_COMMAND_TYPE: rv = tlv_parse_msg(>p_message->delete_bearer_command, - &tlv_desc_delete_bearer_command, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_bearer_command, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_FAILURE_INDICATION_TYPE: rv = tlv_parse_msg(>p_message->delete_bearer_failure_indication, - &tlv_desc_delete_bearer_failure_indication, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_bearer_failure_indication, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DOWNLINK_DATA_NOTIFICATION_FAILURE_INDICATION_TYPE: rv = tlv_parse_msg(>p_message->downlink_data_notification_failure_indication, - &tlv_desc_downlink_data_notification_failure_indication, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_downlink_data_notification_failure_indication, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_BEARER_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->create_bearer_request, - &tlv_desc_create_bearer_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_create_bearer_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_BEARER_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->create_bearer_response, - &tlv_desc_create_bearer_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_create_bearer_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_UPDATE_BEARER_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->update_bearer_request, - &tlv_desc_update_bearer_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_update_bearer_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_UPDATE_BEARER_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->update_bearer_response, - &tlv_desc_update_bearer_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_update_bearer_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->delete_bearer_request, - &tlv_desc_delete_bearer_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_bearer_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->delete_bearer_response, - &tlv_desc_delete_bearer_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_bearer_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->create_indirect_data_forwarding_tunnel_request, - &tlv_desc_create_indirect_data_forwarding_tunnel_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_create_indirect_data_forwarding_tunnel_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->create_indirect_data_forwarding_tunnel_response, - &tlv_desc_create_indirect_data_forwarding_tunnel_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_create_indirect_data_forwarding_tunnel_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->delete_indirect_data_forwarding_tunnel_request, - &tlv_desc_delete_indirect_data_forwarding_tunnel_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_indirect_data_forwarding_tunnel_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->delete_indirect_data_forwarding_tunnel_response, - &tlv_desc_delete_indirect_data_forwarding_tunnel_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_delete_indirect_data_forwarding_tunnel_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_RELEASE_ACCESS_BEARERS_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->release_access_bearers_request, - &tlv_desc_release_access_bearers_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_release_access_bearers_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->release_access_bearers_response, - &tlv_desc_release_access_bearers_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_release_access_bearers_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DOWNLINK_DATA_NOTIFICATION_TYPE: rv = tlv_parse_msg(>p_message->downlink_data_notification, - &tlv_desc_downlink_data_notification, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_downlink_data_notification, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE_TYPE: rv = tlv_parse_msg(>p_message->downlink_data_notification_acknowledge, - &tlv_desc_downlink_data_notification_acknowledge, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_downlink_data_notification_acknowledge, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_ACCESS_BEARERS_REQUEST_TYPE: rv = tlv_parse_msg(>p_message->modify_access_bearers_request, - &tlv_desc_modify_access_bearers_request, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_modify_access_bearers_request, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_ACCESS_BEARERS_RESPONSE_TYPE: rv = tlv_parse_msg(>p_message->modify_access_bearers_response, - &tlv_desc_modify_access_bearers_response, pkbuf, TLV_MODE_T1_L2_I1); + &tlv_desc_modify_access_bearers_response, pkbuf, OGS_TLV_MODE_T1_L2_I1); break; default: - d_warn("Not implmeneted(type:%d)", gtp_message->h.type); + ogs_warn("Not implmeneted(type:%d)", gtp_message->h.type); break; } return rv; } -status_t gtp_build_msg(pkbuf_t **pkbuf, gtp_message_t *gtp_message) +int gtp_build_msg(ogs_pkbuf_t **pkbuf, gtp_message_t *gtp_message) { - status_t rv = CORE_ERROR; + int rv = OGS_ERROR; - d_assert(gtp_message, return rv, "Null param"); + ogs_assert(gtp_message); switch(gtp_message->h.type) { case GTP_ECHO_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_echo_request, - >p_message->echo_request, TLV_MODE_T1_L2_I1); + >p_message->echo_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_ECHO_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_echo_response, - >p_message->echo_response, TLV_MODE_T1_L2_I1); + >p_message->echo_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_SESSION_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_create_session_request, - >p_message->create_session_request, TLV_MODE_T1_L2_I1); + >p_message->create_session_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_SESSION_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_create_session_response, - >p_message->create_session_response, TLV_MODE_T1_L2_I1); + >p_message->create_session_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_modify_bearer_request, - >p_message->modify_bearer_request, TLV_MODE_T1_L2_I1); + >p_message->modify_bearer_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_modify_bearer_response, - >p_message->modify_bearer_response, TLV_MODE_T1_L2_I1); + >p_message->modify_bearer_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_SESSION_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_session_request, - >p_message->delete_session_request, TLV_MODE_T1_L2_I1); + >p_message->delete_session_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_SESSION_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_session_response, - >p_message->delete_session_response, TLV_MODE_T1_L2_I1); + >p_message->delete_session_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_COMMAND_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_modify_bearer_command, - >p_message->modify_bearer_command, TLV_MODE_T1_L2_I1); + >p_message->modify_bearer_command, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_BEARER_FAILURE_INDICATION_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_modify_bearer_failure_indication, - >p_message->modify_bearer_failure_indication, TLV_MODE_T1_L2_I1); + >p_message->modify_bearer_failure_indication, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_COMMAND_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_bearer_command, - >p_message->delete_bearer_command, TLV_MODE_T1_L2_I1); + >p_message->delete_bearer_command, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_FAILURE_INDICATION_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_bearer_failure_indication, - >p_message->delete_bearer_failure_indication, TLV_MODE_T1_L2_I1); + >p_message->delete_bearer_failure_indication, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DOWNLINK_DATA_NOTIFICATION_FAILURE_INDICATION_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_downlink_data_notification_failure_indication, - >p_message->downlink_data_notification_failure_indication, TLV_MODE_T1_L2_I1); + >p_message->downlink_data_notification_failure_indication, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_BEARER_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_create_bearer_request, - >p_message->create_bearer_request, TLV_MODE_T1_L2_I1); + >p_message->create_bearer_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_BEARER_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_create_bearer_response, - >p_message->create_bearer_response, TLV_MODE_T1_L2_I1); + >p_message->create_bearer_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_UPDATE_BEARER_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_update_bearer_request, - >p_message->update_bearer_request, TLV_MODE_T1_L2_I1); + >p_message->update_bearer_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_UPDATE_BEARER_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_update_bearer_response, - >p_message->update_bearer_response, TLV_MODE_T1_L2_I1); + >p_message->update_bearer_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_bearer_request, - >p_message->delete_bearer_request, TLV_MODE_T1_L2_I1); + >p_message->delete_bearer_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_BEARER_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_bearer_response, - >p_message->delete_bearer_response, TLV_MODE_T1_L2_I1); + >p_message->delete_bearer_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_create_indirect_data_forwarding_tunnel_request, - >p_message->create_indirect_data_forwarding_tunnel_request, TLV_MODE_T1_L2_I1); + >p_message->create_indirect_data_forwarding_tunnel_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_create_indirect_data_forwarding_tunnel_response, - >p_message->create_indirect_data_forwarding_tunnel_response, TLV_MODE_T1_L2_I1); + >p_message->create_indirect_data_forwarding_tunnel_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_indirect_data_forwarding_tunnel_request, - >p_message->delete_indirect_data_forwarding_tunnel_request, TLV_MODE_T1_L2_I1); + >p_message->delete_indirect_data_forwarding_tunnel_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_delete_indirect_data_forwarding_tunnel_response, - >p_message->delete_indirect_data_forwarding_tunnel_response, TLV_MODE_T1_L2_I1); + >p_message->delete_indirect_data_forwarding_tunnel_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_RELEASE_ACCESS_BEARERS_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_release_access_bearers_request, - >p_message->release_access_bearers_request, TLV_MODE_T1_L2_I1); + >p_message->release_access_bearers_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_release_access_bearers_response, - >p_message->release_access_bearers_response, TLV_MODE_T1_L2_I1); + >p_message->release_access_bearers_response, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DOWNLINK_DATA_NOTIFICATION_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_downlink_data_notification, - >p_message->downlink_data_notification, TLV_MODE_T1_L2_I1); + >p_message->downlink_data_notification, OGS_TLV_MODE_T1_L2_I1); break; case GTP_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_downlink_data_notification_acknowledge, - >p_message->downlink_data_notification_acknowledge, TLV_MODE_T1_L2_I1); + >p_message->downlink_data_notification_acknowledge, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_ACCESS_BEARERS_REQUEST_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_modify_access_bearers_request, - >p_message->modify_access_bearers_request, TLV_MODE_T1_L2_I1); + >p_message->modify_access_bearers_request, OGS_TLV_MODE_T1_L2_I1); break; case GTP_MODIFY_ACCESS_BEARERS_RESPONSE_TYPE: rv = tlv_build_msg(pkbuf, &tlv_desc_modify_access_bearers_response, - >p_message->modify_access_bearers_response, TLV_MODE_T1_L2_I1); + >p_message->modify_access_bearers_response, OGS_TLV_MODE_T1_L2_I1); break; default: - d_warn("Not implmeneted(type:%d)", gtp_message->h.type); + ogs_warn("Not implmeneted(type:%d)", gtp_message->h.type); break; } - if ((*pkbuf) && (*pkbuf)->payload) - { - d_trace(50, "[GTPv2] SEND : "); - d_trace_hex(50, (*pkbuf)->payload, (*pkbuf)->len); - } - return rv; } diff --git a/lib/gtp/gtp_message.h b/lib/gtp/gtp_message.h index e273b9dab..bbc1b5053 100644 --- a/lib/gtp/gtp_message.h +++ b/lib/gtp/gtp_message.h @@ -1,39 +1,33 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by gtp_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2018-01-23 16:32:53.055846 by acetcom + * Created on: 2019-03-06 12:20:52.420255 by acetcom * from 29274-d80.docx ******************************************************************************/ -#ifndef __GTP_TLV_H__ -#define __GTP_TLV_H__ +#ifndef __GTP_MESSAGE_H__ +#define __GTP_MESSAGE_H__ -#include "core_tlv_msg.h" +#include "gtp_tlv.h" #ifdef __cplusplus extern "C" { @@ -46,28 +40,28 @@ extern "C" { typedef struct _gtp_header_t { union { struct { - ED4(c_uint8_t version:3;, - c_uint8_t piggybacked:1;, - c_uint8_t teid_presence:1;, - c_uint8_t spare1:3;) + ED4(uint8_t version:3;, + uint8_t piggybacked:1;, + uint8_t teid_presence:1;, + uint8_t spare1:3;) }; /* GTU-U flags */ #define GTPU_FLAGS_PN 0x1 #define GTPU_FLAGS_S 0x2 - c_uint8_t flags; + uint8_t flags; }; - c_uint8_t type; - c_uint16_t length; + uint8_t type; + uint16_t length; union { struct { - c_uint32_t teid; + uint32_t teid; /* sqn : 31bit ~ 8bit, spare : 7bit ~ 0bit */ #define GTP_XID_TO_SQN(__xid) htonl(((__xid) << 8)) #define GTP_SQN_TO_XID(__sqn) (ntohl(__sqn) >> 8) - c_uint32_t sqn; + uint32_t sqn; }; /* sqn : 31bit ~ 8bit, spare : 7bit ~ 0bit */ - c_uint32_t sqn_only; + uint32_t sqn_only; }; } __attribute__ ((packed)) gtp_header_t; @@ -1170,13 +1164,11 @@ typedef struct _gtp_message_t { }; } gtp_message_t; -CORE_DECLARE(status_t) gtp_parse_msg( - gtp_message_t *gtp_message, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) gtp_build_msg( - pkbuf_t **pkbuf, gtp_message_t *gtp_message); +int gtp_parse_msg(gtp_message_t *gtp_message, ogs_pkbuf_t *pkbuf); +int gtp_build_msg(ogs_pkbuf_t **pkbuf, gtp_message_t *gtp_message); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __GTP_TLV_H__ */ +#endif /* __GTP_MESSAGE_H__ */ diff --git a/lib/gtp/gtp_node.c b/lib/gtp/gtp_node.c index abf434c13..7d3bb291c 100644 --- a/lib/gtp/gtp_node.c +++ b/lib/gtp/gtp_node.c @@ -1,182 +1,180 @@ -#define TRACE_MODULE _gtp_node - -#include "core_debug.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "gtp_conv.h" #include "gtp_node.h" #include "gtp_xact.h" -#define MAX_GTP_NODE_POOL_SIZE 512 +static OGS_POOL(pool, gtp_node_t); -pool_declare(gtp_node_pool, gtp_node_t, MAX_GTP_NODE_POOL_SIZE); - -status_t gtp_node_init(void) +int gtp_node_init(void) { - pool_init(>p_node_pool, MAX_GTP_NODE_POOL_SIZE); + ogs_pool_init(&pool, base_self()->gtp.node.pool); - return CORE_OK; + return OGS_OK; } -status_t gtp_node_final(void) +int gtp_node_final(void) { - if (pool_used(>p_node_pool)) - d_error("%d not freed in gtp_node_pool[%d]", - pool_used(>p_node_pool), pool_size(>p_node_pool)); - d_trace(9, "%d not freed in gtp_node_pool[%d]\n", - pool_used(>p_node_pool), pool_size(>p_node_pool)); - pool_final(>p_node_pool); + ogs_pool_final(&pool); - return CORE_OK; + return OGS_OK; } -status_t gtp_create_node(gtp_node_t **node, - c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4) +int gtp_create_node(gtp_node_t **node, + ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4) { - status_t rv; + int rv; gtp_node_t *new_node = NULL; - c_sockaddr_t *preferred_list = NULL; + ogs_sockaddr_t *preferred_list = NULL; - d_assert(all_list, return CORE_ERROR,); + ogs_assert(all_list); - rv = core_copyaddrinfo(&preferred_list, all_list); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_copyaddrinfo(&preferred_list, all_list); + ogs_assert(rv == OGS_OK); if (no_ipv4 == 1) { - rv = core_filteraddrinfo(&preferred_list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_filteraddrinfo(&preferred_list, AF_INET6); + ogs_assert(rv == OGS_OK); } if (no_ipv6 == 1) { - rv = core_filteraddrinfo(&preferred_list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_filteraddrinfo(&preferred_list, AF_INET); + ogs_assert(rv == OGS_OK); } if (prefer_ipv4 == 1) { - rv = core_sortaddrinfo(&preferred_list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_sortaddrinfo(&preferred_list, AF_INET); + ogs_assert(rv == OGS_OK); } else { - rv = core_sortaddrinfo(&preferred_list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_sortaddrinfo(&preferred_list, AF_INET6); + ogs_assert(rv == OGS_OK); } if (preferred_list) { - pool_alloc_node(>p_node_pool, &new_node); - d_assert(new_node, return CORE_ERROR,); + ogs_pool_alloc(&pool, &new_node); + ogs_assert(new_node); memset(new_node, 0, sizeof(gtp_node_t)); new_node->sa_list = preferred_list; - list_init(&new_node->local_list); - list_init(&new_node->remote_list); + ogs_list_init(&new_node->local_list); + ogs_list_init(&new_node->remote_list); } *node = new_node; - return CORE_OK; + return OGS_OK; } -status_t gtp_delete_node(gtp_node_t *node) +int gtp_delete_node(gtp_node_t *node) { - d_assert(node, return CORE_ERROR,); + ogs_assert(node); if (node->sock) - sock_delete(node->sock); + ogs_sock_destroy(node->sock); gtp_xact_delete_all(node); - core_freeaddrinfo(node->sa_list); - pool_free_node(>p_node_pool, node); + ogs_freeaddrinfo(node->sa_list); + ogs_pool_free(&pool, node); - return CORE_OK; + return OGS_OK; } -gtp_node_t *gtp_add_node(list_t *list, gtp_f_teid_t *f_teid, - c_uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4) +gtp_node_t *gtp_add_node(ogs_list_t *list, gtp_f_teid_t *f_teid, + uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4) { - status_t rv; + int rv; gtp_node_t *node = NULL; - c_sockaddr_t *sa_list = NULL; + ogs_sockaddr_t *sa_list = NULL; - d_assert(list, return NULL,); - d_assert(f_teid, return NULL,); - d_assert(port, return NULL,); + ogs_assert(list); + ogs_assert(f_teid); + ogs_assert(port); rv = gtp_f_teid_to_sockaddr(f_teid, port, &sa_list); - d_assert(rv == CORE_OK, return NULL,); + ogs_assert(rv == OGS_OK); rv = gtp_create_node(&node, sa_list, no_ipv4, no_ipv6, prefer_ipv4); - d_assert(rv == CORE_OK, return NULL,); + ogs_assert(rv == OGS_OK); if (node == NULL) { - d_error("Invalid Parameter : " + ogs_error("Invalid Parameter : " "port[%d], no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]", port, no_ipv4, no_ipv6, prefer_ipv4); return NULL; } - list_append(list, node); + ogs_list_add(list, node); rv = gtp_f_teid_to_ip(f_teid, &node->ip); - d_assert(rv == CORE_OK, return NULL,); + ogs_assert(rv == OGS_OK); - rv = sock_fill_scope_id_in_local(node->sa_list); - d_assert(rv == CORE_OK, return NULL,); + rv = ogs_sock_fill_scope_id_in_local(node->sa_list); + ogs_assert(rv == OGS_OK); - core_freeaddrinfo(sa_list); + ogs_freeaddrinfo(sa_list); return node; } -status_t gtp_remove_node(list_t *list, gtp_node_t *node) +int gtp_remove_node(ogs_list_t *list, gtp_node_t *node) { - status_t rv; - d_assert(node, return CORE_ERROR,); + int rv; + ogs_assert(node); - list_remove(list, node); + ogs_list_remove(list, node); rv = gtp_delete_node(node); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); return rv; } -status_t gtp_remove_all_nodes(list_t *list) +int gtp_remove_all_nodes(ogs_list_t *list) { gtp_node_t *node = NULL, *next_node = NULL; - node = list_first(list); - while(node) - { - next_node = list_next(node); - + ogs_list_for_each_safe(list, next_node, node) gtp_remove_node(list, node); - node = next_node; - } - - return CORE_OK; + return OGS_OK; } -gtp_node_t* gtp_find_node(list_t *list, gtp_f_teid_t *f_teid) +gtp_node_t *gtp_find_node(ogs_list_t *list, gtp_f_teid_t *f_teid) { - status_t rv; + int rv; gtp_node_t *node = NULL; ip_t ip; - d_assert(list, return NULL,); - d_assert(f_teid, return NULL,); + ogs_assert(list); + ogs_assert(f_teid); rv = gtp_f_teid_to_ip(f_teid, &ip); - d_assert(rv == CORE_OK, return NULL,); + ogs_assert(rv == OGS_OK); - node = list_first(list); - while (node) + ogs_list_for_each(list, node) { if (memcmp(&node->ip, &ip, ip.len) == 0) break; - - node = list_next(node); } return node; diff --git a/lib/gtp/gtp_node.h b/lib/gtp/gtp_node.h index 2da8dc7c8..2a45e3e9c 100644 --- a/lib/gtp/gtp_node.h +++ b/lib/gtp/gtp_node.h @@ -1,9 +1,25 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GTP_NODE_H__ #define __GTP_NODE_H__ -#include "core_list.h" -#include "core_network.h" - #include "gtp_types.h" #ifdef __cplusplus @@ -12,8 +28,8 @@ extern "C" { #define SETUP_GTP_NODE(__cTX, __gNODE) \ do { \ - d_assert((__cTX), break, "Null param"); \ - d_assert((__gNODE), break, "Null param"); \ + ogs_assert((__cTX)); \ + ogs_assert((__gNODE)); \ (__cTX)->gnode = __gNODE; \ } while(0) @@ -21,31 +37,32 @@ extern "C" { * This structure represents the commonalities of GTP node such as MME, SGW, * PGW gateway. Some of members may not be used by the specific type of node */ typedef struct _gtp_node_t { - lnode_t node; /* A node of list_t */ + ogs_lnode_t node; /* A node of list_t */ - c_sockaddr_t *sa_list; /* Socket Address List */ + ogs_sockaddr_t *sa_list; /* Socket Address List */ - sock_id sock; /* Socket instance */ + ogs_sock_t *sock; /* Socket instance */ ip_t ip; /* Socket Address */ + ogs_sockaddr_t conn; /* Connected Address */ - list_t local_list; - list_t remote_list; + ogs_list_t local_list; + ogs_list_t remote_list; } gtp_node_t; -CORE_DECLARE(status_t) gtp_node_init(void); -CORE_DECLARE(status_t) gtp_node_final(void); +int gtp_node_init(void); +int gtp_node_final(void); -CORE_DECLARE(status_t) gtp_create_node(gtp_node_t **node, - c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4); -CORE_DECLARE(status_t) gtp_delete_node(gtp_node_t *node); +int gtp_create_node(gtp_node_t **node, + ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4); +int gtp_delete_node(gtp_node_t *node); -CORE_DECLARE(gtp_node_t *) gtp_add_node( - list_t *list, gtp_f_teid_t *f_teid, - c_uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4); -CORE_DECLARE(status_t) gtp_remove_node(list_t *list, gtp_node_t *node); -CORE_DECLARE(status_t) gtp_remove_all_nodes(list_t *list); +gtp_node_t *gtp_add_node( + ogs_list_t *list, gtp_f_teid_t *f_teid, + uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4); +int gtp_remove_node(ogs_list_t *list, gtp_node_t *node); +int gtp_remove_all_nodes(ogs_list_t *list); -CORE_DECLARE(gtp_node_t *) gtp_find_node(list_t *list, gtp_f_teid_t *f_teid); +gtp_node_t *gtp_find_node(ogs_list_t *list, gtp_f_teid_t *f_teid); #ifdef __cplusplus } diff --git a/lib/gtp/gtp_path.c b/lib/gtp/gtp_path.c index a232c5da6..fe8afa7de 100644 --- a/lib/gtp/gtp_path.c +++ b/lib/gtp/gtp_path.c @@ -1,79 +1,84 @@ -#define TRACE_MODULE _gtp_path +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "core_debug.h" -#include "core_pkbuf.h" - -#include "3gpp_types.h" #include "gtp_message.h" #include "gtp_conv.h" #include "gtp_node.h" #include "gtp_path.h" -status_t gtp_server(sock_node_t *snode, sock_handler handler) +int gtp_server(ogs_socknode_t *snode) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; + ogs_assert(snode); - d_assert(snode, return CORE_ERROR,); + snode->sock = ogs_udp_server(snode->list); + ogs_assert(snode->sock); - rv = udp_server(&snode->sock, snode->list); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_info("gtp_server() [%s]:%d", + OGS_ADDR(snode->list, buf), OGS_PORT(snode->list)); - rv = sock_register(snode->sock, handler, NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - d_trace(1, "gtp_server() [%s]:%d\n", - CORE_ADDR(snode->list, buf), CORE_PORT(snode->list)); - - return CORE_OK; + return OGS_OK; } -status_t gtp_client(gtp_node_t *gnode) +int gtp_client(gtp_node_t *gnode) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; + ogs_assert(gnode); - d_assert(gnode, return CORE_ERROR,); + gnode->sock = ogs_udp_client(gnode->sa_list); + ogs_assert(gnode->sock); + memcpy(&gnode->conn, &gnode->sock->remote_addr, sizeof gnode->conn); - rv = udp_client(&gnode->sock, gnode->sa_list); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_info("gtp_client() [%s]:%d", + OGS_ADDR(gnode->sa_list, buf), OGS_PORT(gnode->sa_list)); - d_trace(1, "gtp_client() [%s]:%d\n", - CORE_ADDR(gnode->sa_list, buf), CORE_PORT(gnode->sa_list)); - - return CORE_OK; + return OGS_OK; } -status_t gtp_connect(sock_id ipv4, sock_id ipv6, gtp_node_t *gnode) +int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode) { - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; + ogs_sockaddr_t *addr; + char buf[OGS_ADDRSTRLEN]; - d_assert(ipv4 || ipv6, return CORE_ERROR,); - d_assert(gnode, return CORE_ERROR,); - d_assert(gnode->sa_list, return CORE_ERROR,); + ogs_assert(ipv4 || ipv6); + ogs_assert(gnode); + ogs_assert(gnode->sa_list); addr = gnode->sa_list; while(addr) { - sock_id id; + ogs_sock_t *sock = NULL; - if (addr->c_sa_family == AF_INET) id = ipv4; - else if (addr->c_sa_family == AF_INET6) id = ipv6; + if (addr->c_sa_family == AF_INET) sock = ipv4; + else if (addr->c_sa_family == AF_INET6) sock = ipv6; else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - if (id) + if (sock) { - if (sock_connect(id, addr) == CORE_OK) - { - d_trace(1, "gtp_connect() [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); + ogs_info("gtp_connect() [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); - gnode->sock = id; - break; - } + gnode->sock = sock; + memcpy(&gnode->conn, addr, sizeof gnode->conn); + break; } addr = addr->next; @@ -81,183 +86,176 @@ status_t gtp_connect(sock_id ipv4, sock_id ipv6, gtp_node_t *gnode) if (addr == NULL) { - d_warn("gtp_connect() [%s]:%d failed(%d:%s)", - CORE_ADDR(gnode->sa_list, buf), CORE_PORT(gnode->sa_list), - errno, strerror(errno)); - return CORE_ERROR; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, + "gtp_connect() [%s]:%d failed", + OGS_ADDR(gnode->sa_list, buf), OGS_PORT(gnode->sa_list)); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t gtp_server_list(list_t *list, sock_handler handler) +ogs_sock_t *gtp_local_sock_first(ogs_list_t *list) { - status_t rv; - sock_node_t *snode = NULL; + ogs_socknode_t *snode = NULL; - d_assert(list, return CORE_ERROR,); - d_assert(handler, return CORE_ERROR,); - - for (snode = list_first(list); snode; snode = list_next(snode)) + ogs_assert(list); + ogs_list_for_each(list, snode) { - rv = gtp_server(snode, handler); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - - return CORE_OK; -} - -sock_id gtp_local_sock_first(list_t *list) -{ - sock_node_t *snode = NULL; - sock_id sock = 0; - - d_assert(list, return 0,); - - for (snode = list_first(list); snode; snode = list_next(snode)) - { - sock = snode->sock; - if (sock) return sock; - } - - return 0; -} - -c_sockaddr_t *gtp_local_addr_first(list_t *list) -{ - sock_node_t *snode = NULL; - c_sockaddr_t *addr = NULL; - - d_assert(list, return NULL,); - - for (snode = list_first(list); snode; snode = list_next(snode)) - { - addr = sock_local_addr(snode->sock); - if (addr) return addr; + if (snode->sock) + return snode->sock; } return NULL; } -status_t gtp_recv(sock_id sock, pkbuf_t **pkbuf) +ogs_sockaddr_t *gtp_local_addr_first(ogs_list_t *list) +{ + ogs_socknode_t *snode = NULL; + + ogs_assert(list); + ogs_list_for_each(list, snode) + { + ogs_sock_t *sock = snode->sock; + ogs_assert(snode->sock); + + return &sock->local_addr; + } + + return NULL; +} + +int gtp_recv(ogs_socket_t fd, ogs_pkbuf_t **pkbuf) { ssize_t size; - d_assert(sock, return CORE_ERROR,); + ogs_assert(fd != INVALID_SOCKET); - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); +#if DEPRECATED if ((*pkbuf) == NULL) { char tmp_buf[MAX_SDU_LEN]; - d_fatal("Can't allocate pkbuf"); + ogs_error("Can't allocate pkbuf"); /* Read data from socket to exit from select */ - core_recv(sock, tmp_buf, MAX_SDU_LEN, 0); + ogs_recv(fd, tmp_buf, MAX_SDU_LEN, 0); - return CORE_ERROR; + return OGS_ERROR; } +#endif + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN); - size = core_recv(sock, (*pkbuf)->payload, (*pkbuf)->len, 0); + size = ogs_recv(fd, (*pkbuf)->data, (*pkbuf)->len, 0); if (size <= 0) { - pkbuf_free((*pkbuf)); + ogs_pkbuf_free((*pkbuf)); + ogs_error("ogs_recv failed"); - if (errno != EAGAIN) - { - d_warn("net_read failed(%d:%s)", errno, strerror(errno)); - } - - return CORE_ERROR; + return OGS_ERROR; } else { - (*pkbuf)->len = size; + ogs_pkbuf_trim(*pkbuf, size); - return CORE_OK;; + return OGS_OK;; } } -status_t gtp_recvfrom(sock_id sock, pkbuf_t **pkbuf, c_sockaddr_t *from) +int gtp_recvfrom(ogs_socket_t fd, ogs_pkbuf_t **pkbuf, ogs_sockaddr_t *from) { ssize_t size; - d_assert(sock, return CORE_ERROR,); - d_assert(from, return CORE_ERROR,); + ogs_assert(fd != INVALID_SOCKET); + ogs_assert(from); - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); +#if DEPRECATED if ((*pkbuf) == NULL) { char tmp_buf[MAX_SDU_LEN]; - d_fatal("Can't allocate pkbuf"); + ogs_error("Can't allocate pkbuf"); /* Read data from socket to exit from select */ - core_recv(sock, tmp_buf, MAX_SDU_LEN, 0); + ogs_recv(fd, tmp_buf, MAX_SDU_LEN, 0); - return CORE_ERROR; + return OGS_ERROR; } +#endif + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN); - size = core_recvfrom(sock, (*pkbuf)->payload, (*pkbuf)->len, 0, from); + size = ogs_recvfrom(fd, (*pkbuf)->data, (*pkbuf)->len, 0, from); if (size <= 0) { - pkbuf_free((*pkbuf)); + ogs_pkbuf_free((*pkbuf)); + ogs_error("ogs_recvfrom() failed"); - if (errno != EAGAIN) - { - d_warn("core_recv failed(%d:%s)", errno, strerror(errno)); - } - - return CORE_ERROR; + return OGS_ERROR; } else { - (*pkbuf)->len = size; + ogs_pkbuf_trim(*pkbuf, size); - return CORE_OK;; + return OGS_OK;; } } -status_t gtp_send(gtp_node_t *gnode, pkbuf_t *pkbuf) +int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf) { - char buf[CORE_ADDRSTRLEN]; ssize_t sent; - sock_id sock = 0; - c_sockaddr_t *addr = NULL; + ogs_sock_t *sock = NULL; - d_assert(gnode, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); + ogs_assert(gnode); + ogs_assert(pkbuf); sock = gnode->sock; - d_assert(sock, return CORE_ERROR, "Null param"); + ogs_assert(sock); - /* New interface */ - sock = gnode->sock; - d_assert(sock, return CORE_ERROR,); - addr = sock_remote_addr(sock); - d_assert(addr, return CORE_ERROR,); - - sent = core_send(sock, pkbuf->payload, pkbuf->len, 0); + sent = ogs_send(sock->fd, pkbuf->data, pkbuf->len, 0); if (sent < 0 || sent != pkbuf->len) { - d_error("core_send [%s]:%d failed(%d:%s)", - CORE_ADDR(addr, buf), CORE_PORT(addr), errno, strerror(errno)); - return CORE_ERROR; + ogs_error("ogs_send() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -pkbuf_t *gtp_handle_echo_req(pkbuf_t *pkb) +int gtp_sendto(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf) +{ + ssize_t sent; + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *conn = NULL; + + ogs_assert(gnode); + ogs_assert(pkbuf); + sock = gnode->sock; + ogs_assert(sock); + conn = &gnode->conn; + ogs_assert(conn); + + sent = ogs_sendto(sock->fd, pkbuf->data, pkbuf->len, 0, conn); + if (sent < 0 || sent != pkbuf->len) + { + ogs_error("ogs_send() failed"); + return OGS_ERROR; + } + + return OGS_OK; +} + +ogs_pkbuf_t *gtp_handle_echo_req(ogs_pkbuf_t *pkb) { gtp_header_t *gtph = NULL; - pkbuf_t *pkb_resp;NULL; - gtp_header_t *gtph_resp;NULL; - c_uint16_t length; + ogs_pkbuf_t *pkb_resp = NULL; + gtp_header_t *gtph_resp = NULL; + uint16_t length; int idx; - d_assert(pkb, return NULL, "pkt is NULL"); + ogs_assert(pkb); - gtph = (gtp_header_t *)pkb->payload; + gtph = (gtp_header_t *)pkb->data; /* Check GTP version. Now only support GTPv1(version = 1) */ if ((gtph->flags >> 5) != 1) { @@ -270,9 +268,10 @@ pkbuf_t *gtp_handle_echo_req(pkbuf_t *pkb) } - pkb_resp = pkbuf_alloc(0, 100 /* enough for ECHO_RSP; use smaller buffer */); - d_assert(pkb_resp, return NULL, "Can't allocate pkbuf"); - gtph_resp = (gtp_header_t *)pkb_resp->payload; + pkb_resp = ogs_pkbuf_alloc(NULL, + 100 /* enough for ECHO_RSP; use smaller buffer */); + ogs_pkbuf_put(pkb_resp, 100); + gtph_resp = (gtp_header_t *)pkb_resp->data; /* reply back immediately */ gtph_resp->flags = (1 << 5); /* set version */ @@ -290,37 +289,38 @@ pkbuf_t *gtp_handle_echo_req(pkbuf_t *pkb) { /* sequence exists */ gtph_resp->flags |= GTPU_FLAGS_S; - *((c_uint8_t *)pkb_resp->payload + idx) = *((c_uint8_t *)pkb->payload + idx); - *((c_uint8_t *)pkb_resp->payload + idx + 1) = *((c_uint8_t *)pkb->payload + idx + 1); + *((uint8_t *)pkb_resp->data + idx) = *((uint8_t *)pkb->data + idx); + *((uint8_t *)pkb_resp->data + idx + 1) = + *((uint8_t *)pkb->data + idx + 1); } else { - *((c_uint8_t *)pkb_resp->payload + idx) = 0; - *((c_uint8_t *)pkb_resp->payload + idx + 1) = 0; + *((uint8_t *)pkb_resp->data + idx) = 0; + *((uint8_t *)pkb_resp->data + idx + 1) = 0; } idx += 2; if (gtph->flags & GTPU_FLAGS_PN) { /* sequence exists */ gtph_resp->flags |= GTPU_FLAGS_PN; - *((c_uint8_t *)pkb_resp->payload + idx) = *((c_uint8_t *)pkb->payload + idx); + *((uint8_t *)pkb_resp->data + idx) = *((uint8_t *)pkb->data + idx); } else { - *((c_uint8_t *)pkb_resp->payload + idx) = 0; + *((uint8_t *)pkb_resp->data + idx) = 0; } idx++; - *((c_uint8_t *)pkb_resp->payload + idx) = 0; /* next-extension header */ + *((uint8_t *)pkb_resp->data + idx) = 0; /* next-extension header */ idx++; } /* fill Recovery IE */ length += 2; - *((c_uint8_t *)pkb_resp->payload + idx) = 14; idx++; /* type */ - *((c_uint8_t *)pkb_resp->payload + idx) = 0; idx++; /* restart counter */ + *((uint8_t *)pkb_resp->data + idx) = 14; idx++; /* type */ + *((uint8_t *)pkb_resp->data + idx) = 0; idx++; /* restart counter */ gtph_resp->length = htons(length); - pkb_resp->len = idx; /* buffer length */ + ogs_pkbuf_trim(pkb_resp, idx); /* buffer length */ return pkb_resp; } diff --git a/lib/gtp/gtp_path.h b/lib/gtp/gtp_path.h index 95a69f2dd..90eec3887 100644 --- a/lib/gtp/gtp_path.h +++ b/lib/gtp/gtp_path.h @@ -1,31 +1,45 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GTP_PATH_H__ #define __GTP_PATH_H__ -#include "core_pkbuf.h" -#include "core_network.h" - typedef struct _gtp_node_t gtp_node_t; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) gtp_server(sock_node_t *snode, sock_handler handler); -CORE_DECLARE(status_t) gtp_client(gtp_node_t *gnode); -CORE_DECLARE(status_t) gtp_connect( - sock_id ipv4, sock_id ipv6, gtp_node_t *gnode); +int gtp_server(ogs_socknode_t *snode); +int gtp_client(gtp_node_t *gnode); +int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode); -CORE_DECLARE(status_t) gtp_server_list(list_t *list, sock_handler handler); +ogs_sock_t *gtp_local_sock_first(ogs_list_t *list); +ogs_sockaddr_t *gtp_local_addr_first(ogs_list_t *list); -CORE_DECLARE(sock_id) gtp_local_sock_first(list_t *list); -CORE_DECLARE(c_sockaddr_t *) gtp_local_addr_first(list_t *list); +int gtp_recv(ogs_socket_t fd, ogs_pkbuf_t **pkbuf); +int gtp_recvfrom(ogs_socket_t fd, ogs_pkbuf_t **pkbuf, ogs_sockaddr_t *from); +int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf); +int gtp_sendto(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf); -CORE_DECLARE(status_t) gtp_recv(sock_id sock, pkbuf_t **pkbuf); -CORE_DECLARE(status_t) gtp_recvfrom(sock_id sock, - pkbuf_t **pkbuf, c_sockaddr_t *from); -CORE_DECLARE(status_t) gtp_send(gtp_node_t *gnode, pkbuf_t *pkbuf); +ogs_pkbuf_t *gtp_handle_echo_req(ogs_pkbuf_t *pkt); -CORE_DECLARE(pkbuf_t*) gtp_handle_echo_req(pkbuf_t *pkt); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/lib/gtp/gtp_tlv.c b/lib/gtp/gtp_tlv.c new file mode 100644 index 000000000..8bcd329e4 --- /dev/null +++ b/lib/gtp/gtp_tlv.c @@ -0,0 +1,560 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gtp_tlv.h" + +tlv_desc_t tlv_desc_more1 = { TLV_MORE, "More", 0, 1, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more2 = { TLV_MORE, "More", 0, 2, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more3 = { TLV_MORE, "More", 0, 3, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more4 = { TLV_MORE, "More", 0, 4, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more5 = { TLV_MORE, "More", 0, 5, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more6 = { TLV_MORE, "More", 0, 6, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more7 = { TLV_MORE, "More", 0, 7, 0, 0, { NULL } }; +tlv_desc_t tlv_desc_more8 = { TLV_MORE, "More", 0, 8, 0, 0, { NULL } }; + +static ogs_tlv_t* tlv_add_leaf( + ogs_tlv_t *parent_tlv, ogs_tlv_t *tlv, tlv_desc_t *desc, void *msg) +{ + switch (desc->ctype) + { + case TLV_UINT8: + case TLV_INT8: + { + tlv_uint8_t *v = (tlv_uint8_t *)msg; + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 1, desc->instance, (uint8_t*)&v->u8); + else + tlv = ogs_tlv_add(tlv, + desc->type, 1, desc->instance, (uint8_t*)&v->u8); + ogs_assert(tlv); + break; + } + case TLV_UINT16: + { + tlv_uint16_t *v = (tlv_uint16_t *)msg; + + v->u16 = htons(v->u16); + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 2, desc->instance, (uint8_t*)&v->u16); + else + tlv = ogs_tlv_add(tlv, + desc->type, 2, desc->instance, (uint8_t*)&v->u16); + ogs_assert(tlv); + break; + } + case TLV_UINT24: + case TLV_INT24: + { + tlv_uint24_t *v = (tlv_uint24_t *)msg; + + v->u24 = v->u24 << 8; + v->u24 = htonl(v->u24); + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 3, desc->instance, (uint8_t*)&v->u24); + else + tlv = ogs_tlv_add(tlv, + desc->type, 3, desc->instance, (uint8_t*)&v->u24); + ogs_assert(tlv); + break; + } + case TLV_UINT32: + case TLV_INT32: + { + tlv_uint32_t *v = (tlv_uint32_t *)msg; + + v->u32 = htonl(v->u32); + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 4, desc->instance, (uint8_t*)&v->u32); + else + tlv = ogs_tlv_add(tlv, + desc->type, 4, desc->instance, (uint8_t*)&v->u32); + ogs_assert(tlv); + break; + } + case TLV_FIXED_STR: + { + tlv_octet_t *v = (tlv_octet_t *)msg; + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, desc->length, desc->instance, v->data); + else + tlv = ogs_tlv_add(tlv, + desc->type, desc->length, desc->instance, v->data); + ogs_assert(tlv); + break; + } + case TLV_VAR_STR: + { + tlv_octet_t *v = (tlv_octet_t *)msg; + + ogs_assert(v->len > 0); + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, v->len, desc->instance, v->data); + else + tlv = ogs_tlv_add(tlv, + desc->type, v->len, desc->instance, v->data); + ogs_assert(tlv); + break; + } + case TLV_NULL: + { + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 0, desc->instance, NULL); + else + tlv = ogs_tlv_add(tlv, + desc->type, 0, desc->instance, NULL); + ogs_assert(tlv); + break; + } + default: + { + ogs_assert_if_reached(); + break; + } + } + + return tlv; +} + +static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv, + tlv_desc_t *parent_desc, void *msg, int depth) +{ + tlv_presence_t *presence_p; + tlv_desc_t *desc = NULL, *next_desc = NULL; + ogs_tlv_t *tlv = NULL, *emb_tlv = NULL; + uint8_t *p = msg; + uint32_t offset = 0, count = 0; + int i, j, r; + char indent[17] = " "; /* 16 spaces */ + + ogs_assert(root); + ogs_assert(parent_desc); + ogs_assert(msg); + + ogs_assert(depth <= 8); + indent[depth*2] = 0; + + *root = NULL; + + for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL; + i++, desc = parent_desc->child_descs[i]) + { + next_desc = parent_desc->child_descs[i+1]; + if (next_desc != NULL && next_desc->ctype == TLV_MORE) + { + int offset2 = offset; + for (j = 0; j < next_desc->length; j++) + { + presence_p = (tlv_presence_t *)(p + offset2); + + if (*presence_p == 0) + break; + + if (desc->ctype == TLV_COMPOUND) + { + ogs_trace("BUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ", + indent, i, desc->name, desc->type, desc->instance, + desc->vsize, p + offset2); + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 0, desc->instance, NULL); + else + tlv = ogs_tlv_add(tlv, desc->type, 0, desc->instance, NULL); + + r = tlv_add_compound(&emb_tlv, tlv, desc, + p + offset2 + sizeof(tlv_presence_t), depth + 1); + ogs_assert(r > 0 && emb_tlv); + count += 1 + r; + } + else + { + ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d " + "(cls:%d vsz:%d) off:%p ", + indent, i, desc->name, desc->type, desc->length, + desc->instance, desc->ctype, desc->vsize, + p + offset2); + + tlv = tlv_add_leaf(parent_tlv, tlv, desc, p + offset2); + ogs_assert(tlv); + count++; + } + + if (*root == NULL) + *root = tlv; + + offset2 += desc->vsize; + } + offset += desc->vsize * next_desc->length; + i++; + } + else + { + presence_p = (tlv_presence_t *)(p + offset); + + if (*presence_p) + { + if (desc->ctype == TLV_COMPOUND) + { + ogs_trace("BUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ", + indent, i, desc->name, desc->type, desc->instance, + desc->vsize, p + offset); + + if (parent_tlv) + tlv = ogs_tlv_embed(parent_tlv, + desc->type, 0, desc->instance, NULL); + else + tlv = ogs_tlv_add(tlv, desc->type, 0, desc->instance, NULL); + + r = tlv_add_compound(&emb_tlv, tlv, desc, + p + offset + sizeof(tlv_presence_t), depth + 1); + ogs_assert(r > 0 && emb_tlv); + count += 1 + r; + } + else + { + ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d " + "(cls:%d vsz:%d) off:%p ", + indent, i, desc->name, desc->type, desc->length, + desc->instance, desc->ctype, desc->vsize, + p + offset); + + tlv = tlv_add_leaf(parent_tlv, tlv, desc, p + offset); + ogs_assert(tlv); + count++; + } + + if (*root == NULL) + *root = tlv; + } + offset += desc->vsize; + } + } + + return count; +} + +int tlv_build_msg(ogs_pkbuf_t **pkbuf, tlv_desc_t *desc, void *msg, int mode) +{ + ogs_tlv_t *root = NULL; + uint32_t r, length, rendlen; + + ogs_assert(pkbuf); + ogs_assert(desc); + ogs_assert(msg); + + ogs_assert(desc->ctype == TLV_MESSAGE); + ogs_assert(desc->child_descs[0]); + + r = tlv_add_compound(&root, NULL, desc, msg, 0); + ogs_assert(r > 0 && root); + + length = ogs_tlv_calc_length(root, mode); + *pkbuf = ogs_pkbuf_alloc(NULL, TLV_MAX_HEADROOM+length); + ogs_assert(*pkbuf); + ogs_pkbuf_reserve(*pkbuf, TLV_MAX_HEADROOM); + ogs_pkbuf_put(*pkbuf, length); + + rendlen = ogs_tlv_render(root, (*pkbuf)->data, length, mode); + ogs_assert(rendlen == length); + + ogs_tlv_free_all(root); + + return OGS_OK; +} + +static tlv_desc_t* tlv_find_desc(uint8_t *desc_index, + uint32_t *tlv_offset, tlv_desc_t *parent_desc, ogs_tlv_t *tlv) +{ + tlv_desc_t *prev_desc = NULL, *desc = NULL; + int i, offset = 0; + + ogs_assert(parent_desc); + ogs_assert(tlv); + + for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL; + i++, desc = parent_desc->child_descs[i]) + { + if (desc->type == tlv->type && desc->instance == tlv->instance) + { + *desc_index = i; + *tlv_offset = offset; + break; + } + + if (desc->ctype == TLV_MORE) + { + ogs_assert(prev_desc && prev_desc->ctype != TLV_MORE); + offset += prev_desc->vsize * (desc->length - 1); + } + else + { + offset += desc->vsize; + } + + prev_desc = desc; + } + + return desc; +} + +static int tlv_parse_leaf(void *msg, tlv_desc_t *desc, ogs_tlv_t *tlv) +{ + ogs_assert(msg); + ogs_assert(desc); + ogs_assert(tlv); + + switch (desc->ctype) + { + case TLV_UINT8: + case TLV_INT8: + { + tlv_uint8_t *v = (tlv_uint8_t *)msg; + + if (tlv->length != 1) + { + ogs_error("Invalid TLV length %d. It should be 1", tlv->length); + return OGS_ERROR; + } + v->u8 = *(uint8_t*)(tlv->value); + break; + } + case TLV_UINT16: + case TLV_INT16: + { + tlv_uint16_t *v = (tlv_uint16_t *)msg; + + if (tlv->length != 2) + { + ogs_error("Invalid TLV length %d. It should be 2", tlv->length); + return OGS_ERROR; + } + v->u16 = ((((uint8_t*)tlv->value)[0]<< 8)&0xff00) | + ((((uint8_t*)tlv->value)[1] )&0x00ff); + break; + } + case TLV_UINT24: + case TLV_INT24: + { + tlv_uint24_t *v = (tlv_uint24_t *)msg; + + if (tlv->length != 3) + { + ogs_error("Invalid TLV length %d. It should be 3", tlv->length); + return OGS_ERROR; + } + v->u24 = ((((uint8_t*)tlv->value)[0]<<16)&0x00ff0000) | + ((((uint8_t*)tlv->value)[1]<< 8)&0x0000ff00) | + ((((uint8_t*)tlv->value)[2] )&0x000000ff); + break; + } + case TLV_UINT32: + case TLV_INT32: + { + tlv_uint32_t *v = (tlv_uint32_t *)msg; + + if (tlv->length != 4) + { + ogs_error("Invalid TLV length %d. It should be 4", tlv->length); + return OGS_ERROR; + } + v->u32 = ((((uint8_t*)tlv->value)[0]<<24)&0xff000000) | + ((((uint8_t*)tlv->value)[1]<<16)&0x00ff0000) | + ((((uint8_t*)tlv->value)[2]<< 8)&0x0000ff00) | + ((((uint8_t*)tlv->value)[3] )&0x000000ff); + break; + } + case TLV_FIXED_STR: + { + tlv_octet_t *v = (tlv_octet_t *)msg; + + if (tlv->length != desc->length) + { + ogs_error("Invalid TLV length %d. It should be %d", + tlv->length, desc->length); + return OGS_ERROR; + } + + v->data = tlv->value; + v->len = tlv->length; + break; + } + case TLV_VAR_STR: + { + tlv_octet_t *v = (tlv_octet_t *)msg; + + v->data = tlv->value; + v->len = tlv->length; + break; + } + case TLV_NULL: + { + if (tlv->length != 0) + { + ogs_error("Invalid TLV length %d. It should be 0", tlv->length); + return OGS_ERROR; + } + break; + } + default: + ogs_assert_if_reached(); + break; + } + + return OGS_OK; +} + +static int tlv_parse_compound(void *msg, tlv_desc_t *parent_desc, + ogs_tlv_t *parent_tlv, int depth, int mode) +{ + int rv; + tlv_presence_t *presence_p = (tlv_presence_t *)msg; + tlv_desc_t *desc = NULL, *next_desc = NULL; + ogs_tlv_t *tlv = NULL, *emb_tlv = NULL; + uint8_t *p = msg; + uint32_t offset = 0; + uint8_t index = 0; + int i = 0, j; + char indent[17] = " "; /* 16 spaces */ + + ogs_assert(msg); + ogs_assert(parent_desc); + ogs_assert(parent_tlv); + + ogs_assert(depth <= 8); + indent[depth*2] = 0; + + tlv = parent_tlv; + while(tlv) + { + desc = tlv_find_desc(&index, &offset, parent_desc, tlv); + if (desc == NULL) + { + ogs_error("Unexpected TLV type:%d", tlv->type); + return OGS_ERROR; + } + + presence_p = (tlv_presence_t *)(p + offset); + + /* Multiple of the same type TLV may be included */ + next_desc = parent_desc->child_descs[index+1]; + if (next_desc != NULL && next_desc->ctype == TLV_MORE) + { + for (j = 0; j < next_desc->length; j++) + { + presence_p = (tlv_presence_t *)(p + offset + desc->vsize * j); + if (*presence_p == 0) + { + offset += desc->vsize * j; + break; + } + } + if (j == next_desc->length) + { + ogs_fatal("Multiple of the same type TLV need more room"); + ogs_assert_if_reached(); + tlv = tlv->next; + continue; + } + } + + if (desc->ctype == TLV_COMPOUND) + { + emb_tlv = ogs_tlv_parse_embedded_block(tlv, mode); + if (emb_tlv == NULL) + { + ogs_error("Error while parse TLV"); + return OGS_ERROR; + } + + ogs_trace("PARSE %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ", + indent, i++, desc->name, desc->type, desc->instance, + desc->vsize, p + offset); + + offset += sizeof(tlv_presence_t); + + rv = tlv_parse_compound( + p + offset, desc, emb_tlv, depth + 1, mode); + if (rv != OGS_OK) + { + ogs_error("Can't parse compound TLV"); + return OGS_ERROR; + } + + *presence_p = 1; + } + else + { + ogs_trace("PARSE %sL#%d [%s] T:%d L:%d I:%d " + "(cls:%d vsz:%d) off:%p ", + indent, i++, desc->name, desc->type, desc->length, + desc->instance, desc->ctype, desc->vsize, p + offset); + + rv = tlv_parse_leaf(p + offset, desc, tlv); + if (rv != OGS_OK) + { + ogs_error("Can't parse leaf TLV"); + return OGS_ERROR; + } + + *presence_p = 1; + } + + tlv = tlv->next; + } + + return OGS_OK; +} + +int tlv_parse_msg(void *msg, tlv_desc_t *desc, ogs_pkbuf_t *pkbuf, int mode) +{ + int rv; + ogs_tlv_t *root; + + ogs_assert(msg); + ogs_assert(desc); + ogs_assert(pkbuf); + + ogs_assert(desc->ctype == TLV_MESSAGE); + ogs_assert(desc->child_descs[0]); + + root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, mode); + if (root == NULL) + { + ogs_error("Can't parse TLV message"); + return OGS_ERROR; + } + + rv = tlv_parse_compound(msg, desc, root, 0, mode); + + ogs_tlv_free_all(root); + + return rv; +} diff --git a/lib/core/include/core_tlv_msg.h b/lib/gtp/gtp_tlv.h similarity index 60% rename from lib/core/include/core_tlv_msg.h rename to lib/gtp/gtp_tlv.h index e5dcc3f40..3d255f5dc 100644 --- a/lib/core/include/core_tlv_msg.h +++ b/lib/gtp/gtp_tlv.h @@ -1,8 +1,26 @@ -#ifndef __TLV_MSG_H__ -#define __TLV_MSG_H__ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "core_tlv.h" -#include "core_pkbuf.h" +#ifndef __GTP_TLV_H__ +#define __GTP_TLV_H__ + +#include "ogs-core.h" #ifdef __cplusplus extern "C" { @@ -34,11 +52,11 @@ typedef enum { typedef struct _tlv_desc_t { tlv_type_e ctype; - c_int8_t *name; - c_uint16_t type; - c_uint16_t length; - c_uint8_t instance; - c_uint16_t vsize; + char *name; + uint16_t type; + uint16_t length; + uint8_t instance; + uint16_t vsize; void *child_descs[TLV_MAX_CHILD_DESC]; } tlv_desc_t; @@ -51,63 +69,63 @@ extern tlv_desc_t tlv_desc_more6; extern tlv_desc_t tlv_desc_more7; extern tlv_desc_t tlv_desc_more8; -typedef c_uint64_t tlv_presence_t; +typedef uint64_t tlv_presence_t; /* 8-bit Unsigned integer */ typedef struct _tlv_uint8_t { tlv_presence_t presence; - c_uint8_t u8; + uint8_t u8; } tlv_uint8_t; /* 16-bit Unsigned integer */ typedef struct _tlv_uint16_t { tlv_presence_t presence; - c_uint16_t u16; + uint16_t u16; } tlv_uint16_t; /* 24-bit Unsigned integer */ typedef struct _tlv_uint24_t { tlv_presence_t presence; - c_uint32_t u24; /* Only 3 bytes valid */ + uint32_t u24; /* Only 3 bytes valid */ } tlv_uint24_t; /* 32-bit Unsigned integer */ typedef struct _tlv_uint32_t { tlv_presence_t presence; - c_uint32_t u32; + uint32_t u32; } tlv_uint32_t; /* 8-bit Signed integer */ typedef struct _tlv_int8_t { tlv_presence_t presence; - c_int8_t i8; + int8_t i8; } tlv_int8_t; /* 16-bit Signed integer */ typedef struct _tlv_int16t { tlv_presence_t presence; - c_int16_t i16; + int16_t i16; } tlv_int16_t; /* 24-bit Signed integer */ typedef struct _tlv_int24_t { tlv_presence_t presence; - c_int32_t i24; /* Only 3 bytes valid */ + int32_t i24; /* Only 3 bytes valid */ } tlv_int24_t; /* 32-bit Signed integer */ typedef struct _tlv_int32_t { tlv_presence_t presence; - c_int32_t i32; + int32_t i32; } tlv_int32_t; /* Octets */ #define TLV_CLEAR_DATA(__dATA) \ do { \ - d_assert((__dATA), , "Null param"); \ + ogs_assert((__dATA)); \ if ((__dATA)->data) \ { \ - CORE_FREE((__dATA)->data); \ + ogs_free((__dATA)->data); \ (__dATA)->data = NULL; \ (__dATA)->len = 0; \ (__dATA)->presence = 0; \ @@ -115,19 +133,19 @@ typedef struct _tlv_int32_t { } while(0) #define TLV_STORE_DATA(__dST, __sRC) \ do { \ - d_assert((__sRC),, "Null param") \ - d_assert((__sRC)->data,, "Null param") \ - d_assert((__dST),, "Null param") \ + ogs_assert((__sRC)); \ + ogs_assert((__sRC)->data); \ + ogs_assert((__dST)); \ TLV_CLEAR_DATA(__dST); \ (__dST)->presence = (__sRC)->presence; \ (__dST)->len = (__sRC)->len; \ - (__dST)->data = core_calloc((__dST)->len, sizeof(c_uint8_t)); \ + (__dST)->data = ogs_calloc((__dST)->len, sizeof(uint8_t)); \ memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \ } while(0) typedef struct _tlv_octet_t { tlv_presence_t presence; void *data; - c_uint32_t len; + uint32_t len; } tlv_octet_t; /* No value */ @@ -135,14 +153,12 @@ typedef struct _tlv_null { tlv_presence_t presence; } tlv_null_t; -CORE_DECLARE(status_t) tlv_build_msg( - pkbuf_t **pkbuf, tlv_desc_t *desc, void *msg, int mode); +int tlv_build_msg(ogs_pkbuf_t **pkbuf, tlv_desc_t *desc, void *msg, int mode); -CORE_DECLARE(status_t) tlv_parse_msg( - void *msg, tlv_desc_t *desc, pkbuf_t *pkbuf, int mode); +int tlv_parse_msg(void *msg, tlv_desc_t *desc, ogs_pkbuf_t *pkbuf, int mode); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __TLV_MSG_H__ */ +#endif /* __GTP_TLV_H__ */ diff --git a/lib/gtp/gtp_types.c b/lib/gtp/gtp_types.c index 31f9a9640..94ae0579a 100644 --- a/lib/gtp/gtp_types.c +++ b/lib/gtp/gtp_types.c @@ -1,34 +1,22 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ -#define TRACE_MODULE _gtptypes - -#include "core_debug.h" -#include "core_lib.h" -#include "core_network.h" - #include "gtp_types.h" #include "gtp_message.h" @@ -36,15 +24,15 @@ * 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 */ /* 8.15 Bearer Quality of Service (Bearer QoS) */ -c_int16_t gtp_parse_bearer_qos( +int16_t gtp_parse_bearer_qos( gtp_bearer_qos_t *bearer_qos, tlv_octet_t *octet) { gtp_bearer_qos_t *source = (gtp_bearer_qos_t *)octet->data; - c_int16_t size = 0; + int16_t size = 0; - d_assert(bearer_qos, return -1, "Null param"); - d_assert(octet, return -1, "Null param"); - d_assert(octet->len == GTP_BEARER_QOS_LEN, return -1, "Null param"); + ogs_assert(bearer_qos); + ogs_assert(octet); + ogs_assert(octet->len == GTP_BEARER_QOS_LEN); memset(bearer_qos, 0, sizeof(gtp_bearer_qos_t)); @@ -56,29 +44,29 @@ c_int16_t gtp_parse_bearer_qos( bearer_qos->qci = source->qci; size++; - bearer_qos->ul_mbr = core_buffer_to_uint64(octet->data + size, 5); + bearer_qos->ul_mbr = ogs_buffer_to_uint64(octet->data + size, 5); size += 5; - bearer_qos->dl_mbr = core_buffer_to_uint64(octet->data + size, 5); + bearer_qos->dl_mbr = ogs_buffer_to_uint64(octet->data + size, 5); size += 5; - bearer_qos->ul_gbr = core_buffer_to_uint64(octet->data + size, 5); + bearer_qos->ul_gbr = ogs_buffer_to_uint64(octet->data + size, 5); size += 5; - bearer_qos->dl_gbr = core_buffer_to_uint64(octet->data + size, 5); + bearer_qos->dl_gbr = ogs_buffer_to_uint64(octet->data + size, 5); size += 5; - d_assert(size == octet->len, return -1, "decode error"); + ogs_assert(size == octet->len); return size; } -c_int16_t gtp_build_bearer_qos( +int16_t gtp_build_bearer_qos( tlv_octet_t *octet, gtp_bearer_qos_t *bearer_qos, void *data, int data_len) { gtp_bearer_qos_t target; - c_int16_t size = 0; + int16_t size = 0; - d_assert(bearer_qos, return -1, "Null param"); - d_assert(octet, return -1, "Null param"); - d_assert(data, return -1, "Null param"); - d_assert(data_len >= GTP_BEARER_QOS_LEN, return -1, "Null param"); + ogs_assert(bearer_qos); + ogs_assert(octet); + ogs_assert(data); + ogs_assert(data_len >= GTP_BEARER_QOS_LEN); octet->data = data; memcpy(&target, bearer_qos, sizeof(gtp_bearer_qos_t)); @@ -86,13 +74,13 @@ c_int16_t gtp_build_bearer_qos( memcpy(octet->data + size, &target, 2); size += 2; - core_uint64_to_buffer(target.ul_mbr, 5, octet->data + size); + ogs_uint64_to_buffer(target.ul_mbr, 5, octet->data + size); size += 5; - core_uint64_to_buffer(target.dl_mbr, 5, octet->data + size); + ogs_uint64_to_buffer(target.dl_mbr, 5, octet->data + size); size += 5; - core_uint64_to_buffer(target.ul_gbr, 5, octet->data + size); + ogs_uint64_to_buffer(target.ul_gbr, 5, octet->data + size); size += 5; - core_uint64_to_buffer(target.dl_gbr, 5, octet->data + size); + ogs_uint64_to_buffer(target.dl_gbr, 5, octet->data + size); size += 5; octet->len = size; @@ -102,52 +90,46 @@ c_int16_t gtp_build_bearer_qos( /* 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT) * See subclause 10.5.6.12 in 3GPP TS 24.008 [13]. */ -c_int16_t gtp_build_tft( +int16_t gtp_build_tft( tlv_octet_t *octet, gtp_tft_t *tft, void *data, int data_len) { gtp_tft_t target; - c_uint16_t size = 0; + uint16_t size = 0; int i, j; - d_assert(tft, return -1, "Null param"); - d_assert(octet, return -1, "Null param"); - d_assert(data, return -1, "Null param"); - d_assert(data_len >= GTP_MAX_TRAFFIC_FLOW_TEMPLATE, - return -1, "Null param"); + ogs_assert(tft); + ogs_assert(octet); + ogs_assert(data); + ogs_assert(data_len >= GTP_MAX_TRAFFIC_FLOW_TEMPLATE); octet->data = data; memcpy(&target, tft, sizeof(gtp_tft_t)); - d_assert(size + sizeof(target.flags) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.flags) <= data_len); memcpy(octet->data + size, &target.flags, sizeof(target.flags)); size += sizeof(target.flags); for (i = 0; i < target.num_of_packet_filter; i++) { - d_assert(size + sizeof(target.pf[i].flags) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.pf[i].flags) <= data_len); memcpy(octet->data + size, &target.pf[i].flags, sizeof(target.pf[i].flags)); size += sizeof(target.pf[i].flags); - d_assert(size + sizeof(target.pf[i].precedence) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.pf[i].precedence) <= data_len); memcpy(octet->data + size, &target.pf[i].precedence, sizeof(target.pf[i].precedence)); size += sizeof(target.pf[i].precedence); - d_assert(size + sizeof(target.pf[i].length) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.pf[i].length) <= data_len); memcpy(octet->data + size, &target.pf[i].length, sizeof(target.pf[i].length)); size += sizeof(target.pf[i].length); for (j = 0; j < target.pf[i].num_of_component; j++) { - d_assert(size + - sizeof(target.pf[i].component[j].type) <= data_len, - return -1, "encode error"); + ogs_assert(size + + sizeof(target.pf[i].component[j].type) <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].type, sizeof(target.pf[i].component[j].type)); size += sizeof(target.pf[i].component[j].type); @@ -155,9 +137,8 @@ c_int16_t gtp_build_tft( { case GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE: { - d_assert(size + - sizeof(target.pf[i].component[j].proto) <= data_len, - return -1, "encode error"); + ogs_assert(size + + sizeof(target.pf[i].component[j].proto) <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].proto, sizeof(target.pf[i].component[j].proto)); size += sizeof(target.pf[i].component[j].proto); @@ -165,19 +146,17 @@ c_int16_t gtp_build_tft( } case GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE: case GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE: - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].ipv4.addr) - <= data_len, - return -1, "encode error"); + <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].ipv4.addr, sizeof(target.pf[i].component[j].ipv4.addr)); size += sizeof(target.pf[i].component[j].ipv4.addr); - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].ipv4.mask) - <= data_len, - return -1, "encode error"); + <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].ipv4.mask, sizeof(target.pf[i].component[j].ipv4.mask)); @@ -185,38 +164,34 @@ c_int16_t gtp_build_tft( break; case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE: case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE: - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].ipv6.addr) - <= data_len, - return -1, "encode error"); + <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].ipv6.addr, sizeof(target.pf[i].component[j].ipv6.addr)); size += sizeof(target.pf[i].component[j].ipv6.addr); - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].ipv6.prefixlen) - <= data_len, - return -1, "encode error"); + <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].ipv6.prefixlen, sizeof(target.pf[i].component[j].ipv6.prefixlen)); size += sizeof(target.pf[i].component[j].ipv6.prefixlen); break; case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE: - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].ipv6_mask.addr) - <= data_len, - return -1, "encode error"); + <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].ipv6_mask.addr, sizeof(target.pf[i].component[j].ipv6_mask.addr)); size += sizeof(target.pf[i].component[j].ipv6_mask.addr); - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].ipv6_mask.mask) - <= data_len, - return -1, "encode error"); + <= data_len); memcpy(octet->data + size, &target.pf[i].component[j].ipv6_mask.mask, sizeof(target.pf[i].component[j].ipv6_mask.mask)); @@ -224,10 +199,9 @@ c_int16_t gtp_build_tft( break; case GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE: case GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE: - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].port.low) - <= data_len, - return -1, "encode error"); + <= data_len); target.pf[i].component[j].port.low = htons(target.pf[i].component[j].port.low); memcpy(octet->data + size, @@ -238,10 +212,9 @@ c_int16_t gtp_build_tft( case GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE: case GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE: - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].port.low) - <= data_len, - return -1, "encode error"); + <= data_len); target.pf[i].component[j].port.low = htons(target.pf[i].component[j].port.low); memcpy(octet->data + size, @@ -249,10 +222,9 @@ c_int16_t gtp_build_tft( sizeof(target.pf[i].component[j].port.low)); size += sizeof(target.pf[i].component[j].port.low); - d_assert(size + + ogs_assert(size + sizeof(target.pf[i].component[j].port.high) - <= data_len, - return -1, "encode error"); + <= data_len); target.pf[i].component[j].port.high = htons(target.pf[i].component[j].port.high); memcpy(octet->data + size, @@ -261,7 +233,7 @@ c_int16_t gtp_build_tft( size += sizeof(target.pf[i].component[j].port.high); break; default: - d_error("Unknown Packet Filter Type(%d)", + ogs_error("Unknown Packet Filter Type(%d)", target.pf[i].component[j].type); return -1; } @@ -276,13 +248,13 @@ c_int16_t gtp_build_tft( /* 8.21 User Location Information (ULI) */ -c_int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet) +int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet) { gtp_uli_t *source = (gtp_uli_t *)octet->data; - c_int16_t size = 0; + int16_t size = 0; - d_assert(uli, return -1, "Null param"); - d_assert(octet, return -1, "Null param"); + ogs_assert(uli); + ogs_assert(octet); memset(uli, 0, sizeof(gtp_uli_t)); @@ -291,8 +263,7 @@ c_int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet) if (uli->flags.cgi) { - d_assert(size + sizeof(uli->cgi) <= octet->len, - return -1, "decode error"); + ogs_assert(size + sizeof(uli->cgi) <= octet->len); memcpy(&uli->cgi, octet->data + size, sizeof(uli->cgi)); uli->cgi.lac = ntohs(uli->cgi.lac); uli->cgi.ci = ntohs(uli->cgi.ci); @@ -300,8 +271,7 @@ c_int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet) } if (uli->flags.sai) { - d_assert(size + sizeof(uli->sai) <= octet->len, - return -1, "decode error"); + ogs_assert(size + sizeof(uli->sai) <= octet->len); memcpy(&uli->sai, octet->data + size, sizeof(uli->sai)); uli->sai.lac = ntohs(uli->sai.lac); uli->sai.sac = ntohs(uli->sai.sac); @@ -309,8 +279,7 @@ c_int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet) } if (uli->flags.rai) { - d_assert(size + sizeof(uli->rai) <= octet->len, - return -1, "decode error"); + ogs_assert(size + sizeof(uli->rai) <= octet->len); memcpy(&uli->rai, octet->data + size, sizeof(uli->rai)); uli->rai.lac = ntohs(uli->rai.lac); uli->rai.rac = ntohs(uli->rai.rac); @@ -318,56 +287,51 @@ c_int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet) } if (uli->flags.tai) { - d_assert(size + sizeof(uli->tai) <= octet->len, - return -1, "decode error"); + ogs_assert(size + sizeof(uli->tai) <= octet->len); memcpy(&uli->tai, octet->data + size, sizeof(uli->tai)); uli->tai.tac = ntohs(uli->tai.tac); size += sizeof(uli->tai); } if (uli->flags.e_cgi) { - d_assert(size + sizeof(uli->e_cgi) <= octet->len, - return -1, "decode error"); + ogs_assert(size + sizeof(uli->e_cgi) <= octet->len); memcpy(&uli->e_cgi, octet->data + size, sizeof(uli->e_cgi)); uli->e_cgi.cell_id = ntohl(uli->e_cgi.cell_id); size += sizeof(uli->e_cgi); } if (uli->flags.lai) { - d_assert(size + sizeof(uli->lai) <= octet->len, - return -1, "decode error"); + ogs_assert(size + sizeof(uli->lai) <= octet->len); memcpy(&uli->lai, octet->data + size, sizeof(uli->lai)); uli->lai.lac = ntohs(uli->lai.lac); size += sizeof(uli->lai); } - d_assert(size == octet->len, return -1, "decode error"); + ogs_assert(size == octet->len); return size; } -c_int16_t gtp_build_uli( +int16_t gtp_build_uli( tlv_octet_t *octet, gtp_uli_t *uli, void *data, int data_len) { gtp_uli_t target; - c_int16_t size = 0; + int16_t size = 0; - d_assert(uli, return -1, "Null param"); - d_assert(octet, return -1, "Null param"); - d_assert(data, return -1, "Null param"); - d_assert(data_len, return -1, "Null param"); + ogs_assert(uli); + ogs_assert(octet); + ogs_assert(data); + ogs_assert(data_len); octet->data = data; memcpy(&target, uli, sizeof(gtp_uli_t)); - d_assert(size + sizeof(target.flags) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.flags) <= data_len); memcpy(octet->data + size, &target.flags, sizeof(target.flags)); size += sizeof(target.flags); if (target.flags.cgi) { - d_assert(size + sizeof(target.cgi) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.cgi) <= data_len); target.cgi.lac = htons(target.cgi.lac); target.cgi.ci = htons(target.cgi.ci); memcpy(octet->data + size, &target.cgi, sizeof(target.cgi)); @@ -375,8 +339,7 @@ c_int16_t gtp_build_uli( } if (target.flags.sai) { - d_assert(size + sizeof(target.sai) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.sai) <= data_len); target.sai.lac = htons(target.sai.lac); target.sai.sac = htons(target.sai.sac); memcpy(octet->data + size, &target.sai, sizeof(target.sai)); @@ -384,8 +347,7 @@ c_int16_t gtp_build_uli( } if (target.flags.rai) { - d_assert(size + sizeof(target.rai) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.rai) <= data_len); target.rai.lac = htons(target.rai.lac); target.rai.rac = htons(target.rai.rac); memcpy(octet->data + size, &target.rai, sizeof(target.rai)); @@ -393,24 +355,21 @@ c_int16_t gtp_build_uli( } if (target.flags.tai) { - d_assert(size + sizeof(target.tai) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.tai) <= data_len); target.tai.tac = htons(target.tai.tac); memcpy(octet->data + size, &target.tai, sizeof(target.tai)); size += sizeof(target.tai); } if (target.flags.e_cgi) { - d_assert(size + sizeof(target.e_cgi) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.e_cgi) <= data_len); target.e_cgi.cell_id = htonl(target.e_cgi.cell_id); memcpy(octet->data + size, &target.e_cgi, sizeof(target.e_cgi)); size += sizeof(target.e_cgi); } if (target.flags.lai) { - d_assert(size + sizeof(target.lai) <= data_len, - return -1, "encode error"); + ogs_assert(size + sizeof(target.lai) <= data_len); target.lai.lac = htons(target.lai.lac); memcpy(octet->data + size, &target.lai, sizeof(target.lai)); size += sizeof(target.lai); diff --git a/lib/gtp/gtp_types.h b/lib/gtp/gtp_types.h index c4b867620..e30586265 100644 --- a/lib/gtp/gtp_types.h +++ b/lib/gtp/gtp_types.h @@ -1,8 +1,31 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GTP_TYPES_H__ #define __GTP_TYPES_H__ -#include "core_tlv_msg.h" -#include "3gpp_types.h" +#include "base/types.h" +#include "base/context.h" +#include "gtp_tlv.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_gtp_domain typedef struct c_sockaddr_t c_sockaddr_t; @@ -90,56 +113,56 @@ extern "C" { #define GTP_CAUSE_REQUEST_REJECTED_DUE_TO_UE_CAPABILITY 127 typedef struct _gtp_cause_t { - c_uint8_t value; -ED4(c_uint8_t spare:5;, - c_uint8_t pce:1;, - c_uint8_t bce:1;, - c_uint8_t cs:1;) + uint8_t value; +ED4(uint8_t spare:5;, + uint8_t pce:1;, + uint8_t bce:1;, + uint8_t cs:1;) } __attribute__ ((packed)) gtp_cause_t; /* 8.7 Aggregate Maximum Bit Rate (AMBR) */ typedef struct _gtp_ambr_t { - c_uint32_t uplink; - c_uint32_t downlink; + uint32_t uplink; + uint32_t downlink; } __attribute__ ((packed)) gtp_ambr_t; /* 8.12 Indication */ typedef struct _gtp_indication_t { -ED8(c_uint8_t daf:1;, - c_uint8_t dtf:1;, - c_uint8_t hi:1;, - c_uint8_t dfi:1;, - c_uint8_t oi:1;, - c_uint8_t isrsi:1;, - c_uint8_t israi:1;, - c_uint8_t sgwci:1;) +ED8(uint8_t daf:1;, + uint8_t dtf:1;, + uint8_t hi:1;, + uint8_t dfi:1;, + uint8_t oi:1;, + uint8_t isrsi:1;, + uint8_t israi:1;, + uint8_t sgwci:1;) -ED8(c_uint8_t sqci:1;, - c_uint8_t uimsi:1;, - c_uint8_t cfsi:1;, - c_uint8_t crsi:1;, - c_uint8_t p:1;, - c_uint8_t pt:1;, - c_uint8_t si:1;, - c_uint8_t msv:1;) +ED8(uint8_t sqci:1;, + uint8_t uimsi:1;, + uint8_t cfsi:1;, + uint8_t crsi:1;, + uint8_t p:1;, + uint8_t pt:1;, + uint8_t si:1;, + uint8_t msv:1;) -ED8(c_uint8_t retloc:1;, - c_uint8_t pbic:1;, - c_uint8_t srni:1;, - c_uint8_t s6af:1;, - c_uint8_t s4af:1;, - c_uint8_t mbmdt:1;, - c_uint8_t israu:1;, - c_uint8_t ccrsi:1;) +ED8(uint8_t retloc:1;, + uint8_t pbic:1;, + uint8_t srni:1;, + uint8_t s6af:1;, + uint8_t s4af:1;, + uint8_t mbmdt:1;, + uint8_t israu:1;, + uint8_t ccrsi:1;) -ED8(c_uint8_t spare1:1;, - c_uint8_t spare2:1;, - c_uint8_t spare3:1;, - c_uint8_t spare4:1;, - c_uint8_t spare5:1;, - c_uint8_t csfbi:1;, - c_uint8_t clii:1;, - c_uint8_t cpsr:1;) +ED8(uint8_t spare1:1;, + uint8_t spare2:1;, + uint8_t spare3:1;, + uint8_t spare4:1;, + uint8_t spare5:1;, + uint8_t csfbi:1;, + uint8_t clii:1;, + uint8_t cpsr:1;) } __attribute__ ((packed)) gtp_indication_t; /* 8.13 Protocol Configuration Options (PCO) @@ -150,31 +173,31 @@ ED8(c_uint8_t spare1:1;, /* 8.15 Bearer Quality of Service (Bearer QoS) */ #define GTP_BEARER_QOS_LEN 22 typedef struct _gtp_bearer_qos_t { -ED5(c_uint8_t spare1:1;, +ED5(uint8_t spare1:1;, /* See 3GPP TS 29.212[29], clause 5.3.46 Pre-emption-Capability AVP. */ - c_uint8_t pre_emption_capability:1;, + uint8_t pre_emption_capability:1;, /* See 3GPP TS 29.212[29], clause 5.3.45 Priority-Level AVP. * PL encodes each priority level defined for the Priority-Level AVP * as the binary value of the priority level. */ - c_uint8_t priority_level:4;, - c_uint8_t spare2:1;, + uint8_t priority_level:4;, + uint8_t spare2:1;, /* See 3GPP TS 29.212[29], clause 5.3.47 Pre-emption-Vulnerability AVP. */ - c_uint8_t pre_emption_vulnerability:1;) - c_uint8_t qci; /* specified in 3GPP TS 23.203 [48]. */ + uint8_t pre_emption_vulnerability:1;) + uint8_t qci; /* specified in 3GPP TS 23.203 [48]. */ /* specified in 3GPP TS 36.413 [10]. */ - c_uint64_t ul_mbr; - c_uint64_t dl_mbr; - c_uint64_t ul_gbr; - c_uint64_t dl_gbr; + uint64_t ul_mbr; + uint64_t dl_mbr; + uint64_t ul_gbr; + uint64_t dl_gbr; /* NOTE : The encoding in 3GPP TS 24.301 [23] and 3GPP TS 36.413 [10] * is different from the encoding within this specification. */ } __attribute__ ((packed)) gtp_bearer_qos_t; -CORE_DECLARE(c_int16_t) gtp_parse_bearer_qos( +int16_t gtp_parse_bearer_qos( gtp_bearer_qos_t *bearer_qos, tlv_octet_t *octet); -CORE_DECLARE(c_int16_t) gtp_build_bearer_qos( +int16_t gtp_build_bearer_qos( tlv_octet_t *octet, gtp_bearer_qos_t *bearer_qos, void *data, int data_len); /* 8.17 RAT Type */ @@ -202,23 +225,23 @@ typedef struct _gtp_tft_t { #define GTP_TFT_CODE_REPLACE_PACKET_FILTERS_IN_EXISTING 4 #define GTP_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING 5 #define GTP_TFT_CODE_NO_TFT_OPERATION 6 -ED3(c_uint8_t code:3;, - c_uint8_t e_bit:1;, - c_uint8_t num_of_packet_filter:4;) +ED3(uint8_t code:3;, + uint8_t e_bit:1;, + uint8_t num_of_packet_filter:4;) }; - c_uint8_t flags; + uint8_t flags; }; struct { union { struct { - ED3(c_uint8_t spare:2;, - c_uint8_t direction:2;, - c_uint8_t identifier:4;) + ED3(uint8_t spare:2;, + uint8_t direction:2;, + uint8_t identifier:4;) }; - c_uint8_t flags; + uint8_t flags; }; - c_uint8_t precedence; - c_uint8_t length; + uint8_t precedence; + uint8_t length; #define GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48 #define GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16 #define GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17 @@ -234,68 +257,68 @@ ED3(c_uint8_t code:3;, #define GTP_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112 #define GTP_PACKET_FILTER_FLOW_LABEL_TYPE 128 struct { - c_uint8_t type; + uint8_t type; union { - c_uint8_t proto; + uint8_t proto; struct { - c_uint32_t addr; - c_uint32_t mask; + uint32_t addr; + uint32_t mask; } ipv4; struct { - c_uint32_t addr[4]; - c_uint8_t prefixlen; + uint32_t addr[4]; + uint8_t prefixlen; } ipv6; struct { - c_uint32_t addr[4]; - c_uint32_t mask[4]; + uint32_t addr[4]; + uint32_t mask[4]; } ipv6_mask; struct { - c_uint16_t low; - c_uint16_t high; + uint16_t low; + uint16_t high; } port; }; } component[GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT]; - c_uint8_t num_of_component; + uint8_t num_of_component; } pf[MAX_NUM_OF_PACKET_FILTER]; } gtp_tft_t; -CORE_DECLARE(c_int16_t) gtp_build_tft( +int16_t gtp_build_tft( tlv_octet_t *octet, gtp_tft_t *tft, void *data, int data_len); /* 8.21 User Location Information (ULI) */ #define GTP_MAX_ULI_LEN sizeof(gtp_uli_t) typedef struct _gtp_uli_cgi_t { plmn_id_t plmn_id; - c_uint16_t lac; - c_uint16_t ci; + uint16_t lac; + uint16_t ci; } __attribute__ ((packed)) gtp_uli_cgi_t; typedef struct _gtp_uli_sai_t { plmn_id_t plmn_id; - c_uint16_t lac; - c_uint16_t sac; + uint16_t lac; + uint16_t sac; } __attribute__ ((packed)) gtp_uli_sai_t; typedef struct _gtp_uli_rai_t { plmn_id_t plmn_id; - c_uint16_t lac; - c_uint16_t rac; + uint16_t lac; + uint16_t rac; } __attribute__ ((packed)) gtp_uli_rai_t; typedef struct _gtp_uli_lai_t { plmn_id_t plmn_id; - c_uint16_t lac; + uint16_t lac; } __attribute__ ((packed)) gtp_uli_lai_t; typedef struct _gtp_uli_t { struct { - ED7(c_uint8_t spare:2;, - c_uint8_t lai:1;, - c_uint8_t e_cgi:1;, - c_uint8_t tai:1;, - c_uint8_t rai:1;, - c_uint8_t sai:1;, - c_uint8_t cgi:1;) + ED7(uint8_t spare:2;, + uint8_t lai:1;, + uint8_t e_cgi:1;, + uint8_t tai:1;, + uint8_t rai:1;, + uint8_t sai:1;, + uint8_t cgi:1;) } flags; gtp_uli_cgi_t cgi; gtp_uli_sai_t sai; @@ -305,8 +328,8 @@ typedef struct _gtp_uli_t { gtp_uli_lai_t lai; } gtp_uli_t; -CORE_DECLARE(c_int16_t) gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet); -CORE_DECLARE(c_int16_t) gtp_build_uli( +int16_t gtp_parse_uli(gtp_uli_t *uli, tlv_octet_t *octet); +int16_t gtp_build_uli( tlv_octet_t *octet, gtp_uli_t *uli, void *data, int data_len); /* 8.22 Fully Qualified TEID (F-TEID) */ @@ -356,21 +379,21 @@ CORE_DECLARE(c_int16_t) gtp_build_uli( #define GTP_F_TEID_IPV6_LEN IPV6_LEN+GTP_F_TEID_HDR_LEN #define GTP_F_TEID_IPV4V6_LEN IPV4V6_LEN+GTP_F_TEID_HDR_LEN typedef struct _gtp_f_teid_t { -ED3(c_uint8_t ipv4:1;, - c_uint8_t ipv6:1;, - c_uint8_t interface_type:6;) - c_uint32_t teid; +ED3(uint8_t ipv4:1;, + uint8_t ipv6:1;, + uint8_t interface_type:6;) + uint32_t teid; union { /* GTP_F_TEID_IPV4 */ - c_uint32_t addr; + uint32_t addr; /* GTP_F_TEID_IPV6 */ - c_uint8_t addr6[IPV6_LEN]; + uint8_t addr6[IPV6_LEN]; /* GTP_F_TEID_BOTH */ struct { - c_uint32_t addr; - c_uint8_t addr6[IPV6_LEN]; + uint32_t addr; + uint8_t addr6[IPV6_LEN]; } both; }; } __attribute__ ((packed)) gtp_f_teid_t; @@ -390,9 +413,9 @@ typedef struct _gtp_ue_timezone_t { * the first bit (bit 3 of the seventh octet of * the TP-Service-Centre-Time-Stamp field) represents * the algebraic sign of this difference (0: positive, 1: negative). */ - c_uint8_t timezone; -ED2(c_uint8_t spare:6;, - c_uint8_t daylight_saving_time:2;) + uint8_t timezone; +ED2(uint8_t spare:6;, + uint8_t daylight_saving_time:2;) } __attribute__ ((packed)) gtp_ue_timezone_t; /* 8.57 APN Restriction */ diff --git a/lib/gtp/gtp_xact.c b/lib/gtp/gtp_xact.c index 386eff056..db86b58db 100644 --- a/lib/gtp/gtp_xact.c +++ b/lib/gtp/gtp_xact.c @@ -1,20 +1,32 @@ -#define TRACE_MODULE _gtp_xact -#include "core_debug.h" -#include "core_pool.h" -#include "core_event.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "3gpp_types.h" #include "gtp_message.h" #include "gtp_node.h" #include "gtp_path.h" #include "gtp_xact.h" -#define SIZE_OF_GTP_XACT_POOL 64 #define GTP_MIN_XACT_ID 1 #define GTP_MAX_XACT_ID 0x800000 -#define GTP_T3_RESPONSE_DURATION 3000 /* 3 seconds */ +#define GTP_T3_RESPONSE_DURATION ogs_time_from_sec(3) /* 3 seconds */ #define GTP_T3_RESPONSE_RETRY_COUNT 3 #define GTP_T3_DUPLICATED_DURATION \ (GTP_T3_RESPONSE_DURATION * GTP_T3_RESPONSE_RETRY_COUNT) /* 9 seconds */ @@ -28,180 +40,147 @@ typedef enum { } gtp_xact_stage_t; static int gtp_xact_initialized = 0; -static tm_service_t *g_tm_service = NULL; -static c_uintptr_t g_response_event = 0; -static c_uintptr_t g_holding_event = 0; -static c_uint32_t g_xact_id = 0; +static ogs_timer_mgr_t *g_timer_mgr = NULL; +static uint32_t g_xact_id = 0; -index_declare(gtp_xact_pool, gtp_xact_t, SIZE_OF_GTP_XACT_POOL); +static OGS_POOL(pool, gtp_xact_t); -static gtp_xact_stage_t gtp_xact_get_stage(c_uint8_t type, c_uint32_t sqn); -static status_t gtp_xact_delete(gtp_xact_t *xact); +static gtp_xact_stage_t gtp_xact_get_stage(uint8_t type, uint32_t sqn); +static int gtp_xact_delete(gtp_xact_t *xact); -status_t gtp_xact_init(tm_service_t *tm_service, - c_uintptr_t response_event, c_uintptr_t holding_event) +static void response_timeout(void *data); +static void holding_timeout(void *data); + +int gtp_xact_init(ogs_timer_mgr_t *timer_mgr) { - d_assert(gtp_xact_initialized == 0, return CORE_ERROR, - "GTP Transaction already has been initialized"); + ogs_assert(gtp_xact_initialized == 0); - index_init(>p_xact_pool, SIZE_OF_GTP_XACT_POOL); + ogs_pool_init(&pool, base_self()->gtp.xact.pool); g_xact_id = 0; - g_tm_service = tm_service; - g_response_event = response_event; - g_holding_event = holding_event; + g_timer_mgr = timer_mgr; gtp_xact_initialized = 1; - return CORE_OK; + return OGS_OK; } -status_t gtp_xact_final(void) +int gtp_xact_final(void) { - d_assert(gtp_xact_initialized == 1, return CORE_ERROR, - "GTP Transaction context already has been finalized"); + ogs_assert(gtp_xact_initialized == 1); - if (pool_used(>p_xact_pool)) - d_error("%d not freed in gtp_xact_pool[%d] of GTP Transaction", - pool_used(>p_xact_pool), pool_size(>p_xact_pool)); - d_trace(15, "%d not freed in gtp_xact_pool[%d] of GTP Transaction\n", - pool_used(>p_xact_pool), pool_size(>p_xact_pool)); - index_final(>p_xact_pool); + ogs_pool_final(&pool); gtp_xact_initialized = 0; - return CORE_OK; + return OGS_OK; } gtp_xact_t *gtp_xact_local_create( - gtp_node_t *gnode, gtp_header_t *hdesc, pkbuf_t *pkbuf) + gtp_node_t *gnode, gtp_header_t *hdesc, ogs_pkbuf_t *pkbuf) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; gtp_xact_t *xact = NULL; - d_assert(gnode, return NULL, "Null param"); + ogs_assert(gnode); - index_alloc(>p_xact_pool, &xact); - d_assert(xact, return NULL, "Transaction allocation failed"); + ogs_pool_alloc(&pool, &xact); + ogs_assert(xact); + memset(xact, 0, sizeof *xact); + xact->index = ogs_pool_index(&pool, xact); xact->org = GTP_LOCAL_ORIGINATOR; xact->xid = NEXT_ID(g_xact_id, GTP_MIN_XACT_ID, GTP_MAX_XACT_ID); xact->gnode = gnode; - if (g_response_event) - { - xact->tm_response = timer_create(g_tm_service, - g_response_event, GTP_T3_RESPONSE_DURATION); - d_assert(xact->tm_response, return NULL, "Timer allocation failed"); - timer_set_param1(xact->tm_response, xact->index); - xact->response_rcount = GTP_T3_RESPONSE_RETRY_COUNT; - } + xact->tm_response = ogs_timer_add(g_timer_mgr, response_timeout, xact); + ogs_assert(xact->tm_response); + xact->response_rcount = GTP_T3_RESPONSE_RETRY_COUNT; - if (g_holding_event) - { - xact->tm_holding = timer_create(g_tm_service, - g_holding_event, GTP_T3_DUPLICATED_DURATION); - d_assert(xact->tm_holding, return NULL, "Timer allocation failed"); - timer_set_param1(xact->tm_holding, xact->index); - xact->holding_rcount = GTP_T3_DUPLICATED_RETRY_COUNT; - } + xact->tm_holding = ogs_timer_add(g_timer_mgr, holding_timeout, xact); + ogs_assert(xact->tm_holding); + xact->holding_rcount = GTP_T3_DUPLICATED_RETRY_COUNT; - list_append(xact->org == GTP_LOCAL_ORIGINATOR ? + ogs_list_add(xact->org == GTP_LOCAL_ORIGINATOR ? &xact->gnode->local_list : &xact->gnode->remote_list, xact); rv = gtp_xact_update_tx(xact, hdesc, pkbuf); - d_assert(rv == CORE_OK, return NULL, "Update Tx failed"); + ogs_assert(rv == OGS_OK); - d_trace(15, "[%d] %s Create peer [%s]:%d\n", + ogs_debug("[%d] %s Create peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - CORE_ADDR(sock_remote_addr(gnode->sock), buf), - CORE_PORT(sock_remote_addr(gnode->sock))); + OGS_ADDR(&gnode->conn, buf), + OGS_PORT(&gnode->conn)); return xact; } -gtp_xact_t *gtp_xact_remote_create(gtp_node_t *gnode, c_uint32_t sqn) +gtp_xact_t *gtp_xact_remote_create(gtp_node_t *gnode, uint32_t sqn) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; gtp_xact_t *xact = NULL; - d_assert(gnode, return NULL, "Null param"); + ogs_assert(gnode); - index_alloc(>p_xact_pool, &xact); - d_assert(xact, return NULL, "Transaction allocation failed"); + ogs_pool_alloc(&pool, &xact); + ogs_assert(xact); + memset(xact, 0, sizeof *xact); + xact->index = ogs_pool_index(&pool, xact); xact->org = GTP_REMOTE_ORIGINATOR; xact->xid = GTP_SQN_TO_XID(sqn); xact->gnode = gnode; - if (g_response_event) - { - xact->tm_response = timer_create(g_tm_service, - g_response_event, GTP_T3_RESPONSE_DURATION); - d_assert(xact->tm_response, return NULL, "Timer allocation failed"); - timer_set_param1(xact->tm_response, xact->index); - xact->response_rcount = GTP_T3_RESPONSE_RETRY_COUNT; - } + xact->tm_response = ogs_timer_add(g_timer_mgr, response_timeout, xact); + ogs_assert(xact->tm_response); + xact->response_rcount = GTP_T3_RESPONSE_RETRY_COUNT; - if (g_holding_event) - { - xact->tm_holding = timer_create(g_tm_service, - g_holding_event, GTP_T3_DUPLICATED_DURATION); - d_assert(xact->tm_holding, return NULL, "Timer allocation failed"); - timer_set_param1(xact->tm_holding, xact->index); - xact->holding_rcount = GTP_T3_DUPLICATED_RETRY_COUNT; - } + xact->tm_holding = ogs_timer_add(g_timer_mgr, holding_timeout, xact); + ogs_assert(xact->tm_holding); + xact->holding_rcount = GTP_T3_DUPLICATED_RETRY_COUNT; - list_append(xact->org == GTP_LOCAL_ORIGINATOR ? + ogs_list_add(xact->org == GTP_LOCAL_ORIGINATOR ? &xact->gnode->local_list : &xact->gnode->remote_list, xact); - d_trace(15, "[%d] %s Create peer [%s]:%d\n", + ogs_debug("[%d] %s Create peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - CORE_ADDR(sock_remote_addr(gnode->sock), buf), - CORE_PORT(sock_remote_addr(gnode->sock))); + OGS_ADDR(&gnode->conn, buf), + OGS_PORT(&gnode->conn)); return xact; } void gtp_xact_delete_all(gtp_node_t *gnode) { - gtp_xact_t *xact = NULL; - - xact = list_first(&gnode->local_list); - while(xact) - { + gtp_xact_t *xact = NULL, *next_xact = NULL; + + ogs_list_for_each_safe(&gnode->local_list, next_xact, xact) gtp_xact_delete(xact); - xact = list_next(xact); - } - xact = list_first(&gnode->remote_list); - while(xact) - { + ogs_list_for_each_safe(&gnode->remote_list, next_xact, xact) gtp_xact_delete(xact); - xact = list_next(xact); - } } -status_t gtp_xact_update_tx(gtp_xact_t *xact, - gtp_header_t *hdesc, pkbuf_t *pkbuf) +int gtp_xact_update_tx(gtp_xact_t *xact, + gtp_header_t *hdesc, ogs_pkbuf_t *pkbuf) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; gtp_xact_stage_t stage; gtp_header_t *h = NULL; - d_assert(xact, return CORE_ERROR, "Null param"); - d_assert(xact->gnode, return CORE_ERROR, "Null param"); - d_assert(hdesc, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); + ogs_assert(xact); + ogs_assert(xact->gnode); + ogs_assert(hdesc); + ogs_assert(pkbuf); - d_trace(15, "[%d] %s UPD TX-%d peer [%s]:%d\n", + ogs_debug("[%d] %s UPD TX-%d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", hdesc->type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); stage = gtp_xact_get_stage(hdesc->type, xact->xid); if (xact->org == GTP_LOCAL_ORIGINATOR) @@ -209,30 +188,18 @@ status_t gtp_xact_update_tx(gtp_xact_t *xact, switch(stage) { case GTP_XACT_INITIAL_STAGE: - d_assert(xact->step == 0, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, hdesc->type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 0); break; case GTP_XACT_INTERMEDIATE_STAGE: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); case GTP_XACT_FINAL_STAGE: - d_assert(xact->step == 2, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, hdesc->type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 2); break; default: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); } } else if (xact->org == GTP_REMOTE_ORIGINATOR) @@ -240,30 +207,24 @@ status_t gtp_xact_update_tx(gtp_xact_t *xact, switch(stage) { case GTP_XACT_INITIAL_STAGE: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); case GTP_XACT_INTERMEDIATE_STAGE: case GTP_XACT_FINAL_STAGE: - d_assert(xact->step == 1, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, hdesc->type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 1); break; default: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); } } else - d_assert(0, return CORE_ERROR, "invalid orginator(%d)", xact->org); + ogs_assert_if_reached(); - pkbuf_header(pkbuf, GTPV2C_HEADER_LEN); - h = pkbuf->payload; - d_assert(h, return CORE_ERROR, "Null param"); + ogs_pkbuf_push(pkbuf, GTPV2C_HEADER_LEN); + h = pkbuf->data; + ogs_assert(h); memset(h, 0, sizeof(gtp_header_t)); h->version = 2; @@ -280,21 +241,21 @@ status_t gtp_xact_update_tx(gtp_xact_t *xact, /* Step */ xact->step++; - return CORE_OK; + return OGS_OK; } -status_t gtp_xact_update_rx(gtp_xact_t *xact, c_uint8_t type) +int gtp_xact_update_rx(gtp_xact_t *xact, uint8_t type) { - status_t rv = CORE_OK; - char buf[CORE_ADDRSTRLEN]; + int rv = OGS_OK; + char buf[OGS_ADDRSTRLEN]; gtp_xact_stage_t stage; - d_trace(15, "[%d] %s UPD RX-%d peer [%s]:%d\n", + ogs_debug("[%d] %s UPD RX-%d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); stage = gtp_xact_get_stage(type, xact->xid); if (xact->org == GTP_LOCAL_ORIGINATOR) @@ -302,83 +263,64 @@ status_t gtp_xact_update_rx(gtp_xact_t *xact, c_uint8_t type) switch(stage) { case GTP_XACT_INITIAL_STAGE: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); case GTP_XACT_INTERMEDIATE_STAGE: if (xact->seq[1].type == type) { - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(xact->step == 2 || xact->step == 3, - return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 2 || xact->step == 3); pkbuf = xact->seq[2].pkbuf; if (pkbuf) { if (xact->tm_holding) - tm_start(xact->tm_holding); + ogs_timer_start( + xact->tm_holding, GTP_T3_DUPLICATED_DURATION); - d_warn("[%d] %s Request Duplicated. Retransmit!" - " for type %d peer [%s]:%d", + ogs_warn("[%d] %s Request Duplicated. Retransmit!" + " for step %d type %d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), + OGS_ADDR(&xact->gnode->conn, buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - rv = gtp_send(xact->gnode, pkbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, - "gtp_send error"); + OGS_PORT(&xact->gnode->conn)); + rv = gtp_sendto(xact->gnode, pkbuf); + ogs_assert(rv == OGS_OK); } else { - d_warn("[%d] %s Request Duplicated. Discard!" - " for type %d peer [%s]:%d", + ogs_warn("[%d] %s Request Duplicated. Discard!" + " for step %d type %d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), + OGS_ADDR(&xact->gnode->conn, buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + OGS_PORT(&xact->gnode->conn)); } - return CORE_EAGAIN; + return OGS_RETRY; } - d_assert(xact->step == 1, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 1); if (xact->tm_holding) - tm_start(xact->tm_holding); + ogs_timer_start( + xact->tm_holding, GTP_T3_DUPLICATED_DURATION); break; case GTP_XACT_FINAL_STAGE: - d_assert(xact->step == 1, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - + ogs_assert(xact->step == 1); break; default: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); } } else if (xact->org == GTP_REMOTE_ORIGINATOR) @@ -388,89 +330,70 @@ status_t gtp_xact_update_rx(gtp_xact_t *xact, c_uint8_t type) case GTP_XACT_INITIAL_STAGE: if (xact->seq[0].type == type) { - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(xact->step == 1 || xact->step == 2, - return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 1 || xact->step == 2); pkbuf = xact->seq[1].pkbuf; if (pkbuf) { if (xact->tm_holding) - tm_start(xact->tm_holding); + ogs_timer_start( + xact->tm_holding, GTP_T3_DUPLICATED_DURATION); - d_warn("[%d] %s Request Duplicated. Retransmit!" + ogs_warn("[%d] %s Request Duplicated. Retransmit!" " for step %d type %d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), + OGS_ADDR(&xact->gnode->conn, buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - rv = gtp_send(xact->gnode, pkbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, - "gtp_send error"); + OGS_PORT(&xact->gnode->conn)); + rv = gtp_sendto(xact->gnode, pkbuf); + ogs_assert(rv == OGS_OK); } else { - d_warn("[%d] %s Request Duplicated. Discard!" + ogs_warn("[%d] %s Request Duplicated. Discard!" " for step %d type %d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), + OGS_ADDR(&xact->gnode->conn, buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + OGS_PORT(&xact->gnode->conn)); } - return CORE_EAGAIN; + return OGS_RETRY; } - d_assert(xact->step == 0, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - + ogs_assert(xact->step == 0); if (xact->tm_holding) - tm_start(xact->tm_holding); + ogs_timer_start( + xact->tm_holding, GTP_T3_DUPLICATED_DURATION); break; case GTP_XACT_INTERMEDIATE_STAGE: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); case GTP_XACT_FINAL_STAGE: - d_assert(xact->step == 2, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 2); /* continue */ break; default: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); } } else - d_assert(0, return CORE_ERROR, "invalid orginator(%d)", xact->org); + ogs_assert_if_reached(); if (xact->tm_response) - tm_stop(xact->tm_response); + ogs_timer_stop(xact->tm_response); /* Save Message type of this step */ xact->seq[xact->step].type = type; @@ -478,27 +401,27 @@ status_t gtp_xact_update_rx(gtp_xact_t *xact, c_uint8_t type) /* Step */ xact->step++; - return CORE_OK; + return OGS_OK; } -status_t gtp_xact_commit(gtp_xact_t *xact) +int gtp_xact_commit(gtp_xact_t *xact) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; - c_uint8_t type; - pkbuf_t *pkbuf = NULL; + uint8_t type; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_stage_t stage; - d_assert(xact, return CORE_ERROR, "Null param"); - d_assert(xact->gnode, return CORE_ERROR, "Null param"); + ogs_assert(xact); + ogs_assert(xact->gnode); - d_trace(15, "[%d] %s Commit peer [%s]:%d\n", + ogs_debug("[%d] %s Commit peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); type = xact->seq[xact->step-1].type; stage = gtp_xact_get_stage(type, xact->xid); @@ -509,42 +432,30 @@ status_t gtp_xact_commit(gtp_xact_t *xact) { case GTP_XACT_INITIAL_STAGE: { - d_assert(xact->step == 1, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + ogs_assert(xact->step == 1); if (xact->tm_response) - tm_start(xact->tm_response); + ogs_timer_start( + xact->tm_response, GTP_T3_RESPONSE_DURATION); break; } case GTP_XACT_INTERMEDIATE_STAGE: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); case GTP_XACT_FINAL_STAGE: - d_assert(xact->step == 2 || xact->step == 3, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - + ogs_assert(xact->step == 2 || xact->step == 3); if (xact->step == 2) { gtp_xact_delete(xact); - return CORE_OK; + return OGS_OK; } break; default: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); } } else if (xact->org == GTP_REMOTE_ORIGINATOR) @@ -552,177 +463,165 @@ status_t gtp_xact_commit(gtp_xact_t *xact) switch(stage) { case GTP_XACT_INITIAL_STAGE: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); case GTP_XACT_INTERMEDIATE_STAGE: - d_assert(xact->step == 2, return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - + ogs_assert(xact->step == 2); if (xact->tm_response) - tm_start(xact->tm_response); + ogs_timer_start( + xact->tm_response, GTP_T3_RESPONSE_DURATION); break; case GTP_XACT_FINAL_STAGE: - d_assert(xact->step == 2 || xact->step == 3, - return CORE_ERROR, - "[%d] %s invalid step %d for type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - + ogs_assert(xact->step == 2 || xact->step == 3); if (xact->step == 3) { gtp_xact_delete(xact); - return CORE_OK; + return OGS_OK; } break; default: - d_assert(0, return CORE_ERROR, "invalid step(%d)", xact->step); + ogs_assert_if_reached(); } } else - d_assert(0, return CORE_ERROR, "invalid orginator(%d)", xact->org); + ogs_assert_if_reached(); pkbuf = xact->seq[xact->step-1].pkbuf; - d_assert(pkbuf, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); - rv = gtp_send(xact->gnode, pkbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp_send error"); + rv = gtp_sendto(xact->gnode, pkbuf); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t gtp_xact_timeout(index_t index, c_uintptr_t event) +static void response_timeout(void *data) { - char buf[CORE_ADDRSTRLEN]; - gtp_xact_t *xact = NULL; + char buf[OGS_ADDRSTRLEN]; + gtp_xact_t *xact = data; - d_assert(index, goto out, "Invalid Index"); - xact = index_find(>p_xact_pool, index); - d_assert(xact, goto out, "Null param"); - d_assert(xact->gnode, goto out, "Null param"); + ogs_assert(xact); + ogs_assert(xact->gnode); - if (event == g_response_event) + ogs_debug("[%d] %s Response Timeout " + "for step %d type %d peer [%s]:%d", + xact->xid, + xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", + xact->step, xact->seq[xact->step-1].type, + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); + + if (--xact->response_rcount > 0) { - d_trace(15, "[%d] %s Response Timeout " - "for step %d type %d peer [%s]:%d\n", + ogs_pkbuf_t *pkbuf = NULL; + + if (xact->tm_response) + ogs_timer_start(xact->tm_response, GTP_T3_RESPONSE_DURATION); + + pkbuf = xact->seq[xact->step-1].pkbuf; + ogs_assert(pkbuf); + + if (gtp_sendto(xact->gnode, pkbuf) != OGS_OK) + { + ogs_error("gtp_sendto() failed"); + goto out; + } + } + else + { + ogs_warn("[%d] %s No Reponse. Give up! " + "for step %d type %d peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", xact->step, xact->seq[xact->step-1].type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - - if (--xact->response_rcount > 0) - { - pkbuf_t *pkbuf = NULL; - - if (xact->tm_response) - tm_start(xact->tm_response); - - pkbuf = xact->seq[xact->step-1].pkbuf; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - - if (gtp_send(xact->gnode, pkbuf) != CORE_OK) - { - d_error("gtp_send() failed"); - goto out; - } - } - else - { - d_warn("[%d] %s No Reponse. Give up! " - "for step %d type %d peer [%s]:%d", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, xact->seq[xact->step-1].type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - gtp_xact_delete(xact); - } - } - else if (event == g_holding_event) - { - d_trace(15, "[%d] %s Holding Timeout " - "for step %d type %d peer [%s]:%d\n", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, xact->seq[xact->step-1].type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - - if (--xact->holding_rcount > 0) - { - if (xact->tm_holding) - tm_start(xact->tm_holding); - } - else - { - d_trace(15, "[%d] %s Delete Transaction " - "for step %d type %d peer [%s]:%d\n", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - xact->step, xact->seq[xact->step-1].type, - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); - gtp_xact_delete(xact); - } + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); + gtp_xact_delete(xact); } - return CORE_OK; + return; out: gtp_xact_delete(xact); - return CORE_ERROR; } -status_t gtp_xact_receive( +static void holding_timeout(void *data) +{ + char buf[OGS_ADDRSTRLEN]; + gtp_xact_t *xact = data; + + ogs_assert(xact); + ogs_assert(xact->gnode); + + ogs_debug("[%d] %s Holding Timeout " + "for step %d type %d peer [%s]:%d", + xact->xid, + xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", + xact->step, xact->seq[xact->step-1].type, + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); + + if (--xact->holding_rcount > 0) + { + if (xact->tm_holding) + ogs_timer_start(xact->tm_holding, GTP_T3_DUPLICATED_DURATION); + } + else + { + ogs_debug("[%d] %s Delete Transaction " + "for step %d type %d peer [%s]:%d", + xact->xid, + xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", + xact->step, xact->seq[xact->step-1].type, + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); + gtp_xact_delete(xact); + } +} + + +int gtp_xact_receive( gtp_node_t *gnode, gtp_header_t *h, gtp_xact_t **xact) { - char buf[CORE_ADDRSTRLEN]; - status_t rv; + char buf[OGS_ADDRSTRLEN]; + int rv; gtp_xact_t *new = NULL; - d_assert(gnode, return CORE_ERROR, "Null param"); - d_assert(h, return CORE_ERROR, "Null param"); + ogs_assert(gnode); + ogs_assert(h); new = gtp_xact_find_by_xid(gnode, h->type, GTP_SQN_TO_XID(h->sqn)); if (!new) new = gtp_xact_remote_create(gnode, h->sqn); - d_assert(new, return CORE_ERROR, "Null param"); + ogs_assert(new); - d_trace(15, "[%d] %s Receive peer [%s]:%d\n", + ogs_debug("[%d] %s Receive peer [%s]:%d", new->xid, new->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - CORE_ADDR(sock_remote_addr(gnode->sock), buf), - CORE_PORT(sock_remote_addr(gnode->sock))); + OGS_ADDR(&gnode->conn, buf), + OGS_PORT(&gnode->conn)); rv = gtp_xact_update_rx(new, h->type); - if (rv != CORE_OK) + if (rv != OGS_OK) { return rv; } *xact = new; - return CORE_OK; + return OGS_OK; } -gtp_xact_t *gtp_xact_find(index_t index) +gtp_xact_t *gtp_xact_find(ogs_index_t index) { - d_assert(index, return NULL, "Invalid Index"); - return index_find(>p_xact_pool, index); + ogs_assert(index); + return ogs_pool_find(&pool, index); } -static gtp_xact_stage_t gtp_xact_get_stage(c_uint8_t type, c_uint32_t xid) +static gtp_xact_stage_t gtp_xact_get_stage(uint8_t type, uint32_t xid) { gtp_xact_stage_t stage = GTP_XACT_UNKNOWN_STAGE; @@ -765,7 +664,7 @@ static gtp_xact_stage_t gtp_xact_get_stage(c_uint8_t type, c_uint32_t xid) break; default: - d_error("Not implemented GTPv2 Message Type(%d)", type); + ogs_error("Not implemented GTPv2 Message Type(%d)", type); break; } @@ -773,46 +672,51 @@ static gtp_xact_stage_t gtp_xact_get_stage(c_uint8_t type, c_uint32_t xid) } gtp_xact_t *gtp_xact_find_by_xid( - gtp_node_t *gnode, c_uint8_t type, c_uint32_t xid) + gtp_node_t *gnode, uint8_t type, uint32_t xid) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; + + ogs_list_t *list = NULL; gtp_xact_t *xact = NULL; - d_assert(gnode, return NULL, "Null param"); + ogs_assert(gnode); switch(gtp_xact_get_stage(type, xid)) { case GTP_XACT_INITIAL_STAGE: - xact = list_first(&gnode->remote_list); + { + list = &gnode->remote_list; break; + } case GTP_XACT_INTERMEDIATE_STAGE: - xact = list_first(&gnode->local_list); + { + list = &gnode->local_list; break; + } case GTP_XACT_FINAL_STAGE: + { if (xid & GTP_MAX_XACT_ID) - xact = list_first(&gnode->remote_list); + list = &gnode->remote_list; else - xact = list_first(&gnode->local_list); + list = &gnode->local_list; break; - + } default: - d_assert(0, return NULL, "Unknown stage"); + ogs_assert_if_reached(); } - while(xact) + ogs_assert(list); + ogs_list_for_each(list, xact) { if (xact->xid == xid) + { + ogs_debug("[%d] %s Find peer [%s]:%d", + xact->xid, + xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", + OGS_ADDR(&gnode->conn, buf), + OGS_PORT(&gnode->conn)); break; - xact = list_next(xact); - } - - if (xact) - { - d_trace(15, "[%d] %s Find peer [%s]:%d\n", - xact->xid, - xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - CORE_ADDR(sock_remote_addr(gnode->sock), buf), - CORE_PORT(sock_remote_addr(gnode->sock))); + } } return xact; @@ -820,11 +724,11 @@ gtp_xact_t *gtp_xact_find_by_xid( void gtp_xact_associate(gtp_xact_t *xact1, gtp_xact_t *xact2) { - d_assert(xact1, return, "Null param"); - d_assert(xact2, return, "Null param"); + ogs_assert(xact1); + ogs_assert(xact2); - d_assert(xact1->assoc_xact == NULL, return, "Already assocaited"); - d_assert(xact2->assoc_xact == NULL, return, "Already assocaited"); + ogs_assert(xact1->assoc_xact == NULL); + ogs_assert(xact2->assoc_xact == NULL); xact1->assoc_xact = xact2; xact2->assoc_xact = xact1; @@ -832,48 +736,48 @@ void gtp_xact_associate(gtp_xact_t *xact1, gtp_xact_t *xact2) void gtp_xact_deassociate(gtp_xact_t *xact1, gtp_xact_t *xact2) { - d_assert(xact1, return, "Null param"); - d_assert(xact2, return, "Null param"); + ogs_assert(xact1); + ogs_assert(xact2); - d_assert(xact1->assoc_xact != NULL, return, "Already deassocaited"); - d_assert(xact2->assoc_xact != NULL, return, "Already deassocaited"); + ogs_assert(xact1->assoc_xact != NULL); + ogs_assert(xact2->assoc_xact != NULL); xact1->assoc_xact = NULL; xact2->assoc_xact = NULL; } -static status_t gtp_xact_delete(gtp_xact_t *xact) +static int gtp_xact_delete(gtp_xact_t *xact) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; - d_assert(xact, , "Null param"); - d_assert(xact->gnode, , "Null param"); + ogs_assert(xact); + ogs_assert(xact->gnode); - d_trace(15, "[%d] %s Delete peer [%s]:%d\n", + ogs_debug("[%d] %s Delete peer [%s]:%d", xact->xid, xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE", - CORE_ADDR(sock_remote_addr(xact->gnode->sock), buf), - CORE_PORT(sock_remote_addr(xact->gnode->sock))); + OGS_ADDR(&xact->gnode->conn, buf), + OGS_PORT(&xact->gnode->conn)); if (xact->seq[0].pkbuf) - pkbuf_free(xact->seq[0].pkbuf); + ogs_pkbuf_free(xact->seq[0].pkbuf); if (xact->seq[1].pkbuf) - pkbuf_free(xact->seq[1].pkbuf); + ogs_pkbuf_free(xact->seq[1].pkbuf); if (xact->seq[2].pkbuf) - pkbuf_free(xact->seq[2].pkbuf); + ogs_pkbuf_free(xact->seq[2].pkbuf); if (xact->tm_response) - tm_delete(xact->tm_response); + ogs_timer_delete(xact->tm_response); if (xact->tm_holding) - tm_delete(xact->tm_holding); + ogs_timer_delete(xact->tm_holding); if (xact->assoc_xact) gtp_xact_deassociate(xact, xact->assoc_xact); - list_remove(xact->org == GTP_LOCAL_ORIGINATOR ? &xact->gnode->local_list : - &xact->gnode->remote_list, xact); - index_free(>p_xact_pool, xact); + ogs_list_remove(xact->org == GTP_LOCAL_ORIGINATOR ? + &xact->gnode->local_list : &xact->gnode->remote_list, xact); + ogs_pool_free(&pool, xact); - return CORE_OK; + return OGS_OK; } diff --git a/lib/gtp/gtp_xact.h b/lib/gtp/gtp_xact.h index d66847d0f..617c989a7 100644 --- a/lib/gtp/gtp_xact.h +++ b/lib/gtp/gtp_xact.h @@ -1,11 +1,25 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef __GTP_XACT_H__ #define __GTP_XACT_H__ -#include "core_pkbuf.h" -#include "core_list.h" -#include "core_index.h" -#include "core_timer.h" - #include "gtp_message.h" #ifdef __cplusplus @@ -18,15 +32,15 @@ typedef struct _gtp_node_t gtp_node_t; * Transaction context */ typedef struct _gtp_xact_t { - lnode_t node; /**< A node of list */ - index_t index; + ogs_lnode_t node; /**< A node of list */ + ogs_index_t index; #define GTP_LOCAL_ORIGINATOR 0 #define GTP_REMOTE_ORIGINATOR 1 - c_uint8_t org; /**< Transaction' originator. + uint8_t org; /**< Transaction' originator. local or remote */ - c_uint32_t xid; /**< Transaction ID */ + uint32_t xid; /**< Transaction ID */ gtp_node_t *gnode; /**< Relevant GTP node context */ int step; /**< Current step in the sequence. @@ -34,21 +48,21 @@ typedef struct _gtp_xact_t { 2 : Triggered 3 : Triggered-Reply */ struct { - c_uint8_t type; /**< Message type history */ - pkbuf_t *pkbuf; /**< Packet history */ + uint8_t type; /**< Message type history */ + ogs_pkbuf_t *pkbuf; /**< Packet history */ } seq[3]; /**< history for the each step */ - tm_block_id tm_response; /**< Timer waiting for next message */ - c_uint8_t response_rcount; - tm_block_id tm_holding; /**< Timer waiting for holding message */ - c_uint8_t holding_rcount; + ogs_timer_t *tm_response; /**< Timer waiting for next message */ + uint8_t response_rcount; + ogs_timer_t *tm_holding; /**< Timer waiting for holding message */ + uint8_t holding_rcount; struct _gtp_xact_t *assoc_xact; /**< Associated transaction */ #define GTP_XACT_STORE_SESSION(xact, session) \ do { \ - d_assert((xact), break, "Null param"); \ - d_assert((session), break, "Null param"); \ + ogs_assert((xact)); \ + ogs_assert((session)); \ ((xact)->sess) = (session); \ } while(0) @@ -56,31 +70,28 @@ typedef struct _gtp_xact_t { void *sess; /**< Session Store */ } gtp_xact_t; -CORE_DECLARE(status_t) gtp_xact_init(tm_service_t *tm_service, - c_uintptr_t response_event, c_uintptr_t holding_event); -CORE_DECLARE(status_t) gtp_xact_final(void); +int gtp_xact_init(ogs_timer_mgr_t *timer_mgr); +int gtp_xact_final(void); -CORE_DECLARE(gtp_xact_t *) gtp_xact_local_create( - gtp_node_t *gnode, gtp_header_t *hdesc, pkbuf_t *pkbuf); -CORE_DECLARE(gtp_xact_t *) gtp_xact_remote_create( - gtp_node_t *gnode, c_uint32_t sqn); -CORE_DECLARE(void) gtp_xact_delete_all(gtp_node_t *gnode); +gtp_xact_t *gtp_xact_local_create( + gtp_node_t *gnode, gtp_header_t *hdesc, ogs_pkbuf_t *pkbuf); +gtp_xact_t *gtp_xact_remote_create( + gtp_node_t *gnode, uint32_t sqn); +void gtp_xact_delete_all(gtp_node_t *gnode); -CORE_DECLARE(status_t) gtp_xact_update_tx(gtp_xact_t *xact, - gtp_header_t *hdesc, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) gtp_xact_update_rx(gtp_xact_t *xact, c_uint8_t type); +int gtp_xact_update_tx(gtp_xact_t *xact, + gtp_header_t *hdesc, ogs_pkbuf_t *pkbuf); +int gtp_xact_update_rx(gtp_xact_t *xact, uint8_t type); -CORE_DECLARE(status_t) gtp_xact_commit(gtp_xact_t *xact); -CORE_DECLARE(status_t) gtp_xact_timeout(index_t index, c_uintptr_t event); +int gtp_xact_commit(gtp_xact_t *xact); -CORE_DECLARE(status_t) gtp_xact_receive( - gtp_node_t *gnode, gtp_header_t *h, gtp_xact_t **xact); +int gtp_xact_receive(gtp_node_t *gnode, gtp_header_t *h, gtp_xact_t **xact); -CORE_DECLARE(gtp_xact_t *) gtp_xact_find(index_t index); -CORE_DECLARE(gtp_xact_t *)gtp_xact_find_by_xid( - gtp_node_t *gnode, c_uint8_t type, c_uint32_t xid); -CORE_DECLARE(void) gtp_xact_associate(gtp_xact_t *xact1, gtp_xact_t *xact2); -CORE_DECLARE(void) gtp_xact_deassociate(gtp_xact_t *xact1, gtp_xact_t *xact2); +gtp_xact_t *gtp_xact_find(ogs_index_t index); +gtp_xact_t *gtp_xact_find_by_xid( + gtp_node_t *gnode, uint8_t type, uint32_t xid); +void gtp_xact_associate(gtp_xact_t *xact1, gtp_xact_t *xact2); +void gtp_xact_deassociate(gtp_xact_t *xact1, gtp_xact_t *xact2); #ifdef __cplusplus } diff --git a/lib/gtp/support/gtp_tlv.py b/lib/gtp/support/gtp_tlv.py index 3c479721b..102bf0c67 100644 --- a/lib/gtp/support/gtp_tlv.py +++ b/lib/gtp/support/gtp_tlv.py @@ -1,27 +1,20 @@ +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# Copyright (c) 2017, NextEPC Group -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + from docx import Document import re, os, sys, string import datetime @@ -61,28 +54,22 @@ def write_file(f, string): def output_header_to_file(f): now = datetime.datetime.now() f.write("""/* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ """) @@ -385,10 +372,10 @@ type_list["Node Type"]["size"] = 1 # Type : 128 f = open(outdir + 'gtp_message.h', 'w') output_header_to_file(f) -f.write("""#ifndef __GTP_TLV_H__ -#define __GTP_TLV_H__ +f.write("""#ifndef __GTP_MESSAGE_H__ +#define __GTP_MESSAGE_H__ -#include "core_tlv_msg.h" +#include "gtp_tlv.h" #ifdef __cplusplus extern "C" { @@ -401,28 +388,28 @@ extern "C" { typedef struct _gtp_header_t { union { struct { - ED4(c_uint8_t version:3;, - c_uint8_t piggybacked:1;, - c_uint8_t teid_presence:1;, - c_uint8_t spare1:3;) + ED4(uint8_t version:3;, + uint8_t piggybacked:1;, + uint8_t teid_presence:1;, + uint8_t spare1:3;) }; /* GTU-U flags */ #define GTPU_FLAGS_PN 0x1 #define GTPU_FLAGS_S 0x2 - c_uint8_t flags; + uint8_t flags; }; - c_uint8_t type; - c_uint16_t length; + uint8_t type; + uint16_t length; union { struct { - c_uint32_t teid; + uint32_t teid; /* sqn : 31bit ~ 8bit, spare : 7bit ~ 0bit */ #define GTP_XID_TO_SQN(__xid) htonl(((__xid) << 8)) #define GTP_SQN_TO_XID(__sqn) (ntohl(__sqn) >> 8) - c_uint32_t sqn; + uint32_t sqn; }; /* sqn : 31bit ~ 8bit, spare : 7bit ~ 0bit */ - c_uint32_t sqn_only; + uint32_t sqn_only; }; } __attribute__ ((packed)) gtp_header_t; @@ -531,24 +518,20 @@ for (k, v) in sorted_msg_list: f.write(" };\n"); f.write("} gtp_message_t;\n\n") -f.write("""CORE_DECLARE(status_t) gtp_parse_msg( - gtp_message_t *gtp_message, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) gtp_build_msg( - pkbuf_t **pkbuf, gtp_message_t *gtp_message); +f.write("""int gtp_parse_msg(gtp_message_t *gtp_message, ogs_pkbuf_t *pkbuf); +int gtp_build_msg(ogs_pkbuf_t **pkbuf, gtp_message_t *gtp_message); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __GTP_TLV_H__ */ +#endif /* __GTP_MESSAGE_H__ */ """) f.close() f = open(outdir + 'gtp_message.c', 'w') output_header_to_file(f) -f.write("""#define TRACE_MODULE _gtp_message -#include "core_debug.h" -#include "gtp_message.h" +f.write("""#include "gtp_message.h" """) @@ -612,21 +595,18 @@ for (k, v) in sorted_msg_list: f.write("}};\n\n") f.write("\n") -f.write("""status_t gtp_parse_msg(gtp_message_t *gtp_message, pkbuf_t *pkbuf) +f.write("""int gtp_parse_msg(gtp_message_t *gtp_message, ogs_pkbuf_t *pkbuf) { - status_t rv = CORE_ERROR; + int rv = OGS_ERROR; gtp_header_t *h = NULL; - c_uint16_t size = 0; + uint16_t size = 0; - d_assert(gtp_message, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(gtp_message); + ogs_assert(pkbuf); + ogs_assert(pkbuf->len); - d_trace(50, "[GTPv2] RECV : "); - d_trace_hex(50, pkbuf->payload, pkbuf->len); - - h = pkbuf->payload; - d_assert(h, return CORE_ERROR, "Null param"); + h = pkbuf->data; + ogs_assert(h); memset(gtp_message, 0, sizeof(gtp_message_t)); @@ -635,15 +615,14 @@ f.write("""status_t gtp_parse_msg(gtp_message_t *gtp_message, pkbuf_t *pkbuf) else size = GTPV2C_HEADER_LEN-GTP_TEID_LEN; - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); - memcpy(>p_message->h, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(>p_message->h, pkbuf->data - size, size); if (h->teid_presence) gtp_message->h.teid = ntohl(gtp_message->h.teid); if (pkbuf->len == 0) - return CORE_OK; + return OGS_OK; switch(gtp_message->h.type) { @@ -652,10 +631,10 @@ for (k, v) in sorted_msg_list: if "ies" in msg_list[k]: f.write(" case GTP_%s_TYPE:\n" % v_upper(k)) f.write(" rv = tlv_parse_msg(>p_message->%s,\n" % v_lower(k)) - f.write(" &tlv_desc_%s, pkbuf, TLV_MODE_T1_L2_I1);\n" % v_lower(k)) + f.write(" &tlv_desc_%s, pkbuf, OGS_TLV_MODE_T1_L2_I1);\n" % v_lower(k)) f.write(" break;\n") f.write(""" default: - d_warn("Not implmeneted(type:%d)", gtp_message->h.type); + ogs_warn("Not implmeneted(type:%d)", gtp_message->h.type); break; } @@ -664,11 +643,11 @@ f.write(""" default: """) -f.write("""status_t gtp_build_msg(pkbuf_t **pkbuf, gtp_message_t *gtp_message) +f.write("""int gtp_build_msg(ogs_pkbuf_t **pkbuf, gtp_message_t *gtp_message) { - status_t rv = CORE_ERROR; + int rv = OGS_ERROR; - d_assert(gtp_message, return rv, "Null param"); + ogs_assert(gtp_message); switch(gtp_message->h.type) { """) @@ -676,19 +655,13 @@ for (k, v) in sorted_msg_list: if "ies" in msg_list[k]: f.write(" case GTP_%s_TYPE:\n" % v_upper(k)) f.write(" rv = tlv_build_msg(pkbuf, &tlv_desc_%s,\n" % v_lower(k)) - f.write(" >p_message->%s, TLV_MODE_T1_L2_I1);\n" % v_lower(k)) + f.write(" >p_message->%s, OGS_TLV_MODE_T1_L2_I1);\n" % v_lower(k)) f.write(" break;\n") f.write(""" default: - d_warn("Not implmeneted(type:%d)", gtp_message->h.type); + ogs_warn("Not implmeneted(type:%d)", gtp_message->h.type); break; } - if ((*pkbuf) && (*pkbuf)->payload) - { - d_trace(50, "[GTPv2] SEND : "); - d_trace_hex(50, (*pkbuf)->payload, (*pkbuf)->len); - } - return rv; } """) diff --git a/lib/ipfw/Makefile.am b/lib/ipfw/Makefile.am index 4048223b4..b960b3ddf 100644 --- a/lib/ipfw/Makefile.am +++ b/lib/ipfw/Makefile.am @@ -2,25 +2,36 @@ pkglib_LTLIBRARIES = libipfw.la -libipfw_la_SOURCES = \ - ipfw2.h \ - ipfw2.c dummynet.c ipv6.c tables.c \ - expand_number.c humanize_number.c \ - glue.c +EXTRA_DIST = \ + objs/include_e/timeconv.h \ + objs/include_e/net/if_var.h \ + objs/include_e/netinet/ip_fw.h \ + objs/include_e/netinet/ip_dummynet.h \ + objs/include_e/sys/sockio.h \ + objs/include_e/libutil.h \ + objs/include_e/timeconv.h \ + objs/include_e/net/if_var.h \ + objs/include_e/netinet/ip_fw.h \ + objs/include_e/netinet/ip_dummynet.h \ + objs/include_e/sys/sockio.h \ + objs/include_e/libutil.h \ + $(NULL) -AM_LDFLAGS = \ - -version-info @LIBVERSION@ +libipfw_la_SOURCES = \ + ipfw2.h ipfw2.c dummynet.c ipv6.c tables.c \ + expand_number.c humanize_number.c \ + glue.h glue.c missing.h \ + $(NULL) AM_CPPFLAGS = \ -I$(top_srcdir)/lib/ipfw/objs/include_e \ -include glue.h \ -D_DEFAULT_SOURCE -D_BSD_SOURCE \ -DUSERSPACE -D__BSD_VISIBLE -DNEED_STRTONUM -DNEED_ROUNDUP2 \ - @IPFW_CPPFLAGS@ + @IPFW_CPPFLAGS@ \ + $(NULL) AM_CFLAGS = \ -Wall -Werror -Wno-shift-negative-value \ - -Wno-unused-but-set-variable -Wno-unknown-warning-option - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump + -Wno-unused-but-set-variable -Wno-unknown-warning-option \ + $(NULL) diff --git a/lib/nas/Makefile.am b/lib/nas/Makefile.am index 224754280..b89b8b46c 100644 --- a/lib/nas/Makefile.am +++ b/lib/nas/Makefile.am @@ -1,4 +1,19 @@ -## Process this file with automake to produce Makefile.in +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . pkglib_LTLIBRARIES = libnas.la @@ -8,24 +23,20 @@ libnas_la_SOURCES = \ $(NULL) libnas_la_DEPENDENCIES = \ - $(top_srcdir)/lib/core/src/libcore.la \ + @OGSCORE_LIBS@ \ + $(top_srcdir)/lib/base/libbase.la \ $(NULL) libnas_la_LIBADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(NULL) - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ \ + @OGSCORE_LIBS@ \ + $(top_srcdir)/lib/base/libbase.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ + -I$(top_srcdir)/lib \ $(NULL) AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/lib/nas/nas_decoder.c b/lib/nas/nas_decoder.c index a67fb58b6..c26ef46af 100644 --- a/lib/nas/nas_decoder.c +++ b/lib/nas/nas_decoder.c @@ -1,192 +1,185 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by nas_message.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2019-03-17 01:58:02.778431 by acetcom + * Created on: 2019-03-17 02:01:09.581393 by acetcom * from 24301-d80.docx ******************************************************************************/ -#define TRACE_MODULE _nas_decoder - -#include "core_debug.h" #include "nas_message.h" -c_int32_t nas_decode_attach_request(nas_message_t *message, pkbuf_t *pkbuf) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain + +int nas_decode_attach_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_attach_request_t *attach_request = &message->emm.attach_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ATTACH_REQUEST\n"); + ogs_trace("[NAS] Decode ATTACH_REQUEST\n"); size = nas_decode_eps_attach_type(&attach_request->eps_attach_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_eps_mobile_identity(&attach_request->eps_mobile_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_ue_network_capability(&attach_request->ue_network_capability, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_esm_message_container(&attach_request->esm_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE: size = nas_decode_p_tmsi_signature(&attach_request->old_p_tmsi_signature, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_TYPE: size = nas_decode_eps_mobile_identity(&attach_request->additional_guti, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE: size = nas_decode_tracking_area_identity(&attach_request->last_visited_registered_tai, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_DRX_PARAMETER_TYPE: size = nas_decode_drx_parameter(&attach_request->drx_parameter, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_DRX_PARAMETER_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_TYPE: size = nas_decode_ms_network_capability(&attach_request->ms_network_capability, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_TYPE: size = nas_decode_location_area_identification(&attach_request->old_location_area_identification, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_TMSI_STATUS_TYPE: size = nas_decode_tmsi_status(&attach_request->tmsi_status, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_TMSI_STATUS_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_TYPE: size = nas_decode_mobile_station_classmark_2(&attach_request->mobile_station_classmark_2, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_TYPE: size = nas_decode_mobile_station_classmark_3(&attach_request->mobile_station_classmark_3, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_SUPPORTED_CODECS_TYPE: size = nas_decode_supported_codec_list(&attach_request->supported_codecs, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_TYPE: size = nas_decode_additional_update_type(&attach_request->additional_update_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_TYPE: size = nas_decode_voice_domain_preference_and_ue_usage_setting(&attach_request->voice_domain_preference_and_ue_usage_setting, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_TYPE: size = nas_decode_device_properties(&attach_request->device_properties, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_TYPE: size = nas_decode_guti_type(&attach_request->old_guti_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_TYPE: size = nas_decode_ms_network_feature_support(&attach_request->ms_network_feature_support, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_TYPE: size = nas_decode_network_resource_identifier_container(&attach_request->tmsi_based_nri_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_T3324_VALUE_TYPE: size = nas_decode_gprs_timer_2(&attach_request->t3324_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_T3324_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_TYPE: size = nas_decode_gprs_timer_3(&attach_request->t3412_extended_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE: size = nas_decode_extended_drx_parameters(&attach_request->extended_drx_parameters, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_request->presencemask |= NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -194,122 +187,121 @@ c_int32_t nas_decode_attach_request(nas_message_t *message, pkbuf_t *pkbuf) return decoded; } -c_int32_t nas_decode_attach_accept(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_attach_accept(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_attach_accept_t *attach_accept = &message->emm.attach_accept; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ATTACH_ACCEPT\n"); + ogs_trace("[NAS] Decode ATTACH_ACCEPT\n"); size = nas_decode_eps_attach_result(&attach_accept->eps_attach_result, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_gprs_timer(&attach_accept->t3412_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_tracking_area_identity_list(&attach_accept->tai_list, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_esm_message_container(&attach_accept->esm_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ATTACH_ACCEPT_GUTI_TYPE: size = nas_decode_eps_mobile_identity(&attach_accept->guti, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_TYPE: size = nas_decode_location_area_identification(&attach_accept->location_area_identification, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_MS_IDENTITY_TYPE: size = nas_decode_mobile_identity(&attach_accept->ms_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_EMM_CAUSE_TYPE: size = nas_decode_emm_cause(&attach_accept->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_EMM_CAUSE_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_T3402_VALUE_TYPE: size = nas_decode_gprs_timer(&attach_accept->t3402_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_T3402_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_T3423_VALUE_TYPE: size = nas_decode_gprs_timer(&attach_accept->t3423_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_T3423_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_TYPE: size = nas_decode_plmn_list(&attach_accept->equivalent_plmns, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_TYPE: size = nas_decode_emergency_number_list(&attach_accept->emergency_number_list, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_TYPE: size = nas_decode_eps_network_feature_support(&attach_accept->eps_network_feature_support, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_TYPE: size = nas_decode_additional_update_result(&attach_accept->additional_update_result, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_TYPE: size = nas_decode_gprs_timer_3(&attach_accept->t3412_extended_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_T3324_VALUE_TYPE: size = nas_decode_gprs_timer_2(&attach_accept->t3324_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_T3324_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE: size = nas_decode_extended_drx_parameters(&attach_accept->extended_drx_parameters, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -317,71 +309,70 @@ c_int32_t nas_decode_attach_accept(nas_message_t *message, pkbuf_t *pkbuf) return decoded; } -c_int32_t nas_decode_attach_complete(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_attach_complete(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_attach_complete_t *attach_complete = &message->emm.attach_complete; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ATTACH_COMPLETE\n"); + ogs_trace("[NAS] Decode ATTACH_COMPLETE\n"); size = nas_decode_esm_message_container(&attach_complete->esm_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_attach_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_attach_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_attach_reject_t *attach_reject = &message->emm.attach_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ATTACH_REJECT\n"); + ogs_trace("[NAS] Decode ATTACH_REJECT\n"); size = nas_decode_emm_cause(&attach_reject->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_TYPE: size = nas_decode_esm_message_container(&attach_reject->esm_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_reject->presencemask |= NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT; decoded += size; break; case NAS_ATTACH_REJECT_T3346_VALUE_TYPE: size = nas_decode_gprs_timer_2(&attach_reject->t3346_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_reject->presencemask |= NAS_ATTACH_REJECT_T3346_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_REJECT_T3402_VALUE_TYPE: size = nas_decode_gprs_timer_2(&attach_reject->t3402_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_reject->presencemask |= NAS_ATTACH_REJECT_T3402_VALUE_PRESENT; decoded += size; break; case NAS_ATTACH_REJECT_EXTENDED_EMM_CAUSE_TYPE: size = nas_decode_extended_emm_cause(&attach_reject->extended_emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); attach_reject->presencemask |= NAS_ATTACH_REJECT_EXTENDED_EMM_CAUSE_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -389,57 +380,56 @@ c_int32_t nas_decode_attach_reject(nas_message_t *message, pkbuf_t *pkbuf) return decoded; } -c_int32_t nas_decode_detach_request_from_ue(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_detach_request_from_ue(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_detach_request_from_ue_t *detach_request_from_ue = &message->emm.detach_request_from_ue; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode DETACH_REQUEST\n"); + ogs_trace("[NAS] Decode DETACH_REQUEST\n"); size = nas_decode_detach_type(&detach_request_from_ue->detach_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_eps_mobile_identity(&detach_request_from_ue->eps_mobile_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_detach_request_to_ue(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_detach_request_to_ue(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_detach_request_to_ue_t *detach_request_to_ue = &message->emm.detach_request_to_ue; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode DETACH_REQUEST\n"); + ogs_trace("[NAS] Decode DETACH_REQUEST\n"); size = nas_decode_detach_type(&detach_request_to_ue->detach_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_DETACH_REQUEST_EMM_CAUSE_TYPE: size = nas_decode_emm_cause(&detach_request_to_ue->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); detach_request_to_ue->presencemask |= NAS_DETACH_REQUEST_EMM_CAUSE_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -447,186 +437,185 @@ c_int32_t nas_decode_detach_request_to_ue(nas_message_t *message, pkbuf_t *pkbuf return decoded; } -c_int32_t nas_decode_tracking_area_update_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_tracking_area_update_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_tracking_area_update_request_t *tracking_area_update_request = &message->emm.tracking_area_update_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode TRACKING_AREA_UPDATE_REQUEST\n"); + ogs_trace("[NAS] Decode TRACKING_AREA_UPDATE_REQUEST\n"); size = nas_decode_eps_update_type(&tracking_area_update_request->eps_update_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_eps_mobile_identity(&tracking_area_update_request->old_guti, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_TRACKING_AREA_UPDATE_REQUEST_NON_CURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_TYPE: size = nas_decode_key_set_identifier(&tracking_area_update_request->non_current_native_nas_key_set_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_NON_CURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_TYPE: size = nas_decode_ciphering_key_sequence_number(&tracking_area_update_request->gprs_ciphering_key_sequence_number, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE: size = nas_decode_p_tmsi_signature(&tracking_area_update_request->old_p_tmsi_signature, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_P_TMSI_SIGNATURE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_TYPE: size = nas_decode_eps_mobile_identity(&tracking_area_update_request->additional_guti, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_NONCEUE_TYPE: size = nas_decode_nonce(&tracking_area_update_request->nonceue, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_TYPE: size = nas_decode_ue_network_capability(&tracking_area_update_request->ue_network_capability, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE: size = nas_decode_tracking_area_identity(&tracking_area_update_request->last_visited_registered_tai, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_TYPE: size = nas_decode_drx_parameter(&tracking_area_update_request->drx_parameter, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_TYPE: size = nas_decode_ue_radio_capability_information_update_needed(&tracking_area_update_request->ue_radio_capability_information_update_needed, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_TYPE: size = nas_decode_eps_bearer_context_status(&tracking_area_update_request->eps_bearer_context_status, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_TYPE: size = nas_decode_ms_network_capability(&tracking_area_update_request->ms_network_capability, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_TYPE: size = nas_decode_location_area_identification(&tracking_area_update_request->old_location_area_identification, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_TYPE: size = nas_decode_tmsi_status(&tracking_area_update_request->tmsi_status, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_TYPE: size = nas_decode_mobile_station_classmark_2(&tracking_area_update_request->mobile_station_classmark_2, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_TYPE: size = nas_decode_mobile_station_classmark_3(&tracking_area_update_request->mobile_station_classmark_3, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_TYPE: size = nas_decode_supported_codec_list(&tracking_area_update_request->supported_codecs, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_TYPE: size = nas_decode_additional_update_type(&tracking_area_update_request->additional_update_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_TYPE: size = nas_decode_voice_domain_preference_and_ue_usage_setting(&tracking_area_update_request->voice_domain_preference_and_ue_usage_setting, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_TYPE: size = nas_decode_guti_type(&tracking_area_update_request->old_guti_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_DEVICE_PROPERTIES_TYPE: size = nas_decode_device_properties(&tracking_area_update_request->device_properties, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_DEVICE_PROPERTIES_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_FEATURE_SUPPORT_TYPE: size = nas_decode_ms_network_feature_support(&tracking_area_update_request->ms_network_feature_support, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_BASED_NRI_CONTAINER_TYPE: size = nas_decode_network_resource_identifier_container(&tracking_area_update_request->tmsi_based_nri_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_BASED_NRI_CONTAINER_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_T3324_VALUE_TYPE: size = nas_decode_gprs_timer_2(&tracking_area_update_request->t3324_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_T3324_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_T3412_EXTENDED_VALUE_TYPE: size = nas_decode_gprs_timer_3(&tracking_area_update_request->t3412_extended_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_T3412_EXTENDED_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE: size = nas_decode_extended_drx_parameters(&tracking_area_update_request->extended_drx_parameters, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_request->presencemask |= NAS_TRACKING_AREA_UPDATE_REQUEST_EXTENDED_DRX_PARAMETERS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -634,134 +623,133 @@ c_int32_t nas_decode_tracking_area_update_request(nas_message_t *message, pkbuf_ return decoded; } -c_int32_t nas_decode_tracking_area_update_accept(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_tracking_area_update_accept(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_tracking_area_update_accept_t *tracking_area_update_accept = &message->emm.tracking_area_update_accept; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode TRACKING_AREA_UPDATE_ACCEPT\n"); + ogs_trace("[NAS] Decode TRACKING_AREA_UPDATE_ACCEPT\n"); size = nas_decode_eps_update_result(&tracking_area_update_accept->eps_update_result, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_TYPE: size = nas_decode_gprs_timer(&tracking_area_update_accept->t3412_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_GUTI_TYPE: size = nas_decode_eps_mobile_identity(&tracking_area_update_accept->guti, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_TYPE: size = nas_decode_tracking_area_identity_list(&tracking_area_update_accept->tai_list, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_TYPE: size = nas_decode_eps_bearer_context_status(&tracking_area_update_accept->eps_bearer_context_status, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_TYPE: size = nas_decode_location_area_identification(&tracking_area_update_accept->location_area_identification, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_TYPE: size = nas_decode_mobile_identity(&tracking_area_update_accept->ms_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_TYPE: size = nas_decode_emm_cause(&tracking_area_update_accept->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_TYPE: size = nas_decode_gprs_timer(&tracking_area_update_accept->t3402_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_TYPE: size = nas_decode_gprs_timer(&tracking_area_update_accept->t3423_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_TYPE: size = nas_decode_plmn_list(&tracking_area_update_accept->equivalent_plmns, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_TYPE: size = nas_decode_emergency_number_list(&tracking_area_update_accept->emergency_number_list, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_TYPE: size = nas_decode_eps_network_feature_support(&tracking_area_update_accept->eps_network_feature_support, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_TYPE: size = nas_decode_additional_update_result(&tracking_area_update_accept->additional_update_result, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_EXTENDED_VALUE_TYPE: size = nas_decode_gprs_timer_3(&tracking_area_update_accept->t3412_extended_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_EXTENDED_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_T3324_VALUE_TYPE: size = nas_decode_gprs_timer_2(&tracking_area_update_accept->t3324_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_T3324_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE: size = nas_decode_extended_drx_parameters(&tracking_area_update_accept->extended_drx_parameters, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_STATUS_TYPE: size = nas_decode_header_compression_configuration_status(&tracking_area_update_accept->header_compression_configuration_status, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_STATUS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -769,44 +757,43 @@ c_int32_t nas_decode_tracking_area_update_accept(nas_message_t *message, pkbuf_t return decoded; } -c_int32_t nas_decode_tracking_area_update_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_tracking_area_update_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_tracking_area_update_reject_t *tracking_area_update_reject = &message->emm.tracking_area_update_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode TRACKING_AREA_UPDATE_REJECT\n"); + ogs_trace("[NAS] Decode TRACKING_AREA_UPDATE_REJECT\n"); size = nas_decode_emm_cause(&tracking_area_update_reject->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_TRACKING_AREA_UPDATE_REJECT_T3346_VALUE_TYPE: size = nas_decode_gprs_timer_2(&tracking_area_update_reject->t3346_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_reject->presencemask |= NAS_TRACKING_AREA_UPDATE_REJECT_T3346_VALUE_PRESENT; decoded += size; break; case NAS_TRACKING_AREA_UPDATE_REJECT_EXTENDED_EMM_CAUSE_TYPE: size = nas_decode_extended_emm_cause(&tracking_area_update_reject->extended_emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); tracking_area_update_reject->presencemask |= NAS_TRACKING_AREA_UPDATE_REJECT_EXTENDED_EMM_CAUSE_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -814,54 +801,53 @@ c_int32_t nas_decode_tracking_area_update_reject(nas_message_t *message, pkbuf_t return decoded; } -c_int32_t nas_decode_extended_service_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_extended_service_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_extended_service_request_t *extended_service_request = &message->emm.extended_service_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode EXTENDED_SERVICE_REQUEST\n"); + ogs_trace("[NAS] Decode EXTENDED_SERVICE_REQUEST\n"); size = nas_decode_service_type(&extended_service_request->service_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_mobile_identity(&extended_service_request->m_tmsi, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_EXTENDED_SERVICE_REQUEST_CSFB_RESPONSE_TYPE: size = nas_decode_csfb_response(&extended_service_request->csfb_response, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); extended_service_request->presencemask |= NAS_EXTENDED_SERVICE_REQUEST_CSFB_RESPONSE_PRESENT; decoded += size; break; case NAS_EXTENDED_SERVICE_REQUEST_EPS_BEARER_CONTEXT_STATUS_TYPE: size = nas_decode_eps_bearer_context_status(&extended_service_request->eps_bearer_context_status, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); extended_service_request->presencemask |= NAS_EXTENDED_SERVICE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT; decoded += size; break; case NAS_EXTENDED_SERVICE_REQUEST_DEVICE_PROPERTIES_TYPE: size = nas_decode_device_properties(&extended_service_request->device_properties, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); extended_service_request->presencemask |= NAS_EXTENDED_SERVICE_REQUEST_DEVICE_PROPERTIES_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -869,57 +855,56 @@ c_int32_t nas_decode_extended_service_request(nas_message_t *message, pkbuf_t *p return decoded; } -c_int32_t nas_decode_service_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_service_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_service_request_t *service_request = &message->emm.service_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode SERVICE_REQUEST\n"); + ogs_trace("[NAS] Decode SERVICE_REQUEST\n"); size = nas_decode_ksi_and_sequence_number(&service_request->ksi_and_sequence_number, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_short_mac(&service_request->message_authentication_code, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_service_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_service_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_service_reject_t *service_reject = &message->emm.service_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode SERVICE_REJECT\n"); + ogs_trace("[NAS] Decode SERVICE_REJECT\n"); size = nas_decode_emm_cause(&service_reject->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_SERVICE_REJECT_T3346_VALUE_TYPE: size = nas_decode_gprs_timer_2(&service_reject->t3346_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); service_reject->presencemask |= NAS_SERVICE_REJECT_T3346_VALUE_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -927,38 +912,37 @@ c_int32_t nas_decode_service_reject(nas_message_t *message, pkbuf_t *pkbuf) return decoded; } -c_int32_t nas_decode_guti_reallocation_command(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_guti_reallocation_command(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_guti_reallocation_command_t *guti_reallocation_command = &message->emm.guti_reallocation_command; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode GUTI_REALLOCATION_COMMAND\n"); + ogs_trace("[NAS] Decode GUTI_REALLOCATION_COMMAND\n"); size = nas_decode_eps_mobile_identity(&guti_reallocation_command->guti, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_TYPE: size = nas_decode_tracking_area_identity_list(&guti_reallocation_command->tai_list, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); guti_reallocation_command->presencemask |= NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -966,106 +950,105 @@ c_int32_t nas_decode_guti_reallocation_command(nas_message_t *message, pkbuf_t * return decoded; } -c_int32_t nas_decode_authentication_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_authentication_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_authentication_request_t *authentication_request = &message->emm.authentication_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode AUTHENTICATION_REQUEST\n"); + ogs_trace("[NAS] Decode AUTHENTICATION_REQUEST\n"); size = nas_decode_key_set_identifier(&authentication_request->nas_key_set_identifierasme, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_authentication_parameter_rand(&authentication_request->authentication_parameter_rand, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_authentication_parameter_autn(&authentication_request->authentication_parameter_autn, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_authentication_response(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_authentication_response(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_authentication_response_t *authentication_response = &message->emm.authentication_response; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode AUTHENTICATION_RESPONSE\n"); + ogs_trace("[NAS] Decode AUTHENTICATION_RESPONSE\n"); size = nas_decode_authentication_response_parameter(&authentication_response->authentication_response_parameter, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_identity_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_identity_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_identity_request_t *identity_request = &message->emm.identity_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode IDENTITY_REQUEST\n"); + ogs_trace("[NAS] Decode IDENTITY_REQUEST\n"); size = nas_decode_identity_type_2(&identity_request->identity_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_identity_response(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_identity_response(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_identity_response_t *identity_response = &message->emm.identity_response; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode IDENTITY_RESPONSE\n"); + ogs_trace("[NAS] Decode IDENTITY_RESPONSE\n"); size = nas_decode_mobile_identity(&identity_response->mobile_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_authentication_failure(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_authentication_failure(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_authentication_failure_t *authentication_failure = &message->emm.authentication_failure; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode AUTHENTICATION_FAILURE\n"); + ogs_trace("[NAS] Decode AUTHENTICATION_FAILURE\n"); size = nas_decode_emm_cause(&authentication_failure->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_TYPE: size = nas_decode_authentication_failure_parameter(&authentication_failure->authentication_failure_parameter, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); authentication_failure->presencemask |= NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1073,58 +1056,57 @@ c_int32_t nas_decode_authentication_failure(nas_message_t *message, pkbuf_t *pkb return decoded; } -c_int32_t nas_decode_security_mode_command(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_security_mode_command(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_security_mode_command_t *security_mode_command = &message->emm.security_mode_command; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode SECURITY_MODE_COMMAND\n"); + ogs_trace("[NAS] Decode SECURITY_MODE_COMMAND\n"); size = nas_decode_security_algorithms(&security_mode_command->selected_nas_security_algorithms, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_key_set_identifier(&security_mode_command->nas_key_set_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_ue_security_capability(&security_mode_command->replayed_ue_security_capabilities, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_TYPE: size = nas_decode_imeisv_request(&security_mode_command->imeisv_request, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); security_mode_command->presencemask |= NAS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; decoded += size; break; case NAS_SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_TYPE: size = nas_decode_nonce(&security_mode_command->replayed_nonceue, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); security_mode_command->presencemask |= NAS_SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT; decoded += size; break; case NAS_SECURITY_MODE_COMMAND_NONCEMME_TYPE: size = nas_decode_nonce(&security_mode_command->noncemme, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); security_mode_command->presencemask |= NAS_SECURITY_MODE_COMMAND_NONCEMME_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1132,34 +1114,33 @@ c_int32_t nas_decode_security_mode_command(nas_message_t *message, pkbuf_t *pkbu return decoded; } -c_int32_t nas_decode_security_mode_complete(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_security_mode_complete(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_security_mode_complete_t *security_mode_complete = &message->emm.security_mode_complete; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode SECURITY_MODE_COMPLETE\n"); + ogs_trace("[NAS] Decode SECURITY_MODE_COMPLETE\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_SECURITY_MODE_COMPLETE_IMEISV_TYPE: size = nas_decode_mobile_identity(&security_mode_complete->imeisv, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); security_mode_complete->presencemask |= NAS_SECURITY_MODE_COMPLETE_IMEISV_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1167,88 +1148,87 @@ c_int32_t nas_decode_security_mode_complete(nas_message_t *message, pkbuf_t *pkb return decoded; } -c_int32_t nas_decode_security_mode_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_security_mode_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_security_mode_reject_t *security_mode_reject = &message->emm.security_mode_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode SECURITY_MODE_REJECT\n"); + ogs_trace("[NAS] Decode SECURITY_MODE_REJECT\n"); size = nas_decode_emm_cause(&security_mode_reject->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_emm_status(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_emm_status(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_emm_status_t *emm_status = &message->emm.emm_status; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode EMM_STATUS\n"); + ogs_trace("[NAS] Decode EMM_STATUS\n"); size = nas_decode_emm_cause(&emm_status->emm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_emm_information(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_emm_information(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_emm_information_t *emm_information = &message->emm.emm_information; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode EMM_INFORMATION\n"); + ogs_trace("[NAS] Decode EMM_INFORMATION\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_TYPE: size = nas_decode_network_name(&emm_information->full_name_for_network, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); emm_information->presencemask |= NAS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT; decoded += size; break; case NAS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_TYPE: size = nas_decode_network_name(&emm_information->short_name_for_network, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); emm_information->presencemask |= NAS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT; decoded += size; break; case NAS_EMM_INFORMATION_LOCAL_TIME_ZONE_TYPE: size = nas_decode_time_zone(&emm_information->local_time_zone, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); emm_information->presencemask |= NAS_EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT; decoded += size; break; case NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_TYPE: size = nas_decode_time_zone_and_time(&emm_information->universal_time_and_local_time_zone, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); emm_information->presencemask |= NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT; decoded += size; break; case NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_TYPE: size = nas_decode_daylight_saving_time(&emm_information->network_daylight_saving_time, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); emm_information->presencemask |= NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1256,86 +1236,85 @@ c_int32_t nas_decode_emm_information(nas_message_t *message, pkbuf_t *pkbuf) return decoded; } -c_int32_t nas_decode_downlink_nas_transport(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_downlink_nas_transport(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_downlink_nas_transport_t *downlink_nas_transport = &message->emm.downlink_nas_transport; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode DOWNLINK_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Decode DOWNLINK_NAS_TRANSPORT\n"); size = nas_decode_message_container(&downlink_nas_transport->nas_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_uplink_nas_transport(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_uplink_nas_transport(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_uplink_nas_transport_t *uplink_nas_transport = &message->emm.uplink_nas_transport; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode UPLINK_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Decode UPLINK_NAS_TRANSPORT\n"); size = nas_decode_message_container(&uplink_nas_transport->nas_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -c_int32_t nas_decode_cs_service_notification(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_cs_service_notification(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_cs_service_notification_t *cs_service_notification = &message->emm.cs_service_notification; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode CS_SERVICE_NOTIFICATION\n"); + ogs_trace("[NAS] Decode CS_SERVICE_NOTIFICATION\n"); size = nas_decode_paging_identity(&cs_service_notification->paging_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_CS_SERVICE_NOTIFICATION_CLI_TYPE: size = nas_decode_cli(&cs_service_notification->cli, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); cs_service_notification->presencemask |= NAS_CS_SERVICE_NOTIFICATION_CLI_PRESENT; decoded += size; break; case NAS_CS_SERVICE_NOTIFICATION_SS_CODE_TYPE: size = nas_decode_ss_code(&cs_service_notification->ss_code, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); cs_service_notification->presencemask |= NAS_CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT; decoded += size; break; case NAS_CS_SERVICE_NOTIFICATION_LCS_INDICATOR_TYPE: size = nas_decode_lcs_indicator(&cs_service_notification->lcs_indicator, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); cs_service_notification->presencemask |= NAS_CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT; decoded += size; break; case NAS_CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_TYPE: size = nas_decode_lcs_client_identity(&cs_service_notification->lcs_client_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); cs_service_notification->presencemask |= NAS_CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1343,42 +1322,41 @@ c_int32_t nas_decode_cs_service_notification(nas_message_t *message, pkbuf_t *pk return decoded; } -c_int32_t nas_decode_uplink_generic_nas_transport(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_uplink_generic_nas_transport(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_uplink_generic_nas_transport_t *uplink_generic_nas_transport = &message->emm.uplink_generic_nas_transport; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode UPLINK_GENERIC_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Decode UPLINK_GENERIC_NAS_TRANSPORT\n"); size = nas_decode_generic_message_container_type(&uplink_generic_nas_transport->generic_message_container_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_generic_message_container(&uplink_generic_nas_transport->generic_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE: size = nas_decode_additional_information(&uplink_generic_nas_transport->additional_information, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); uplink_generic_nas_transport->presencemask |= NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1386,42 +1364,41 @@ c_int32_t nas_decode_uplink_generic_nas_transport(nas_message_t *message, pkbuf_ return decoded; } -c_int32_t nas_decode_downlink_generic_nas_transport(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_downlink_generic_nas_transport(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_downlink_generic_nas_transport_t *downlink_generic_nas_transport = &message->emm.downlink_generic_nas_transport; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode DOWNLINK_GENERIC_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Decode DOWNLINK_GENERIC_NAS_TRANSPORT\n"); size = nas_decode_generic_message_container_type(&downlink_generic_nas_transport->generic_message_container_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_generic_message_container(&downlink_generic_nas_transport->generic_message_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE: size = nas_decode_additional_information(&downlink_generic_nas_transport->additional_information, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); downlink_generic_nas_transport->presencemask |= NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1429,130 +1406,129 @@ c_int32_t nas_decode_downlink_generic_nas_transport(nas_message_t *message, pkbu return decoded; } -c_int32_t nas_decode_activate_default_eps_bearer_context_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_activate_default_eps_bearer_context_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_activate_default_eps_bearer_context_request_t *activate_default_eps_bearer_context_request = &message->esm.activate_default_eps_bearer_context_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Decode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST\n"); size = nas_decode_eps_quality_of_service(&activate_default_eps_bearer_context_request->eps_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_access_point_name(&activate_default_eps_bearer_context_request->access_point_name, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_pdn_address(&activate_default_eps_bearer_context_request->pdn_address, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_TYPE: size = nas_decode_transaction_identifier(&activate_default_eps_bearer_context_request->transaction_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_TYPE: size = nas_decode_quality_of_service(&activate_default_eps_bearer_context_request->negotiated_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_TYPE: size = nas_decode_llc_service_access_point_identifier(&activate_default_eps_bearer_context_request->negotiated_llc_sapi, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_TYPE: size = nas_decode_radio_priority(&activate_default_eps_bearer_context_request->radio_priority, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_TYPE: size = nas_decode_packet_flow_identifier(&activate_default_eps_bearer_context_request->packet_flow_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_TYPE: size = nas_decode_apn_aggregate_maximum_bit_rate(&activate_default_eps_bearer_context_request->apn_ambr, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_TYPE: size = nas_decode_esm_cause(&activate_default_eps_bearer_context_request->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&activate_default_eps_bearer_context_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_CONNECTIVITY_TYPE_TYPE: size = nas_decode_connectivity_type(&activate_default_eps_bearer_context_request->connectivity_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_CONNECTIVITY_TYPE_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE: size = nas_decode_wlan_offload_acceptability(&activate_default_eps_bearer_context_request->wlan_offload_indication, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&activate_default_eps_bearer_context_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE: size = nas_decode_header_compression_configuration(&activate_default_eps_bearer_context_request->header_compression_configuration, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_CONTROL_PLANE_ONLY_INDICATION_TYPE: size = nas_decode_control_plane_only_indication(&activate_default_eps_bearer_context_request->control_plane_only_indication, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_CONTROL_PLANE_ONLY_INDICATION_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&activate_default_eps_bearer_context_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_SERVING_PLMN_RATE_CONTROL_TYPE: size = nas_decode_serving_plmn_rate_control(&activate_default_eps_bearer_context_request->serving_plmn_rate_control, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_SERVING_PLMN_RATE_CONTROL_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1560,40 +1536,39 @@ c_int32_t nas_decode_activate_default_eps_bearer_context_request(nas_message_t * return decoded; } -c_int32_t nas_decode_activate_default_eps_bearer_context_accept(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_activate_default_eps_bearer_context_accept(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_activate_default_eps_bearer_context_accept_t *activate_default_eps_bearer_context_accept = &message->esm.activate_default_eps_bearer_context_accept; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Decode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&activate_default_eps_bearer_context_accept->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_accept->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&activate_default_eps_bearer_context_accept->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_accept->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1601,44 +1576,43 @@ c_int32_t nas_decode_activate_default_eps_bearer_context_accept(nas_message_t *m return decoded; } -c_int32_t nas_decode_activate_default_eps_bearer_context_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_activate_default_eps_bearer_context_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_activate_default_eps_bearer_context_reject_t *activate_default_eps_bearer_context_reject = &message->esm.activate_default_eps_bearer_context_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT\n"); + ogs_trace("[NAS] Decode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT\n"); size = nas_decode_esm_cause(&activate_default_eps_bearer_context_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&activate_default_eps_bearer_context_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_reject->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&activate_default_eps_bearer_context_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_default_eps_bearer_context_reject->presencemask |= NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1646,94 +1620,93 @@ c_int32_t nas_decode_activate_default_eps_bearer_context_reject(nas_message_t *m return decoded; } -c_int32_t nas_decode_activate_dedicated_eps_bearer_context_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_activate_dedicated_eps_bearer_context_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_activate_dedicated_eps_bearer_context_request_t *activate_dedicated_eps_bearer_context_request = &message->esm.activate_dedicated_eps_bearer_context_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Decode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST\n"); size = nas_decode_linked_eps_bearer_identity(&activate_dedicated_eps_bearer_context_request->linked_eps_bearer_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_eps_quality_of_service(&activate_dedicated_eps_bearer_context_request->eps_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_traffic_flow_template(&activate_dedicated_eps_bearer_context_request->tft, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_TYPE: size = nas_decode_transaction_identifier(&activate_dedicated_eps_bearer_context_request->transaction_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_TYPE: size = nas_decode_quality_of_service(&activate_dedicated_eps_bearer_context_request->negotiated_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_TYPE: size = nas_decode_llc_service_access_point_identifier(&activate_dedicated_eps_bearer_context_request->negotiated_llc_sapi, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_TYPE: size = nas_decode_radio_priority(&activate_dedicated_eps_bearer_context_request->radio_priority, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_TYPE: size = nas_decode_packet_flow_identifier(&activate_dedicated_eps_bearer_context_request->packet_flow_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE: size = nas_decode_wlan_offload_acceptability(&activate_dedicated_eps_bearer_context_request->wlan_offload_indication, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&activate_dedicated_eps_bearer_context_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&activate_dedicated_eps_bearer_context_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_request->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1741,46 +1714,45 @@ c_int32_t nas_decode_activate_dedicated_eps_bearer_context_request(nas_message_t return decoded; } -c_int32_t nas_decode_activate_dedicated_eps_bearer_context_accept(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_activate_dedicated_eps_bearer_context_accept(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_activate_dedicated_eps_bearer_context_accept_t *activate_dedicated_eps_bearer_context_accept = &message->esm.activate_dedicated_eps_bearer_context_accept; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Decode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_accept->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_accept->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&activate_dedicated_eps_bearer_context_accept->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_accept->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&activate_dedicated_eps_bearer_context_accept->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_accept->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1788,50 +1760,49 @@ c_int32_t nas_decode_activate_dedicated_eps_bearer_context_accept(nas_message_t return decoded; } -c_int32_t nas_decode_activate_dedicated_eps_bearer_context_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_activate_dedicated_eps_bearer_context_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_activate_dedicated_eps_bearer_context_reject_t *activate_dedicated_eps_bearer_context_reject = &message->esm.activate_dedicated_eps_bearer_context_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT\n"); + ogs_trace("[NAS] Decode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT\n"); size = nas_decode_esm_cause(&activate_dedicated_eps_bearer_context_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_reject->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&activate_dedicated_eps_bearer_context_reject->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_reject->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&activate_dedicated_eps_bearer_context_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); activate_dedicated_eps_bearer_context_reject->presencemask |= NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1839,100 +1810,99 @@ c_int32_t nas_decode_activate_dedicated_eps_bearer_context_reject(nas_message_t return decoded; } -c_int32_t nas_decode_modify_eps_bearer_context_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_modify_eps_bearer_context_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_modify_eps_bearer_context_request_t *modify_eps_bearer_context_request = &message->esm.modify_eps_bearer_context_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode MODIFY_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Decode MODIFY_EPS_BEARER_CONTEXT_REQUEST\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_TYPE: size = nas_decode_eps_quality_of_service(&modify_eps_bearer_context_request->new_eps_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_TYPE: size = nas_decode_traffic_flow_template(&modify_eps_bearer_context_request->tft, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_TYPE: size = nas_decode_quality_of_service(&modify_eps_bearer_context_request->new_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_TYPE: size = nas_decode_llc_service_access_point_identifier(&modify_eps_bearer_context_request->negotiated_llc_sapi, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_TYPE: size = nas_decode_radio_priority(&modify_eps_bearer_context_request->radio_priority, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_TYPE: size = nas_decode_packet_flow_identifier(&modify_eps_bearer_context_request->packet_flow_identifier, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_TYPE: size = nas_decode_apn_aggregate_maximum_bit_rate(&modify_eps_bearer_context_request->apn_ambr, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&modify_eps_bearer_context_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE: size = nas_decode_wlan_offload_acceptability(&modify_eps_bearer_context_request->wlan_offload_indication, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&modify_eps_bearer_context_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE: size = nas_decode_header_compression_configuration(&modify_eps_bearer_context_request->header_compression_configuration, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&modify_eps_bearer_context_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1940,46 +1910,45 @@ c_int32_t nas_decode_modify_eps_bearer_context_request(nas_message_t *message, p return decoded; } -c_int32_t nas_decode_modify_eps_bearer_context_accept(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_modify_eps_bearer_context_accept(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_modify_eps_bearer_context_accept_t *modify_eps_bearer_context_accept = &message->esm.modify_eps_bearer_context_accept; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode MODIFY_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Decode MODIFY_EPS_BEARER_CONTEXT_ACCEPT\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&modify_eps_bearer_context_accept->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_accept->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&modify_eps_bearer_context_accept->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_accept->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&modify_eps_bearer_context_accept->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_accept->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -1987,50 +1956,49 @@ c_int32_t nas_decode_modify_eps_bearer_context_accept(nas_message_t *message, pk return decoded; } -c_int32_t nas_decode_modify_eps_bearer_context_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_modify_eps_bearer_context_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_modify_eps_bearer_context_reject_t *modify_eps_bearer_context_reject = &message->esm.modify_eps_bearer_context_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode MODIFY_EPS_BEARER_CONTEXT_REJECT\n"); + ogs_trace("[NAS] Decode MODIFY_EPS_BEARER_CONTEXT_REJECT\n"); size = nas_decode_esm_cause(&modify_eps_bearer_context_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&modify_eps_bearer_context_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_reject->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&modify_eps_bearer_context_reject->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_reject->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&modify_eps_bearer_context_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); modify_eps_bearer_context_reject->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2038,62 +2006,61 @@ c_int32_t nas_decode_modify_eps_bearer_context_reject(nas_message_t *message, pk return decoded; } -c_int32_t nas_decode_deactivate_eps_bearer_context_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_deactivate_eps_bearer_context_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_deactivate_eps_bearer_context_request_t *deactivate_eps_bearer_context_request = &message->esm.deactivate_eps_bearer_context_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Decode DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST\n"); size = nas_decode_esm_cause(&deactivate_eps_bearer_context_request->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&deactivate_eps_bearer_context_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_request->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_T3396_VALUE_TYPE: size = nas_decode_gprs_timer_3(&deactivate_eps_bearer_context_request->t3396_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_request->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_T3396_VALUE_PRESENT; decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE: size = nas_decode_wlan_offload_acceptability(&deactivate_eps_bearer_context_request->wlan_offload_indication, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_request->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_PRESENT; decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&deactivate_eps_bearer_context_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_request->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&deactivate_eps_bearer_context_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_request->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2101,40 +2068,39 @@ c_int32_t nas_decode_deactivate_eps_bearer_context_request(nas_message_t *messag return decoded; } -c_int32_t nas_decode_deactivate_eps_bearer_context_accept(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_deactivate_eps_bearer_context_accept(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_deactivate_eps_bearer_context_accept_t *deactivate_eps_bearer_context_accept = &message->esm.deactivate_eps_bearer_context_accept; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Decode DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&deactivate_eps_bearer_context_accept->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_accept->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&deactivate_eps_bearer_context_accept->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); deactivate_eps_bearer_context_accept->presencemask |= NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2142,74 +2108,73 @@ c_int32_t nas_decode_deactivate_eps_bearer_context_accept(nas_message_t *message return decoded; } -c_int32_t nas_decode_pdn_connectivity_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_pdn_connectivity_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_pdn_connectivity_request_t *pdn_connectivity_request = &message->esm.pdn_connectivity_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode PDN_CONNECTIVITY_REQUEST\n"); + ogs_trace("[NAS] Decode PDN_CONNECTIVITY_REQUEST\n"); size = nas_decode_request_type(&pdn_connectivity_request->request_type, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_TYPE: size = nas_decode_esm_information_transfer_flag(&pdn_connectivity_request->esm_information_transfer_flag, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_TYPE: size = nas_decode_access_point_name(&pdn_connectivity_request->access_point_name, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&pdn_connectivity_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST_DEVICE_PROPERTIES_TYPE: size = nas_decode_device_properties(&pdn_connectivity_request->device_properties, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_DEVICE_PROPERTIES_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&pdn_connectivity_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE: size = nas_decode_header_compression_configuration(&pdn_connectivity_request->header_compression_configuration, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&pdn_connectivity_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_request->presencemask |= NAS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2217,62 +2182,61 @@ c_int32_t nas_decode_pdn_connectivity_request(nas_message_t *message, pkbuf_t *p return decoded; } -c_int32_t nas_decode_pdn_connectivity_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_pdn_connectivity_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_pdn_connectivity_reject_t *pdn_connectivity_reject = &message->esm.pdn_connectivity_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode PDN_CONNECTIVITY_REJECT\n"); + ogs_trace("[NAS] Decode PDN_CONNECTIVITY_REJECT\n"); size = nas_decode_esm_cause(&pdn_connectivity_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&pdn_connectivity_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_reject->presencemask |= NAS_PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REJECT_BACK_OFF_TIMER_VALUE_TYPE: size = nas_decode_gprs_timer_3(&pdn_connectivity_reject->back_off_timer_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_reject->presencemask |= NAS_PDN_CONNECTIVITY_REJECT_BACK_OFF_TIMER_VALUE_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REJECT_RE_ATTEMPT_INDICATOR_TYPE: size = nas_decode_re_attempt_indicator(&pdn_connectivity_reject->re_attempt_indicator, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_reject->presencemask |= NAS_PDN_CONNECTIVITY_REJECT_RE_ATTEMPT_INDICATOR_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REJECT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&pdn_connectivity_reject->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_reject->presencemask |= NAS_PDN_CONNECTIVITY_REJECT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_PDN_CONNECTIVITY_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&pdn_connectivity_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_connectivity_reject->presencemask |= NAS_PDN_CONNECTIVITY_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2280,44 +2244,43 @@ c_int32_t nas_decode_pdn_connectivity_reject(nas_message_t *message, pkbuf_t *pk return decoded; } -c_int32_t nas_decode_pdn_disconnect_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_pdn_disconnect_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_pdn_disconnect_request_t *pdn_disconnect_request = &message->esm.pdn_disconnect_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode PDN_DISCONNECT_REQUEST\n"); + ogs_trace("[NAS] Decode PDN_DISCONNECT_REQUEST\n"); size = nas_decode_linked_eps_bearer_identity(&pdn_disconnect_request->linked_eps_bearer_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&pdn_disconnect_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_disconnect_request->presencemask |= NAS_PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_PDN_DISCONNECT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&pdn_disconnect_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_disconnect_request->presencemask |= NAS_PDN_DISCONNECT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2325,44 +2288,43 @@ c_int32_t nas_decode_pdn_disconnect_request(nas_message_t *message, pkbuf_t *pkb return decoded; } -c_int32_t nas_decode_pdn_disconnect_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_pdn_disconnect_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_pdn_disconnect_reject_t *pdn_disconnect_reject = &message->esm.pdn_disconnect_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode PDN_DISCONNECT_REJECT\n"); + ogs_trace("[NAS] Decode PDN_DISCONNECT_REJECT\n"); size = nas_decode_esm_cause(&pdn_disconnect_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&pdn_disconnect_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_disconnect_reject->presencemask |= NAS_PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_PDN_DISCONNECT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&pdn_disconnect_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); pdn_disconnect_reject->presencemask |= NAS_PDN_DISCONNECT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2370,64 +2332,63 @@ c_int32_t nas_decode_pdn_disconnect_reject(nas_message_t *message, pkbuf_t *pkbu return decoded; } -c_int32_t nas_decode_bearer_resource_allocation_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_bearer_resource_allocation_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_bearer_resource_allocation_request_t *bearer_resource_allocation_request = &message->esm.bearer_resource_allocation_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode BEARER_RESOURCE_ALLOCATION_REQUEST\n"); + ogs_trace("[NAS] Decode BEARER_RESOURCE_ALLOCATION_REQUEST\n"); size = nas_decode_linked_eps_bearer_identity(&bearer_resource_allocation_request->linked_eps_bearer_identity, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_traffic_flow_aggregate_description(&bearer_resource_allocation_request->traffic_flow_aggregate, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_eps_quality_of_service(&bearer_resource_allocation_request->required_traffic_flow_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&bearer_resource_allocation_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_request->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_DEVICE_PROPERTIES_TYPE: size = nas_decode_device_properties(&bearer_resource_allocation_request->device_properties, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_request->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_DEVICE_PROPERTIES_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&bearer_resource_allocation_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_request->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&bearer_resource_allocation_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_request->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2435,62 +2396,61 @@ c_int32_t nas_decode_bearer_resource_allocation_request(nas_message_t *message, return decoded; } -c_int32_t nas_decode_bearer_resource_allocation_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_bearer_resource_allocation_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_bearer_resource_allocation_reject_t *bearer_resource_allocation_reject = &message->esm.bearer_resource_allocation_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode BEARER_RESOURCE_ALLOCATION_REJECT\n"); + ogs_trace("[NAS] Decode BEARER_RESOURCE_ALLOCATION_REJECT\n"); size = nas_decode_esm_cause(&bearer_resource_allocation_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&bearer_resource_allocation_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_reject->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE: size = nas_decode_gprs_timer_3(&bearer_resource_allocation_reject->back_off_timer_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_reject->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE: size = nas_decode_re_attempt_indicator(&bearer_resource_allocation_reject->re_attempt_indicator, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_reject->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REJECT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&bearer_resource_allocation_reject->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_reject->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REJECT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&bearer_resource_allocation_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_allocation_reject->presencemask |= NAS_BEARER_RESOURCE_ALLOCATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2498,78 +2458,77 @@ c_int32_t nas_decode_bearer_resource_allocation_reject(nas_message_t *message, p return decoded; } -c_int32_t nas_decode_bearer_resource_modification_request(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_bearer_resource_modification_request(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_bearer_resource_modification_request_t *bearer_resource_modification_request = &message->esm.bearer_resource_modification_request; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode BEARER_RESOURCE_MODIFICATION_REQUEST\n"); + ogs_trace("[NAS] Decode BEARER_RESOURCE_MODIFICATION_REQUEST\n"); size = nas_decode_linked_eps_bearer_identity(&bearer_resource_modification_request->eps_bearer_identity_for_packet_filter, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; size = nas_decode_traffic_flow_aggregate_description(&bearer_resource_modification_request->traffic_flow_aggregate, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_TYPE: size = nas_decode_eps_quality_of_service(&bearer_resource_modification_request->required_traffic_flow_qos, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_TYPE: size = nas_decode_esm_cause(&bearer_resource_modification_request->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&bearer_resource_modification_request->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_DEVICE_PROPERTIES_TYPE: size = nas_decode_device_properties(&bearer_resource_modification_request->device_properties, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_DEVICE_PROPERTIES_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&bearer_resource_modification_request->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE: size = nas_decode_header_compression_configuration(&bearer_resource_modification_request->header_compression_configuration, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&bearer_resource_modification_request->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_request->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2577,62 +2536,61 @@ c_int32_t nas_decode_bearer_resource_modification_request(nas_message_t *message return decoded; } -c_int32_t nas_decode_bearer_resource_modification_reject(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_bearer_resource_modification_reject(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_bearer_resource_modification_reject_t *bearer_resource_modification_reject = &message->esm.bearer_resource_modification_reject; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode BEARER_RESOURCE_MODIFICATION_REJECT\n"); + ogs_trace("[NAS] Decode BEARER_RESOURCE_MODIFICATION_REJECT\n"); size = nas_decode_esm_cause(&bearer_resource_modification_reject->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&bearer_resource_modification_reject->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_reject->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE: size = nas_decode_gprs_timer_3(&bearer_resource_modification_reject->back_off_timer_value, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_reject->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE: size = nas_decode_re_attempt_indicator(&bearer_resource_modification_reject->re_attempt_indicator, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_reject->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REJECT_NBIFOM_CONTAINER_TYPE: size = nas_decode_nbifom_container(&bearer_resource_modification_reject->nbifom_container, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_reject->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REJECT_NBIFOM_CONTAINER_PRESENT; decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&bearer_resource_modification_reject->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); bearer_resource_modification_reject->presencemask |= NAS_BEARER_RESOURCE_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2640,46 +2598,45 @@ c_int32_t nas_decode_bearer_resource_modification_reject(nas_message_t *message, return decoded; } -c_int32_t nas_decode_esm_information_response(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_esm_information_response(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_esm_information_response_t *esm_information_response = &message->esm.esm_information_response; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ESM_INFORMATION_RESPONSE\n"); + ogs_trace("[NAS] Decode ESM_INFORMATION_RESPONSE\n"); while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) { case NAS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_TYPE: size = nas_decode_access_point_name(&esm_information_response->access_point_name, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); esm_information_response->presencemask |= NAS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT; decoded += size; break; case NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_protocol_configuration_options(&esm_information_response->protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); esm_information_response->presencemask |= NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; case NAS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE: size = nas_decode_extended_protocol_configuration_options(&esm_information_response->extended_protocol_configuration_options, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); esm_information_response->presencemask |= NAS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; decoded += size; break; default: - d_warn("Unknown type(0x%x) or not implemented\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\n", type); break; } } @@ -2687,46 +2644,44 @@ c_int32_t nas_decode_esm_information_response(nas_message_t *message, pkbuf_t *p return decoded; } -c_int32_t nas_decode_esm_status(nas_message_t *message, pkbuf_t *pkbuf) +int nas_decode_esm_status(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_esm_status_t *esm_status = &message->esm.esm_status; - c_int32_t decoded = 0; - c_int32_t size = 0; + int decoded = 0; + int size = 0; - d_trace(25, "[NAS] Decode ESM_STATUS\n"); + ogs_trace("[NAS] Decode ESM_STATUS\n"); size = nas_decode_esm_cause(&esm_status->esm_cause, pkbuf); - d_assert(size >= 0, return -1, "decode failed"); + ogs_assert(size >= 0); decoded += size; return decoded; } -status_t nas_emm_decode(nas_message_t *message, pkbuf_t *pkbuf) +int nas_emm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf) { - status_t rv = CORE_ERROR; - c_uint16_t size = 0; - c_uint16_t decoded = 0; + uint16_t size = 0; + uint16_t decoded = 0; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); memset(message, 0, sizeof(nas_message_t)); size = sizeof(nas_emm_header_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); - memcpy(&message->emm.h, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(&message->emm.h, pkbuf->data - size, size); decoded += size; if (message->emm.h.security_header_type >= NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { - d_assert(pkbuf_header(pkbuf, 1) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); decoded -= 1; size = nas_decode_service_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; goto out; @@ -2736,307 +2691,304 @@ status_t nas_emm_decode(nas_message_t *message, pkbuf_t *pkbuf) { case NAS_ATTACH_REQUEST: size = nas_decode_attach_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ATTACH_ACCEPT: size = nas_decode_attach_accept(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ATTACH_COMPLETE: size = nas_decode_attach_complete(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ATTACH_REJECT: size = nas_decode_attach_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_DETACH_REQUEST: size = nas_decode_detach_request_from_ue(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_DETACH_ACCEPT: break; case NAS_TRACKING_AREA_UPDATE_REQUEST: size = nas_decode_tracking_area_update_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT: size = nas_decode_tracking_area_update_accept(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_TRACKING_AREA_UPDATE_COMPLETE: break; case NAS_TRACKING_AREA_UPDATE_REJECT: size = nas_decode_tracking_area_update_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_EXTENDED_SERVICE_REQUEST: size = nas_decode_extended_service_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_SERVICE_REJECT: size = nas_decode_service_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_GUTI_REALLOCATION_COMMAND: size = nas_decode_guti_reallocation_command(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_GUTI_REALLOCATION_COMPLETE: break; case NAS_AUTHENTICATION_REQUEST: size = nas_decode_authentication_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_AUTHENTICATION_RESPONSE: size = nas_decode_authentication_response(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_AUTHENTICATION_REJECT: break; case NAS_IDENTITY_REQUEST: size = nas_decode_identity_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_IDENTITY_RESPONSE: size = nas_decode_identity_response(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_AUTHENTICATION_FAILURE: size = nas_decode_authentication_failure(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_SECURITY_MODE_COMMAND: size = nas_decode_security_mode_command(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_SECURITY_MODE_COMPLETE: size = nas_decode_security_mode_complete(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_SECURITY_MODE_REJECT: size = nas_decode_security_mode_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_EMM_STATUS: size = nas_decode_emm_status(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_EMM_INFORMATION: size = nas_decode_emm_information(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_DOWNLINK_NAS_TRANSPORT: size = nas_decode_downlink_nas_transport(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_UPLINK_NAS_TRANSPORT: size = nas_decode_uplink_nas_transport(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_CS_SERVICE_NOTIFICATION: size = nas_decode_cs_service_notification(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_UPLINK_GENERIC_NAS_TRANSPORT: size = nas_decode_uplink_generic_nas_transport(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_DOWNLINK_GENERIC_NAS_TRANSPORT: size = nas_decode_downlink_generic_nas_transport(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->emm.h.message_type); break; } out: - rv = pkbuf_header(pkbuf, decoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(pkbuf, decoded)); - return CORE_OK; + return OGS_OK; } -status_t nas_esm_decode(nas_message_t *message, pkbuf_t *pkbuf) +int nas_esm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf) { - status_t rv = CORE_ERROR; - c_uint16_t size = 0; - c_uint16_t decoded = 0; + uint16_t size = 0; + uint16_t decoded = 0; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); memset(message, 0, sizeof(nas_message_t)); size = sizeof(nas_esm_header_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); - memcpy(&message->esm.h, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(&message->esm.h, pkbuf->data - size, size); decoded += size; switch(message->esm.h.message_type) { case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: size = nas_decode_activate_default_eps_bearer_context_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: size = nas_decode_activate_default_eps_bearer_context_accept(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: size = nas_decode_activate_default_eps_bearer_context_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: size = nas_decode_activate_dedicated_eps_bearer_context_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: size = nas_decode_activate_dedicated_eps_bearer_context_accept(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: size = nas_decode_activate_dedicated_eps_bearer_context_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST: size = nas_decode_modify_eps_bearer_context_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT: size = nas_decode_modify_eps_bearer_context_accept(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT: size = nas_decode_modify_eps_bearer_context_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: size = nas_decode_deactivate_eps_bearer_context_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: size = nas_decode_deactivate_eps_bearer_context_accept(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST: size = nas_decode_pdn_connectivity_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_PDN_CONNECTIVITY_REJECT: size = nas_decode_pdn_connectivity_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_PDN_DISCONNECT_REQUEST: size = nas_decode_pdn_disconnect_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_PDN_DISCONNECT_REJECT: size = nas_decode_pdn_disconnect_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REQUEST: size = nas_decode_bearer_resource_allocation_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REJECT: size = nas_decode_bearer_resource_allocation_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST: size = nas_decode_bearer_resource_modification_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REJECT: size = nas_decode_bearer_resource_modification_reject(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ESM_INFORMATION_REQUEST: break; case NAS_ESM_INFORMATION_RESPONSE: size = nas_decode_esm_information_response(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; case NAS_ESM_STATUS: size = nas_decode_esm_status(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; break; default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->esm.h.message_type); break; } - rv = pkbuf_header(pkbuf, decoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(pkbuf, decoded)); - return CORE_OK; + return OGS_OK; } #if 0 /* deprecated */ -status_t nas_plain_decode(nas_message_t *message, pkbuf_t *pkbuf) +int nas_plain_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_security_header_t *h = NULL; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - h = pkbuf->payload; - d_assert(h, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); + h = pkbuf->data; + ogs_assert(h); if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM) return nas_emm_decode(message, pkbuf); else if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_ESM) return nas_esm_decode(message, pkbuf); - d_assert(0, return CORE_ERROR, + ogs_assert_if_reached(); "Invalid Protocol : %d", h->protocol_discriminator); } #endif diff --git a/lib/nas/nas_encoder.c b/lib/nas/nas_encoder.c index 90cafcdb2..2a745df73 100644 --- a/lib/nas/nas_encoder.c +++ b/lib/nas/nas_encoder.c @@ -1,127 +1,121 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by nas_message.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2019-03-17 01:58:02.809354 by acetcom + * Created on: 2019-03-17 02:01:09.610640 by acetcom * from 24301-d80.docx ******************************************************************************/ -#define TRACE_MODULE _nas_encoder - -#include "core_debug.h" #include "nas_message.h" -c_int32_t nas_encode_attach_request(pkbuf_t *pkbuf, nas_message_t *message) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain + +int nas_encode_attach_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_attach_request_t *attach_request = &message->emm.attach_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ATTACH_REQUEST\n"); + ogs_trace("[NAS] Encode ATTACH_REQUEST"); size = nas_encode_eps_attach_type(pkbuf, &attach_request->eps_attach_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &attach_request->eps_mobile_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_ue_network_capability(pkbuf, &attach_request->ue_network_capability); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_esm_message_container(pkbuf, &attach_request->esm_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (attach_request->presencemask & NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_p_tmsi_signature(pkbuf, &attach_request->old_p_tmsi_signature); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &attach_request->additional_guti); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_tracking_area_identity(pkbuf, &attach_request->last_visited_registered_tai); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_DRX_PARAMETER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_DRX_PARAMETER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_drx_parameter(pkbuf, &attach_request->drx_parameter); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_ms_network_capability(pkbuf, &attach_request->ms_network_capability); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_location_area_identification(pkbuf, &attach_request->old_location_area_identification); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -130,40 +124,40 @@ c_int32_t nas_encode_attach_request(pkbuf_t *pkbuf, nas_message_t *message) attach_request->tmsi_status.type = (NAS_ATTACH_REQUEST_TMSI_STATUS_TYPE >> 4); size = nas_encode_tmsi_status(pkbuf, &attach_request->tmsi_status); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_station_classmark_2(pkbuf, &attach_request->mobile_station_classmark_2); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_station_classmark_3(pkbuf, &attach_request->mobile_station_classmark_3); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_SUPPORTED_CODECS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_supported_codec_list(pkbuf, &attach_request->supported_codecs); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -172,18 +166,18 @@ c_int32_t nas_encode_attach_request(pkbuf_t *pkbuf, nas_message_t *message) attach_request->additional_update_type.type = (NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_TYPE >> 4); size = nas_encode_additional_update_type(pkbuf, &attach_request->additional_update_type); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_voice_domain_preference_and_ue_usage_setting(pkbuf, &attach_request->voice_domain_preference_and_ue_usage_setting); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -192,7 +186,7 @@ c_int32_t nas_encode_attach_request(pkbuf_t *pkbuf, nas_message_t *message) attach_request->device_properties.type = (NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_TYPE >> 4); size = nas_encode_device_properties(pkbuf, &attach_request->device_properties); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -201,7 +195,7 @@ c_int32_t nas_encode_attach_request(pkbuf_t *pkbuf, nas_message_t *message) attach_request->old_guti_type.type = (NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_TYPE >> 4); size = nas_encode_guti_type(pkbuf, &attach_request->old_guti_type); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -210,177 +204,177 @@ c_int32_t nas_encode_attach_request(pkbuf_t *pkbuf, nas_message_t *message) attach_request->ms_network_feature_support.type = (NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_TYPE >> 4); size = nas_encode_ms_network_feature_support(pkbuf, &attach_request->ms_network_feature_support); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_network_resource_identifier_container(pkbuf, &attach_request->tmsi_based_nri_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_T3324_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_T3324_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &attach_request->t3324_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &attach_request->t3412_extended_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_request->presencemask & NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_drx_parameters(pkbuf, &attach_request->extended_drx_parameters); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_attach_accept(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_attach_accept(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_attach_accept_t *attach_accept = &message->emm.attach_accept; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ATTACH_ACCEPT\n"); + ogs_trace("[NAS] Encode ATTACH_ACCEPT"); size = nas_encode_eps_attach_result(pkbuf, &attach_accept->eps_attach_result); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer(pkbuf, &attach_accept->t3412_value); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_tracking_area_identity_list(pkbuf, &attach_accept->tai_list); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_esm_message_container(pkbuf, &attach_accept->esm_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_GUTI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_GUTI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &attach_accept->guti); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_location_area_identification(pkbuf, &attach_accept->location_area_identification); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_MS_IDENTITY_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_identity(pkbuf, &attach_accept->ms_identity); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EMM_CAUSE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_EMM_CAUSE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_emm_cause(pkbuf, &attach_accept->emm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3402_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_T3402_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer(pkbuf, &attach_accept->t3402_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3423_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_T3423_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer(pkbuf, &attach_accept->t3423_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_plmn_list(pkbuf, &attach_accept->equivalent_plmns); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_emergency_number_list(pkbuf, &attach_accept->emergency_number_list); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_network_feature_support(pkbuf, &attach_accept->eps_network_feature_support); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -389,103 +383,103 @@ c_int32_t nas_encode_attach_accept(pkbuf_t *pkbuf, nas_message_t *message) attach_accept->additional_update_result.type = (NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_TYPE >> 4); size = nas_encode_additional_update_result(pkbuf, &attach_accept->additional_update_result); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &attach_accept->t3412_extended_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3324_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_T3324_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &attach_accept->t3324_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_drx_parameters(pkbuf, &attach_accept->extended_drx_parameters); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_attach_complete(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_attach_complete(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_attach_complete_t *attach_complete = &message->emm.attach_complete; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ATTACH_COMPLETE\n"); + ogs_trace("[NAS] Encode ATTACH_COMPLETE"); size = nas_encode_esm_message_container(pkbuf, &attach_complete->esm_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_attach_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_attach_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_attach_reject_t *attach_reject = &message->emm.attach_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ATTACH_REJECT\n"); + ogs_trace("[NAS] Encode ATTACH_REJECT"); size = nas_encode_emm_cause(pkbuf, &attach_reject->emm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (attach_reject->presencemask & NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_esm_message_container(pkbuf, &attach_reject->esm_message_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_reject->presencemask & NAS_ATTACH_REJECT_T3346_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REJECT_T3346_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &attach_reject->t3346_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (attach_reject->presencemask & NAS_ATTACH_REJECT_T3402_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ATTACH_REJECT_T3402_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &attach_reject->t3402_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -494,72 +488,72 @@ c_int32_t nas_encode_attach_reject(pkbuf_t *pkbuf, nas_message_t *message) attach_reject->extended_emm_cause.type = (NAS_ATTACH_REJECT_EXTENDED_EMM_CAUSE_TYPE >> 4); size = nas_encode_extended_emm_cause(pkbuf, &attach_reject->extended_emm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_detach_request_from_ue(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_detach_request_from_ue(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_detach_request_from_ue_t *detach_request_from_ue = &message->emm.detach_request_from_ue; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode DETACH_REQUEST\n"); + ogs_trace("[NAS] Encode DETACH_REQUEST"); size = nas_encode_detach_type(pkbuf, &detach_request_from_ue->detach_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &detach_request_from_ue->eps_mobile_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_detach_request_to_ue(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_detach_request_to_ue(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_detach_request_to_ue_t *detach_request_to_ue = &message->emm.detach_request_to_ue; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode DETACH_REQUEST\n"); + ogs_trace("[NAS] Encode DETACH_REQUEST"); size = nas_encode_detach_type(pkbuf, &detach_request_to_ue->detach_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (detach_request_to_ue->presencemask & NAS_DETACH_REQUEST_EMM_CAUSE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DETACH_REQUEST_EMM_CAUSE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_emm_cause(pkbuf, &detach_request_to_ue->emm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_tracking_area_update_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_tracking_area_update_request_t *tracking_area_update_request = &message->emm.tracking_area_update_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode TRACKING_AREA_UPDATE_REQUEST\n"); + ogs_trace("[NAS] Encode TRACKING_AREA_UPDATE_REQUEST"); size = nas_encode_eps_update_type(pkbuf, &tracking_area_update_request->eps_update_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &tracking_area_update_request->old_guti); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_NON_CURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT) @@ -567,7 +561,7 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->non_current_native_nas_key_set_identifier.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_NON_CURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_TYPE >> 4); size = nas_encode_key_set_identifier(pkbuf, &tracking_area_update_request->non_current_native_nas_key_set_identifier); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -576,73 +570,73 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->gprs_ciphering_key_sequence_number.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_TYPE >> 4); size = nas_encode_ciphering_key_sequence_number(pkbuf, &tracking_area_update_request->gprs_ciphering_key_sequence_number); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_P_TMSI_SIGNATURE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_p_tmsi_signature(pkbuf, &tracking_area_update_request->old_p_tmsi_signature); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &tracking_area_update_request->additional_guti); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_NONCEUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nonce(pkbuf, &tracking_area_update_request->nonceue); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_ue_network_capability(pkbuf, &tracking_area_update_request->ue_network_capability); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_tracking_area_identity(pkbuf, &tracking_area_update_request->last_visited_registered_tai); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_drx_parameter(pkbuf, &tracking_area_update_request->drx_parameter); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -651,40 +645,40 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->ue_radio_capability_information_update_needed.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_TYPE >> 4); size = nas_encode_ue_radio_capability_information_update_needed(pkbuf, &tracking_area_update_request->ue_radio_capability_information_update_needed); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_bearer_context_status(pkbuf, &tracking_area_update_request->eps_bearer_context_status); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_ms_network_capability(pkbuf, &tracking_area_update_request->ms_network_capability); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_location_area_identification(pkbuf, &tracking_area_update_request->old_location_area_identification); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -693,40 +687,40 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->tmsi_status.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_TYPE >> 4); size = nas_encode_tmsi_status(pkbuf, &tracking_area_update_request->tmsi_status); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_station_classmark_2(pkbuf, &tracking_area_update_request->mobile_station_classmark_2); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_station_classmark_3(pkbuf, &tracking_area_update_request->mobile_station_classmark_3); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_supported_codec_list(pkbuf, &tracking_area_update_request->supported_codecs); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -735,18 +729,18 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->additional_update_type.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_TYPE >> 4); size = nas_encode_additional_update_type(pkbuf, &tracking_area_update_request->additional_update_type); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_voice_domain_preference_and_ue_usage_setting(pkbuf, &tracking_area_update_request->voice_domain_preference_and_ue_usage_setting); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -755,7 +749,7 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->old_guti_type.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_TYPE >> 4); size = nas_encode_guti_type(pkbuf, &tracking_area_update_request->old_guti_type); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -764,7 +758,7 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->device_properties.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_DEVICE_PROPERTIES_TYPE >> 4); size = nas_encode_device_properties(pkbuf, &tracking_area_update_request->device_properties); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -773,198 +767,198 @@ c_int32_t nas_encode_tracking_area_update_request(pkbuf_t *pkbuf, nas_message_t tracking_area_update_request->ms_network_feature_support.type = (NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_FEATURE_SUPPORT_TYPE >> 4); size = nas_encode_ms_network_feature_support(pkbuf, &tracking_area_update_request->ms_network_feature_support); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_BASED_NRI_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_TMSI_BASED_NRI_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_network_resource_identifier_container(pkbuf, &tracking_area_update_request->tmsi_based_nri_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_T3324_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_T3324_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &tracking_area_update_request->t3324_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_T3412_EXTENDED_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_T3412_EXTENDED_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &tracking_area_update_request->t3412_extended_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_request->presencemask & NAS_TRACKING_AREA_UPDATE_REQUEST_EXTENDED_DRX_PARAMETERS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_drx_parameters(pkbuf, &tracking_area_update_request->extended_drx_parameters); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_tracking_area_update_accept(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_tracking_area_update_accept(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_tracking_area_update_accept_t *tracking_area_update_accept = &message->emm.tracking_area_update_accept; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode TRACKING_AREA_UPDATE_ACCEPT\n"); + ogs_trace("[NAS] Encode TRACKING_AREA_UPDATE_ACCEPT"); size = nas_encode_eps_update_result(pkbuf, &tracking_area_update_accept->eps_update_result); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer(pkbuf, &tracking_area_update_accept->t3412_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_GUTI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_mobile_identity(pkbuf, &tracking_area_update_accept->guti); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_tracking_area_identity_list(pkbuf, &tracking_area_update_accept->tai_list); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_bearer_context_status(pkbuf, &tracking_area_update_accept->eps_bearer_context_status); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_location_area_identification(pkbuf, &tracking_area_update_accept->location_area_identification); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_identity(pkbuf, &tracking_area_update_accept->ms_identity); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_emm_cause(pkbuf, &tracking_area_update_accept->emm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer(pkbuf, &tracking_area_update_accept->t3402_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer(pkbuf, &tracking_area_update_accept->t3423_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_plmn_list(pkbuf, &tracking_area_update_accept->equivalent_plmns); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_emergency_number_list(pkbuf, &tracking_area_update_accept->emergency_number_list); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_network_feature_support(pkbuf, &tracking_area_update_accept->eps_network_feature_support); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -973,77 +967,77 @@ c_int32_t nas_encode_tracking_area_update_accept(pkbuf_t *pkbuf, nas_message_t * tracking_area_update_accept->additional_update_result.type = (NAS_TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_TYPE >> 4); size = nas_encode_additional_update_result(pkbuf, &tracking_area_update_accept->additional_update_result); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_EXTENDED_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_T3412_EXTENDED_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &tracking_area_update_accept->t3412_extended_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_T3324_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_T3324_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &tracking_area_update_accept->t3324_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_drx_parameters(pkbuf, &tracking_area_update_accept->extended_drx_parameters); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (tracking_area_update_accept->presencemask & NAS_TRACKING_AREA_UPDATE_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_STATUS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_STATUS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_header_compression_configuration_status(pkbuf, &tracking_area_update_accept->header_compression_configuration_status); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_tracking_area_update_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_tracking_area_update_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_tracking_area_update_reject_t *tracking_area_update_reject = &message->emm.tracking_area_update_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode TRACKING_AREA_UPDATE_REJECT\n"); + ogs_trace("[NAS] Encode TRACKING_AREA_UPDATE_REJECT"); size = nas_encode_emm_cause(pkbuf, &tracking_area_update_reject->emm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (tracking_area_update_reject->presencemask & NAS_TRACKING_AREA_UPDATE_REJECT_T3346_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_TRACKING_AREA_UPDATE_REJECT_T3346_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &tracking_area_update_reject->t3346_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1052,27 +1046,27 @@ c_int32_t nas_encode_tracking_area_update_reject(pkbuf_t *pkbuf, nas_message_t * tracking_area_update_reject->extended_emm_cause.type = (NAS_TRACKING_AREA_UPDATE_REJECT_EXTENDED_EMM_CAUSE_TYPE >> 4); size = nas_encode_extended_emm_cause(pkbuf, &tracking_area_update_reject->extended_emm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_extended_service_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_extended_service_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_extended_service_request_t *extended_service_request = &message->emm.extended_service_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode EXTENDED_SERVICE_REQUEST\n"); + ogs_trace("[NAS] Encode EXTENDED_SERVICE_REQUEST"); size = nas_encode_service_type(pkbuf, &extended_service_request->service_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_identity(pkbuf, &extended_service_request->m_tmsi); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (extended_service_request->presencemask & NAS_EXTENDED_SERVICE_REQUEST_CSFB_RESPONSE_PRESENT) @@ -1080,18 +1074,18 @@ c_int32_t nas_encode_extended_service_request(pkbuf_t *pkbuf, nas_message_t *mes extended_service_request->csfb_response.type = (NAS_EXTENDED_SERVICE_REQUEST_CSFB_RESPONSE_TYPE >> 4); size = nas_encode_csfb_response(pkbuf, &extended_service_request->csfb_response); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (extended_service_request->presencemask & NAS_EXTENDED_SERVICE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_EXTENDED_SERVICE_REQUEST_EPS_BEARER_CONTEXT_STATUS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_bearer_context_status(pkbuf, &extended_service_request->eps_bearer_context_status); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1100,196 +1094,196 @@ c_int32_t nas_encode_extended_service_request(pkbuf_t *pkbuf, nas_message_t *mes extended_service_request->device_properties.type = (NAS_EXTENDED_SERVICE_REQUEST_DEVICE_PROPERTIES_TYPE >> 4); size = nas_encode_device_properties(pkbuf, &extended_service_request->device_properties); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_service_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_service_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_service_request_t *service_request = &message->emm.service_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode SERVICE_REQUEST\n"); + ogs_trace("[NAS] Encode SERVICE_REQUEST"); size = nas_encode_ksi_and_sequence_number(pkbuf, &service_request->ksi_and_sequence_number); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_short_mac(pkbuf, &service_request->message_authentication_code); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_service_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_service_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_service_reject_t *service_reject = &message->emm.service_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode SERVICE_REJECT\n"); + ogs_trace("[NAS] Encode SERVICE_REJECT"); size = nas_encode_emm_cause(pkbuf, &service_reject->emm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (service_reject->presencemask & NAS_SERVICE_REJECT_T3346_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_SERVICE_REJECT_T3346_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_2(pkbuf, &service_reject->t3346_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_guti_reallocation_command(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_guti_reallocation_command(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_guti_reallocation_command_t *guti_reallocation_command = &message->emm.guti_reallocation_command; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode GUTI_REALLOCATION_COMMAND\n"); + ogs_trace("[NAS] Encode GUTI_REALLOCATION_COMMAND"); size = nas_encode_eps_mobile_identity(pkbuf, &guti_reallocation_command->guti); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (guti_reallocation_command->presencemask & NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_tracking_area_identity_list(pkbuf, &guti_reallocation_command->tai_list); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_authentication_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_authentication_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_authentication_request_t *authentication_request = &message->emm.authentication_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode AUTHENTICATION_REQUEST\n"); + ogs_trace("[NAS] Encode AUTHENTICATION_REQUEST"); size = nas_encode_key_set_identifier(pkbuf, &authentication_request->nas_key_set_identifierasme); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_authentication_parameter_rand(pkbuf, &authentication_request->authentication_parameter_rand); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_authentication_parameter_autn(pkbuf, &authentication_request->authentication_parameter_autn); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_authentication_response(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_authentication_response(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_authentication_response_t *authentication_response = &message->emm.authentication_response; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode AUTHENTICATION_RESPONSE\n"); + ogs_trace("[NAS] Encode AUTHENTICATION_RESPONSE"); size = nas_encode_authentication_response_parameter(pkbuf, &authentication_response->authentication_response_parameter); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_identity_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_identity_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_identity_request_t *identity_request = &message->emm.identity_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode IDENTITY_REQUEST\n"); + ogs_trace("[NAS] Encode IDENTITY_REQUEST"); size = nas_encode_identity_type_2(pkbuf, &identity_request->identity_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_identity_response(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_identity_response(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_identity_response_t *identity_response = &message->emm.identity_response; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode IDENTITY_RESPONSE\n"); + ogs_trace("[NAS] Encode IDENTITY_RESPONSE"); size = nas_encode_mobile_identity(pkbuf, &identity_response->mobile_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_authentication_failure(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_authentication_failure(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_authentication_failure_t *authentication_failure = &message->emm.authentication_failure; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode AUTHENTICATION_FAILURE\n"); + ogs_trace("[NAS] Encode AUTHENTICATION_FAILURE"); size = nas_encode_emm_cause(pkbuf, &authentication_failure->emm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (authentication_failure->presencemask & NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_authentication_failure_parameter(pkbuf, &authentication_failure->authentication_failure_parameter); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_security_mode_command(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_security_mode_command(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_security_mode_command_t *security_mode_command = &message->emm.security_mode_command; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode SECURITY_MODE_COMMAND\n"); + ogs_trace("[NAS] Encode SECURITY_MODE_COMMAND"); size = nas_encode_security_algorithms(pkbuf, &security_mode_command->selected_nas_security_algorithms); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_key_set_identifier(pkbuf, &security_mode_command->nas_key_set_identifier); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_ue_security_capability(pkbuf, &security_mode_command->replayed_ue_security_capabilities); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (security_mode_command->presencemask & NAS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT) @@ -1297,352 +1291,352 @@ c_int32_t nas_encode_security_mode_command(pkbuf_t *pkbuf, nas_message_t *messag security_mode_command->imeisv_request.type = (NAS_SECURITY_MODE_COMMAND_IMEISV_REQUEST_TYPE >> 4); size = nas_encode_imeisv_request(pkbuf, &security_mode_command->imeisv_request); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (security_mode_command->presencemask & NAS_SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nonce(pkbuf, &security_mode_command->replayed_nonceue); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (security_mode_command->presencemask & NAS_SECURITY_MODE_COMMAND_NONCEMME_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_SECURITY_MODE_COMMAND_NONCEMME_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nonce(pkbuf, &security_mode_command->noncemme); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_security_mode_complete(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_security_mode_complete(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_security_mode_complete_t *security_mode_complete = &message->emm.security_mode_complete; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode SECURITY_MODE_COMPLETE\n"); + ogs_trace("[NAS] Encode SECURITY_MODE_COMPLETE"); if (security_mode_complete->presencemask & NAS_SECURITY_MODE_COMPLETE_IMEISV_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_SECURITY_MODE_COMPLETE_IMEISV_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_mobile_identity(pkbuf, &security_mode_complete->imeisv); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_security_mode_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_security_mode_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_security_mode_reject_t *security_mode_reject = &message->emm.security_mode_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode SECURITY_MODE_REJECT\n"); + ogs_trace("[NAS] Encode SECURITY_MODE_REJECT"); size = nas_encode_emm_cause(pkbuf, &security_mode_reject->emm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_emm_status(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_emm_status(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_emm_status_t *emm_status = &message->emm.emm_status; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode EMM_STATUS\n"); + ogs_trace("[NAS] Encode EMM_STATUS"); size = nas_encode_emm_cause(pkbuf, &emm_status->emm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_emm_information(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_emm_information(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_emm_information_t *emm_information = &message->emm.emm_information; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode EMM_INFORMATION\n"); + ogs_trace("[NAS] Encode EMM_INFORMATION"); if (emm_information->presencemask & NAS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_network_name(pkbuf, &emm_information->full_name_for_network); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (emm_information->presencemask & NAS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_network_name(pkbuf, &emm_information->short_name_for_network); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (emm_information->presencemask & NAS_EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_EMM_INFORMATION_LOCAL_TIME_ZONE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_time_zone(pkbuf, &emm_information->local_time_zone); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (emm_information->presencemask & NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_time_zone_and_time(pkbuf, &emm_information->universal_time_and_local_time_zone); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (emm_information->presencemask & NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_daylight_saving_time(pkbuf, &emm_information->network_daylight_saving_time); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_downlink_nas_transport(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_downlink_nas_transport(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_downlink_nas_transport_t *downlink_nas_transport = &message->emm.downlink_nas_transport; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode DOWNLINK_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Encode DOWNLINK_NAS_TRANSPORT"); size = nas_encode_message_container(pkbuf, &downlink_nas_transport->nas_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_uplink_nas_transport(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_uplink_nas_transport(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_uplink_nas_transport_t *uplink_nas_transport = &message->emm.uplink_nas_transport; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode UPLINK_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Encode UPLINK_NAS_TRANSPORT"); size = nas_encode_message_container(pkbuf, &uplink_nas_transport->nas_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -c_int32_t nas_encode_cs_service_notification(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_cs_service_notification(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_cs_service_notification_t *cs_service_notification = &message->emm.cs_service_notification; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode CS_SERVICE_NOTIFICATION\n"); + ogs_trace("[NAS] Encode CS_SERVICE_NOTIFICATION"); size = nas_encode_paging_identity(pkbuf, &cs_service_notification->paging_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (cs_service_notification->presencemask & NAS_CS_SERVICE_NOTIFICATION_CLI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_CS_SERVICE_NOTIFICATION_CLI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_cli(pkbuf, &cs_service_notification->cli); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (cs_service_notification->presencemask & NAS_CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_CS_SERVICE_NOTIFICATION_SS_CODE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_ss_code(pkbuf, &cs_service_notification->ss_code); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (cs_service_notification->presencemask & NAS_CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_CS_SERVICE_NOTIFICATION_LCS_INDICATOR_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_lcs_indicator(pkbuf, &cs_service_notification->lcs_indicator); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (cs_service_notification->presencemask & NAS_CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_lcs_client_identity(pkbuf, &cs_service_notification->lcs_client_identity); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_uplink_generic_nas_transport(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_uplink_generic_nas_transport(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_uplink_generic_nas_transport_t *uplink_generic_nas_transport = &message->emm.uplink_generic_nas_transport; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode UPLINK_GENERIC_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Encode UPLINK_GENERIC_NAS_TRANSPORT"); size = nas_encode_generic_message_container_type(pkbuf, &uplink_generic_nas_transport->generic_message_container_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_generic_message_container(pkbuf, &uplink_generic_nas_transport->generic_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (uplink_generic_nas_transport->presencemask & NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_additional_information(pkbuf, &uplink_generic_nas_transport->additional_information); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_downlink_generic_nas_transport(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_downlink_generic_nas_transport(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_downlink_generic_nas_transport_t *downlink_generic_nas_transport = &message->emm.downlink_generic_nas_transport; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode DOWNLINK_GENERIC_NAS_TRANSPORT\n"); + ogs_trace("[NAS] Encode DOWNLINK_GENERIC_NAS_TRANSPORT"); size = nas_encode_generic_message_container_type(pkbuf, &downlink_generic_nas_transport->generic_message_container_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_generic_message_container(pkbuf, &downlink_generic_nas_transport->generic_message_container); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (downlink_generic_nas_transport->presencemask & NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_additional_information(pkbuf, &downlink_generic_nas_transport->additional_information); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_activate_default_eps_bearer_context_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_activate_default_eps_bearer_context_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_activate_default_eps_bearer_context_request_t *activate_default_eps_bearer_context_request = &message->esm.activate_default_eps_bearer_context_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Encode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST"); size = nas_encode_eps_quality_of_service(pkbuf, &activate_default_eps_bearer_context_request->eps_qos); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_access_point_name(pkbuf, &activate_default_eps_bearer_context_request->access_point_name); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_pdn_address(pkbuf, &activate_default_eps_bearer_context_request->pdn_address); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_transaction_identifier(pkbuf, &activate_default_eps_bearer_context_request->transaction_identifier); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_quality_of_service(pkbuf, &activate_default_eps_bearer_context_request->negotiated_qos); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_llc_service_access_point_identifier(pkbuf, &activate_default_eps_bearer_context_request->negotiated_llc_sapi); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1651,51 +1645,51 @@ c_int32_t nas_encode_activate_default_eps_bearer_context_request(pkbuf_t *pkbuf, activate_default_eps_bearer_context_request->radio_priority.type = (NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_TYPE >> 4); size = nas_encode_radio_priority(pkbuf, &activate_default_eps_bearer_context_request->radio_priority); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_packet_flow_identifier(pkbuf, &activate_default_eps_bearer_context_request->packet_flow_identifier); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_apn_aggregate_maximum_bit_rate(pkbuf, &activate_default_eps_bearer_context_request->apn_ambr); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_esm_cause(pkbuf, &activate_default_eps_bearer_context_request->esm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &activate_default_eps_bearer_context_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1704,7 +1698,7 @@ c_int32_t nas_encode_activate_default_eps_bearer_context_request(pkbuf_t *pkbuf, activate_default_eps_bearer_context_request->connectivity_type.type = (NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_CONNECTIVITY_TYPE_TYPE >> 4); size = nas_encode_connectivity_type(pkbuf, &activate_default_eps_bearer_context_request->connectivity_type); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1713,29 +1707,29 @@ c_int32_t nas_encode_activate_default_eps_bearer_context_request(pkbuf_t *pkbuf, activate_default_eps_bearer_context_request->wlan_offload_indication.type = (NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE >> 4); size = nas_encode_wlan_offload_acceptability(pkbuf, &activate_default_eps_bearer_context_request->wlan_offload_indication); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &activate_default_eps_bearer_context_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_header_compression_configuration(pkbuf, &activate_default_eps_bearer_context_request->header_compression_configuration); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1744,155 +1738,155 @@ c_int32_t nas_encode_activate_default_eps_bearer_context_request(pkbuf_t *pkbuf, activate_default_eps_bearer_context_request->control_plane_only_indication.type = (NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_CONTROL_PLANE_ONLY_INDICATION_TYPE >> 4); size = nas_encode_control_plane_only_indication(pkbuf, &activate_default_eps_bearer_context_request->control_plane_only_indication); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &activate_default_eps_bearer_context_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_SERVING_PLMN_RATE_CONTROL_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_SERVING_PLMN_RATE_CONTROL_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_serving_plmn_rate_control(pkbuf, &activate_default_eps_bearer_context_request->serving_plmn_rate_control); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_activate_default_eps_bearer_context_accept(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_activate_default_eps_bearer_context_accept(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_activate_default_eps_bearer_context_accept_t *activate_default_eps_bearer_context_accept = &message->esm.activate_default_eps_bearer_context_accept; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Encode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT"); if (activate_default_eps_bearer_context_accept->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &activate_default_eps_bearer_context_accept->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_accept->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &activate_default_eps_bearer_context_accept->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_activate_default_eps_bearer_context_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_activate_default_eps_bearer_context_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_activate_default_eps_bearer_context_reject_t *activate_default_eps_bearer_context_reject = &message->esm.activate_default_eps_bearer_context_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT\n"); + ogs_trace("[NAS] Encode ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT"); size = nas_encode_esm_cause(pkbuf, &activate_default_eps_bearer_context_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (activate_default_eps_bearer_context_reject->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &activate_default_eps_bearer_context_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_default_eps_bearer_context_reject->presencemask & NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &activate_default_eps_bearer_context_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_activate_dedicated_eps_bearer_context_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_activate_dedicated_eps_bearer_context_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_activate_dedicated_eps_bearer_context_request_t *activate_dedicated_eps_bearer_context_request = &message->esm.activate_dedicated_eps_bearer_context_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Encode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST"); size = nas_encode_linked_eps_bearer_identity(pkbuf, &activate_dedicated_eps_bearer_context_request->linked_eps_bearer_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_quality_of_service(pkbuf, &activate_dedicated_eps_bearer_context_request->eps_qos); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_traffic_flow_template(pkbuf, &activate_dedicated_eps_bearer_context_request->tft); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_transaction_identifier(pkbuf, &activate_dedicated_eps_bearer_context_request->transaction_identifier); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_quality_of_service(pkbuf, &activate_dedicated_eps_bearer_context_request->negotiated_qos); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_llc_service_access_point_identifier(pkbuf, &activate_dedicated_eps_bearer_context_request->negotiated_llc_sapi); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1901,29 +1895,29 @@ c_int32_t nas_encode_activate_dedicated_eps_bearer_context_request(pkbuf_t *pkbu activate_dedicated_eps_bearer_context_request->radio_priority.type = (NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_TYPE >> 4); size = nas_encode_radio_priority(pkbuf, &activate_dedicated_eps_bearer_context_request->radio_priority); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_packet_flow_identifier(pkbuf, &activate_dedicated_eps_bearer_context_request->packet_flow_identifier); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &activate_dedicated_eps_bearer_context_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -1932,176 +1926,176 @@ c_int32_t nas_encode_activate_dedicated_eps_bearer_context_request(pkbuf_t *pkbu activate_dedicated_eps_bearer_context_request->wlan_offload_indication.type = (NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE >> 4); size = nas_encode_wlan_offload_acceptability(pkbuf, &activate_dedicated_eps_bearer_context_request->wlan_offload_indication); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &activate_dedicated_eps_bearer_context_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_request->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &activate_dedicated_eps_bearer_context_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_activate_dedicated_eps_bearer_context_accept(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_activate_dedicated_eps_bearer_context_accept(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_activate_dedicated_eps_bearer_context_accept_t *activate_dedicated_eps_bearer_context_accept = &message->esm.activate_dedicated_eps_bearer_context_accept; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Encode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT"); if (activate_dedicated_eps_bearer_context_accept->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &activate_dedicated_eps_bearer_context_accept->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_accept->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &activate_dedicated_eps_bearer_context_accept->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_accept->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &activate_dedicated_eps_bearer_context_accept->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_activate_dedicated_eps_bearer_context_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_activate_dedicated_eps_bearer_context_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_activate_dedicated_eps_bearer_context_reject_t *activate_dedicated_eps_bearer_context_reject = &message->esm.activate_dedicated_eps_bearer_context_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT\n"); + ogs_trace("[NAS] Encode ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT"); size = nas_encode_esm_cause(pkbuf, &activate_dedicated_eps_bearer_context_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (activate_dedicated_eps_bearer_context_reject->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &activate_dedicated_eps_bearer_context_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_reject->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &activate_dedicated_eps_bearer_context_reject->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (activate_dedicated_eps_bearer_context_reject->presencemask & NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &activate_dedicated_eps_bearer_context_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_modify_eps_bearer_context_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_modify_eps_bearer_context_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_modify_eps_bearer_context_request_t *modify_eps_bearer_context_request = &message->esm.modify_eps_bearer_context_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode MODIFY_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Encode MODIFY_EPS_BEARER_CONTEXT_REQUEST"); if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_quality_of_service(pkbuf, &modify_eps_bearer_context_request->new_eps_qos); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_traffic_flow_template(pkbuf, &modify_eps_bearer_context_request->tft); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_quality_of_service(pkbuf, &modify_eps_bearer_context_request->new_qos); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_llc_service_access_point_identifier(pkbuf, &modify_eps_bearer_context_request->negotiated_llc_sapi); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -2110,40 +2104,40 @@ c_int32_t nas_encode_modify_eps_bearer_context_request(pkbuf_t *pkbuf, nas_messa modify_eps_bearer_context_request->radio_priority.type = (NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_TYPE >> 4); size = nas_encode_radio_priority(pkbuf, &modify_eps_bearer_context_request->radio_priority); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_packet_flow_identifier(pkbuf, &modify_eps_bearer_context_request->packet_flow_identifier); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_apn_aggregate_maximum_bit_rate(pkbuf, &modify_eps_bearer_context_request->apn_ambr); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &modify_eps_bearer_context_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -2152,169 +2146,169 @@ c_int32_t nas_encode_modify_eps_bearer_context_request(pkbuf_t *pkbuf, nas_messa modify_eps_bearer_context_request->wlan_offload_indication.type = (NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE >> 4); size = nas_encode_wlan_offload_acceptability(pkbuf, &modify_eps_bearer_context_request->wlan_offload_indication); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &modify_eps_bearer_context_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_header_compression_configuration(pkbuf, &modify_eps_bearer_context_request->header_compression_configuration); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_request->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &modify_eps_bearer_context_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_modify_eps_bearer_context_accept(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_modify_eps_bearer_context_accept(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_modify_eps_bearer_context_accept_t *modify_eps_bearer_context_accept = &message->esm.modify_eps_bearer_context_accept; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode MODIFY_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Encode MODIFY_EPS_BEARER_CONTEXT_ACCEPT"); if (modify_eps_bearer_context_accept->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &modify_eps_bearer_context_accept->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_accept->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &modify_eps_bearer_context_accept->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_accept->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &modify_eps_bearer_context_accept->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_modify_eps_bearer_context_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_modify_eps_bearer_context_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_modify_eps_bearer_context_reject_t *modify_eps_bearer_context_reject = &message->esm.modify_eps_bearer_context_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode MODIFY_EPS_BEARER_CONTEXT_REJECT\n"); + ogs_trace("[NAS] Encode MODIFY_EPS_BEARER_CONTEXT_REJECT"); size = nas_encode_esm_cause(pkbuf, &modify_eps_bearer_context_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (modify_eps_bearer_context_reject->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &modify_eps_bearer_context_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_reject->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &modify_eps_bearer_context_reject->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (modify_eps_bearer_context_reject->presencemask & NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &modify_eps_bearer_context_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_deactivate_eps_bearer_context_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_deactivate_eps_bearer_context_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_deactivate_eps_bearer_context_request_t *deactivate_eps_bearer_context_request = &message->esm.deactivate_eps_bearer_context_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST\n"); + ogs_trace("[NAS] Encode DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST"); size = nas_encode_esm_cause(pkbuf, &deactivate_eps_bearer_context_request->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (deactivate_eps_bearer_context_request->presencemask & NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &deactivate_eps_bearer_context_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (deactivate_eps_bearer_context_request->presencemask & NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_T3396_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_T3396_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &deactivate_eps_bearer_context_request->t3396_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -2323,78 +2317,78 @@ c_int32_t nas_encode_deactivate_eps_bearer_context_request(pkbuf_t *pkbuf, nas_m deactivate_eps_bearer_context_request->wlan_offload_indication.type = (NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_WLAN_OFFLOAD_INDICATION_TYPE >> 4); size = nas_encode_wlan_offload_acceptability(pkbuf, &deactivate_eps_bearer_context_request->wlan_offload_indication); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (deactivate_eps_bearer_context_request->presencemask & NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &deactivate_eps_bearer_context_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (deactivate_eps_bearer_context_request->presencemask & NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &deactivate_eps_bearer_context_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_deactivate_eps_bearer_context_accept(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_deactivate_eps_bearer_context_accept(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_deactivate_eps_bearer_context_accept_t *deactivate_eps_bearer_context_accept = &message->esm.deactivate_eps_bearer_context_accept; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT\n"); + ogs_trace("[NAS] Encode DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT"); if (deactivate_eps_bearer_context_accept->presencemask & NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &deactivate_eps_bearer_context_accept->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (deactivate_eps_bearer_context_accept->presencemask & NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &deactivate_eps_bearer_context_accept->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_pdn_connectivity_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_pdn_connectivity_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_pdn_connectivity_request_t *pdn_connectivity_request = &message->esm.pdn_connectivity_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode PDN_CONNECTIVITY_REQUEST\n"); + ogs_trace("[NAS] Encode PDN_CONNECTIVITY_REQUEST"); size = nas_encode_request_type(pkbuf, &pdn_connectivity_request->request_type); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (pdn_connectivity_request->presencemask & NAS_PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT) @@ -2402,29 +2396,29 @@ c_int32_t nas_encode_pdn_connectivity_request(pkbuf_t *pkbuf, nas_message_t *mes pdn_connectivity_request->esm_information_transfer_flag.type = (NAS_PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_TYPE >> 4); size = nas_encode_esm_information_transfer_flag(pkbuf, &pdn_connectivity_request->esm_information_transfer_flag); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_request->presencemask & NAS_PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_access_point_name(pkbuf, &pdn_connectivity_request->access_point_name); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_request->presencemask & NAS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &pdn_connectivity_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -2433,218 +2427,218 @@ c_int32_t nas_encode_pdn_connectivity_request(pkbuf_t *pkbuf, nas_message_t *mes pdn_connectivity_request->device_properties.type = (NAS_PDN_CONNECTIVITY_REQUEST_DEVICE_PROPERTIES_TYPE >> 4); size = nas_encode_device_properties(pkbuf, &pdn_connectivity_request->device_properties); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_request->presencemask & NAS_PDN_CONNECTIVITY_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &pdn_connectivity_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_request->presencemask & NAS_PDN_CONNECTIVITY_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_header_compression_configuration(pkbuf, &pdn_connectivity_request->header_compression_configuration); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_request->presencemask & NAS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &pdn_connectivity_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_pdn_connectivity_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_pdn_connectivity_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_pdn_connectivity_reject_t *pdn_connectivity_reject = &message->esm.pdn_connectivity_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode PDN_CONNECTIVITY_REJECT\n"); + ogs_trace("[NAS] Encode PDN_CONNECTIVITY_REJECT"); size = nas_encode_esm_cause(pkbuf, &pdn_connectivity_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (pdn_connectivity_reject->presencemask & NAS_PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &pdn_connectivity_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_reject->presencemask & NAS_PDN_CONNECTIVITY_REJECT_BACK_OFF_TIMER_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REJECT_BACK_OFF_TIMER_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &pdn_connectivity_reject->back_off_timer_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_reject->presencemask & NAS_PDN_CONNECTIVITY_REJECT_RE_ATTEMPT_INDICATOR_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REJECT_RE_ATTEMPT_INDICATOR_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_re_attempt_indicator(pkbuf, &pdn_connectivity_reject->re_attempt_indicator); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_reject->presencemask & NAS_PDN_CONNECTIVITY_REJECT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REJECT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &pdn_connectivity_reject->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_connectivity_reject->presencemask & NAS_PDN_CONNECTIVITY_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_CONNECTIVITY_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &pdn_connectivity_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_pdn_disconnect_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_pdn_disconnect_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_pdn_disconnect_request_t *pdn_disconnect_request = &message->esm.pdn_disconnect_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode PDN_DISCONNECT_REQUEST\n"); + ogs_trace("[NAS] Encode PDN_DISCONNECT_REQUEST"); size = nas_encode_linked_eps_bearer_identity(pkbuf, &pdn_disconnect_request->linked_eps_bearer_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (pdn_disconnect_request->presencemask & NAS_PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &pdn_disconnect_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_disconnect_request->presencemask & NAS_PDN_DISCONNECT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_DISCONNECT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &pdn_disconnect_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_pdn_disconnect_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_pdn_disconnect_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_pdn_disconnect_reject_t *pdn_disconnect_reject = &message->esm.pdn_disconnect_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode PDN_DISCONNECT_REJECT\n"); + ogs_trace("[NAS] Encode PDN_DISCONNECT_REJECT"); size = nas_encode_esm_cause(pkbuf, &pdn_disconnect_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (pdn_disconnect_reject->presencemask & NAS_PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &pdn_disconnect_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (pdn_disconnect_reject->presencemask & NAS_PDN_DISCONNECT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_PDN_DISCONNECT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &pdn_disconnect_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_bearer_resource_allocation_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_bearer_resource_allocation_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_bearer_resource_allocation_request_t *bearer_resource_allocation_request = &message->esm.bearer_resource_allocation_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode BEARER_RESOURCE_ALLOCATION_REQUEST\n"); + ogs_trace("[NAS] Encode BEARER_RESOURCE_ALLOCATION_REQUEST"); size = nas_encode_linked_eps_bearer_identity(pkbuf, &bearer_resource_allocation_request->linked_eps_bearer_identity); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_traffic_flow_aggregate_description(pkbuf, &bearer_resource_allocation_request->traffic_flow_aggregate); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_quality_of_service(pkbuf, &bearer_resource_allocation_request->required_traffic_flow_qos); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (bearer_resource_allocation_request->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &bearer_resource_allocation_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -2653,151 +2647,151 @@ c_int32_t nas_encode_bearer_resource_allocation_request(pkbuf_t *pkbuf, nas_mess bearer_resource_allocation_request->device_properties.type = (NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_DEVICE_PROPERTIES_TYPE >> 4); size = nas_encode_device_properties(pkbuf, &bearer_resource_allocation_request->device_properties); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_allocation_request->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &bearer_resource_allocation_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_allocation_request->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &bearer_resource_allocation_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_bearer_resource_allocation_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_bearer_resource_allocation_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_bearer_resource_allocation_reject_t *bearer_resource_allocation_reject = &message->esm.bearer_resource_allocation_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode BEARER_RESOURCE_ALLOCATION_REJECT\n"); + ogs_trace("[NAS] Encode BEARER_RESOURCE_ALLOCATION_REJECT"); size = nas_encode_esm_cause(pkbuf, &bearer_resource_allocation_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (bearer_resource_allocation_reject->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &bearer_resource_allocation_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_allocation_reject->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &bearer_resource_allocation_reject->back_off_timer_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_allocation_reject->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_re_attempt_indicator(pkbuf, &bearer_resource_allocation_reject->re_attempt_indicator); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_allocation_reject->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REJECT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REJECT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &bearer_resource_allocation_reject->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_allocation_reject->presencemask & NAS_BEARER_RESOURCE_ALLOCATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_ALLOCATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &bearer_resource_allocation_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_bearer_resource_modification_request(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_bearer_resource_modification_request(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_bearer_resource_modification_request_t *bearer_resource_modification_request = &message->esm.bearer_resource_modification_request; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode BEARER_RESOURCE_MODIFICATION_REQUEST\n"); + ogs_trace("[NAS] Encode BEARER_RESOURCE_MODIFICATION_REQUEST"); size = nas_encode_linked_eps_bearer_identity(pkbuf, &bearer_resource_modification_request->eps_bearer_identity_for_packet_filter); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_traffic_flow_aggregate_description(pkbuf, &bearer_resource_modification_request->traffic_flow_aggregate); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (bearer_resource_modification_request->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_eps_quality_of_service(pkbuf, &bearer_resource_modification_request->required_traffic_flow_qos); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_request->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_esm_cause(pkbuf, &bearer_resource_modification_request->esm_cause); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_request->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &bearer_resource_modification_request->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } @@ -2806,203 +2800,202 @@ c_int32_t nas_encode_bearer_resource_modification_request(pkbuf_t *pkbuf, nas_me bearer_resource_modification_request->device_properties.type = (NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_DEVICE_PROPERTIES_TYPE >> 4); size = nas_encode_device_properties(pkbuf, &bearer_resource_modification_request->device_properties); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_request->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &bearer_resource_modification_request->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_request->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_header_compression_configuration(pkbuf, &bearer_resource_modification_request->header_compression_configuration); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_request->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &bearer_resource_modification_request->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_bearer_resource_modification_reject(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_bearer_resource_modification_reject(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_bearer_resource_modification_reject_t *bearer_resource_modification_reject = &message->esm.bearer_resource_modification_reject; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode BEARER_RESOURCE_MODIFICATION_REJECT\n"); + ogs_trace("[NAS] Encode BEARER_RESOURCE_MODIFICATION_REJECT"); size = nas_encode_esm_cause(pkbuf, &bearer_resource_modification_reject->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; if (bearer_resource_modification_reject->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &bearer_resource_modification_reject->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_reject->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REJECT_BACK_OFF_TIMER_VALUE_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_gprs_timer_3(pkbuf, &bearer_resource_modification_reject->back_off_timer_value); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_reject->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REJECT_RE_ATTEMPT_INDICATOR_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_re_attempt_indicator(pkbuf, &bearer_resource_modification_reject->re_attempt_indicator); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_reject->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REJECT_NBIFOM_CONTAINER_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REJECT_NBIFOM_CONTAINER_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_nbifom_container(pkbuf, &bearer_resource_modification_reject->nbifom_container); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (bearer_resource_modification_reject->presencemask & NAS_BEARER_RESOURCE_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_BEARER_RESOURCE_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &bearer_resource_modification_reject->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_esm_information_response(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_esm_information_response(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_esm_information_response_t *esm_information_response = &message->esm.esm_information_response; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ESM_INFORMATION_RESPONSE\n"); + ogs_trace("[NAS] Encode ESM_INFORMATION_RESPONSE"); if (esm_information_response->presencemask & NAS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_access_point_name(pkbuf, &esm_information_response->access_point_name); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (esm_information_response->presencemask & NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_protocol_configuration_options(pkbuf, &esm_information_response->protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } if (esm_information_response->presencemask & NAS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { size = nas_encode_optional_type(pkbuf, NAS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; size = nas_encode_extended_protocol_configuration_options(pkbuf, &esm_information_response->extended_protocol_configuration_options); - d_assert(size >= 0, return encoded, "decode failed"); + ogs_assert(size >= 0); encoded += size; } return encoded; } -c_int32_t nas_encode_esm_status(pkbuf_t *pkbuf, nas_message_t *message) +int nas_encode_esm_status(ogs_pkbuf_t *pkbuf, nas_message_t *message) { nas_esm_status_t *esm_status = &message->esm.esm_status; - c_int32_t encoded = 0; - c_int32_t size = 0; + int encoded = 0; + int size = 0; - d_trace(25, "[NAS] Encode ESM_STATUS\n"); + ogs_trace("[NAS] Encode ESM_STATUS"); size = nas_encode_esm_cause(pkbuf, &esm_status->esm_cause); - d_assert(size >= 0, return -1, "encode failed"); + ogs_assert(size >= 0); encoded += size; return encoded; } -status_t nas_emm_encode(pkbuf_t **pkbuf, nas_message_t *message) +int nas_emm_encode(ogs_pkbuf_t **pkbuf, nas_message_t *message) { - status_t rv = CORE_ERROR; - c_int32_t size = 0; - c_int32_t encoded = 0; + int size = 0; + int encoded = 0; - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(message); - /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. + /* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ - *pkbuf = pkbuf_alloc(NAS_HEADROOM, MAX_SDU_LEN); - d_assert(*pkbuf, return -1, "Null Param"); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(*pkbuf); + ogs_pkbuf_reserve(*pkbuf, NAS_HEADROOM); + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN-NAS_HEADROOM); size = sizeof(nas_emm_header_t); - rv = pkbuf_header(*pkbuf, -size); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(*pkbuf, size)); - memcpy((*pkbuf)->payload - size, &message->emm.h, size); + memcpy((*pkbuf)->data - size, &message->emm.h, size); encoded += size; if (message->emm.h.security_header_type >= NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { - d_assert(pkbuf_header(*pkbuf, 1) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(*pkbuf, 1)); encoded -= 1; size = nas_encode_service_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; goto out; @@ -3012,309 +3005,304 @@ status_t nas_emm_encode(pkbuf_t **pkbuf, nas_message_t *message) { case NAS_ATTACH_REQUEST: size = nas_encode_attach_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ATTACH_ACCEPT: size = nas_encode_attach_accept(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ATTACH_COMPLETE: size = nas_encode_attach_complete(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ATTACH_REJECT: size = nas_encode_attach_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_DETACH_REQUEST: size = nas_encode_detach_request_to_ue(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_DETACH_ACCEPT: break; case NAS_TRACKING_AREA_UPDATE_REQUEST: size = nas_encode_tracking_area_update_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_TRACKING_AREA_UPDATE_ACCEPT: size = nas_encode_tracking_area_update_accept(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_TRACKING_AREA_UPDATE_COMPLETE: break; case NAS_TRACKING_AREA_UPDATE_REJECT: size = nas_encode_tracking_area_update_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_EXTENDED_SERVICE_REQUEST: size = nas_encode_extended_service_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_SERVICE_REJECT: size = nas_encode_service_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_GUTI_REALLOCATION_COMMAND: size = nas_encode_guti_reallocation_command(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_GUTI_REALLOCATION_COMPLETE: break; case NAS_AUTHENTICATION_REQUEST: size = nas_encode_authentication_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_AUTHENTICATION_RESPONSE: size = nas_encode_authentication_response(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_AUTHENTICATION_REJECT: break; case NAS_IDENTITY_REQUEST: size = nas_encode_identity_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_IDENTITY_RESPONSE: size = nas_encode_identity_response(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_AUTHENTICATION_FAILURE: size = nas_encode_authentication_failure(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_SECURITY_MODE_COMMAND: size = nas_encode_security_mode_command(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_SECURITY_MODE_COMPLETE: size = nas_encode_security_mode_complete(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_SECURITY_MODE_REJECT: size = nas_encode_security_mode_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_EMM_STATUS: size = nas_encode_emm_status(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_EMM_INFORMATION: size = nas_encode_emm_information(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_DOWNLINK_NAS_TRANSPORT: size = nas_encode_downlink_nas_transport(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_UPLINK_NAS_TRANSPORT: size = nas_encode_uplink_nas_transport(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_CS_SERVICE_NOTIFICATION: size = nas_encode_cs_service_notification(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_UPLINK_GENERIC_NAS_TRANSPORT: size = nas_encode_uplink_generic_nas_transport(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_DOWNLINK_GENERIC_NAS_TRANSPORT: size = nas_encode_downlink_generic_nas_transport(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->emm.h.message_type); - pkbuf_free((*pkbuf)); - return CORE_ERROR; + ogs_pkbuf_free((*pkbuf)); + return OGS_ERROR; } out: - rv = pkbuf_header(*pkbuf, encoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(*pkbuf, encoded)); (*pkbuf)->len = encoded; - return CORE_OK; + return OGS_OK; } -status_t nas_esm_encode(pkbuf_t **pkbuf, nas_message_t *message) +int nas_esm_encode(ogs_pkbuf_t **pkbuf, nas_message_t *message) { - status_t rv = CORE_ERROR; - c_int32_t size = 0; - c_int32_t encoded = 0; + int size = 0; + int encoded = 0; - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(message); - /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. + /* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ - *pkbuf = pkbuf_alloc(NAS_HEADROOM, MAX_SDU_LEN); - d_assert(*pkbuf, return -1, "Null Param"); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(*pkbuf); + ogs_pkbuf_reserve(*pkbuf, NAS_HEADROOM); + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN-NAS_HEADROOM); size = sizeof(nas_esm_header_t); - rv = pkbuf_header(*pkbuf, -size); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); - - memcpy((*pkbuf)->payload - size, &message->esm.h, size); + ogs_assert(ogs_pkbuf_pull(*pkbuf, size)); + memcpy((*pkbuf)->data - size, &message->esm.h, size); encoded += size; switch(message->esm.h.message_type) { case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: size = nas_encode_activate_default_eps_bearer_context_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: size = nas_encode_activate_default_eps_bearer_context_accept(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: size = nas_encode_activate_default_eps_bearer_context_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: size = nas_encode_activate_dedicated_eps_bearer_context_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: size = nas_encode_activate_dedicated_eps_bearer_context_accept(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: size = nas_encode_activate_dedicated_eps_bearer_context_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST: size = nas_encode_modify_eps_bearer_context_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT: size = nas_encode_modify_eps_bearer_context_accept(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT: size = nas_encode_modify_eps_bearer_context_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: size = nas_encode_deactivate_eps_bearer_context_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: size = nas_encode_deactivate_eps_bearer_context_accept(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_PDN_CONNECTIVITY_REQUEST: size = nas_encode_pdn_connectivity_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_PDN_CONNECTIVITY_REJECT: size = nas_encode_pdn_connectivity_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_PDN_DISCONNECT_REQUEST: size = nas_encode_pdn_disconnect_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_PDN_DISCONNECT_REJECT: size = nas_encode_pdn_disconnect_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REQUEST: size = nas_encode_bearer_resource_allocation_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_BEARER_RESOURCE_ALLOCATION_REJECT: size = nas_encode_bearer_resource_allocation_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REQUEST: size = nas_encode_bearer_resource_modification_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_BEARER_RESOURCE_MODIFICATION_REJECT: size = nas_encode_bearer_resource_modification_reject(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ESM_INFORMATION_REQUEST: break; case NAS_ESM_INFORMATION_RESPONSE: size = nas_encode_esm_information_response(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; case NAS_ESM_STATUS: size = nas_encode_esm_status(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; break; default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->esm.h.message_type); - pkbuf_free((*pkbuf)); - return CORE_ERROR; + ogs_pkbuf_free((*pkbuf)); + return OGS_ERROR; } - rv = pkbuf_header(*pkbuf, encoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); - + ogs_assert(ogs_pkbuf_push(*pkbuf, encoded)); (*pkbuf)->len = encoded; - return CORE_OK; + return OGS_OK; } -status_t nas_plain_encode(pkbuf_t **pkbuf, nas_message_t *message) +int nas_plain_encode(ogs_pkbuf_t **pkbuf, nas_message_t *message) { - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(message); - d_assert(message->emm.h.protocol_discriminator == - message->esm.h.protocol_discriminator, - return CORE_ERROR, "check UNION for protocol"); + ogs_assert(message->emm.h.protocol_discriminator == + message->esm.h.protocol_discriminator); if (message->emm.h.protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM) @@ -3323,6 +3311,7 @@ status_t nas_plain_encode(pkbuf_t **pkbuf, nas_message_t *message) NAS_PROTOCOL_DISCRIMINATOR_ESM) return nas_esm_encode(pkbuf, message); - d_assert(0, return CORE_ERROR, - "Invalid Protocol : %d", message->emm.h.protocol_discriminator); + ogs_assert_if_reached(); + + return OGS_OK; } diff --git a/lib/nas/nas_ies.c b/lib/nas/nas_ies.c index f183295ed..4c9cb2f98 100644 --- a/lib/nas/nas_ies.c +++ b/lib/nas/nas_ies.c @@ -1,240 +1,233 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by nas_message.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2019-03-17 01:58:02.731397 by acetcom + * Created on: 2019-03-17 02:01:09.532072 by acetcom * from 24301-d80.docx ******************************************************************************/ -#define TRACE_MODULE _nas_ies - -#include "core_debug.h" -#include "core_lib.h" #include "nas_ies.h" -c_int16_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type) -{ - c_uint16_t size = sizeof(c_uint8_t); +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &type, size); +int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type) +{ + uint16_t size = sizeof(uint8_t); + + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &type, size); return size; } /* 9.9.2.0 Additional information * O TLV 3-n */ -c_int16_t nas_decode_additional_information(nas_additional_information_t *additional_information, pkbuf_t *pkbuf) +int nas_decode_additional_information(nas_additional_information_t *additional_information, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_additional_information_t *source = pkbuf->payload; + uint16_t size = 0; + nas_additional_information_t *source = pkbuf->data; additional_information->length = source->length; size = additional_information->length + sizeof(additional_information->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(additional_information, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(additional_information, pkbuf->data - size, size); - d_trace(25, " ADDITIONAL_INFORMATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ADDITIONAL_INFORMATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_additional_information(pkbuf_t *pkbuf, nas_additional_information_t *additional_information) +int nas_encode_additional_information(ogs_pkbuf_t *pkbuf, nas_additional_information_t *additional_information) { - c_uint16_t size = additional_information->length + sizeof(additional_information->length); + uint16_t size = additional_information->length + sizeof(additional_information->length); nas_additional_information_t target; memcpy(&target, additional_information, sizeof(nas_additional_information_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " ADDITIONAL_INFORMATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ADDITIONAL_INFORMATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.0A Device properties * O TV 1 */ -c_int16_t nas_decode_device_properties(nas_device_properties_t *device_properties, pkbuf_t *pkbuf) +int nas_decode_device_properties(nas_device_properties_t *device_properties, ogs_pkbuf_t *pkbuf) { - memcpy(device_properties, pkbuf->payload - 1, 1); + memcpy(device_properties, pkbuf->data - 1, 1); - d_trace(25, " DEVICE_PROPERTIES - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" DEVICE_PROPERTIES - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_device_properties(pkbuf_t *pkbuf, nas_device_properties_t *device_properties) +int nas_encode_device_properties(ogs_pkbuf_t *pkbuf, nas_device_properties_t *device_properties) { - c_uint16_t size = sizeof(nas_device_properties_t); + uint16_t size = sizeof(nas_device_properties_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, device_properties, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, device_properties, size); - d_trace(25, " DEVICE_PROPERTIES - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DEVICE_PROPERTIES - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.1 EPS bearer context status * O TLV 4 */ -c_int16_t nas_decode_eps_bearer_context_status(nas_eps_bearer_context_status_t *eps_bearer_context_status, pkbuf_t *pkbuf) +int nas_decode_eps_bearer_context_status(nas_eps_bearer_context_status_t *eps_bearer_context_status, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_eps_bearer_context_status_t *source = pkbuf->payload; + uint16_t size = 0; + nas_eps_bearer_context_status_t *source = pkbuf->data; eps_bearer_context_status->length = source->length; size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_bearer_context_status, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_bearer_context_status, pkbuf->data - size, size); - d_trace(25, " EPS_BEARER_CONTEXT_STATUS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_BEARER_CONTEXT_STATUS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_bearer_context_status(pkbuf_t *pkbuf, nas_eps_bearer_context_status_t *eps_bearer_context_status) +int nas_encode_eps_bearer_context_status(ogs_pkbuf_t *pkbuf, nas_eps_bearer_context_status_t *eps_bearer_context_status) { - c_uint16_t size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length); + uint16_t size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length); nas_eps_bearer_context_status_t target; memcpy(&target, eps_bearer_context_status, sizeof(nas_eps_bearer_context_status_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_BEARER_CONTEXT_STATUS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_BEARER_CONTEXT_STATUS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.10 Supported Codec List * O TLV 5-n */ -c_int16_t nas_decode_supported_codec_list(nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf) +int nas_decode_supported_codec_list(nas_supported_codec_list_t *supported_codec_list, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_supported_codec_list_t *source = pkbuf->payload; + uint16_t size = 0; + nas_supported_codec_list_t *source = pkbuf->data; supported_codec_list->length = source->length; size = supported_codec_list->length + sizeof(supported_codec_list->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(supported_codec_list, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(supported_codec_list, pkbuf->data - size, size); - d_trace(25, " SUPPORTED_CODEC_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SUPPORTED_CODEC_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_supported_codec_list(pkbuf_t *pkbuf, nas_supported_codec_list_t *supported_codec_list) +int nas_encode_supported_codec_list(ogs_pkbuf_t *pkbuf, nas_supported_codec_list_t *supported_codec_list) { - c_uint16_t size = supported_codec_list->length + sizeof(supported_codec_list->length); + uint16_t size = supported_codec_list->length + sizeof(supported_codec_list->length); nas_supported_codec_list_t target; memcpy(&target, supported_codec_list, sizeof(nas_supported_codec_list_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " SUPPORTED_CODEC_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SUPPORTED_CODEC_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.2 Location area identification * O TV 6 */ -c_int16_t nas_decode_location_area_identification(nas_location_area_identification_t *location_area_identification, pkbuf_t *pkbuf) +int nas_decode_location_area_identification(nas_location_area_identification_t *location_area_identification, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_location_area_identification_t); + uint16_t size = sizeof(nas_location_area_identification_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(location_area_identification, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(location_area_identification, pkbuf->data - size, size); location_area_identification->lac = ntohs(location_area_identification->lac); - d_trace(25, " LOCATION_AREA_IDENTIFICATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LOCATION_AREA_IDENTIFICATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_location_area_identification(pkbuf_t *pkbuf, nas_location_area_identification_t *location_area_identification) +int nas_encode_location_area_identification(ogs_pkbuf_t *pkbuf, nas_location_area_identification_t *location_area_identification) { - c_uint16_t size = sizeof(nas_location_area_identification_t); + uint16_t size = sizeof(nas_location_area_identification_t); nas_location_area_identification_t target; memcpy(&target, location_area_identification, size); target.lac = htons(location_area_identification->lac); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " LOCATION_AREA_IDENTIFICATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LOCATION_AREA_IDENTIFICATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.3 Mobile identity * O TLV 7-10 */ -c_int16_t nas_decode_mobile_identity(nas_mobile_identity_t *mobile_identity, pkbuf_t *pkbuf) +int nas_decode_mobile_identity(nas_mobile_identity_t *mobile_identity, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_mobile_identity_t *source = pkbuf->payload; + uint16_t size = 0; + nas_mobile_identity_t *source = pkbuf->data; mobile_identity->length = source->length; size = mobile_identity->length + sizeof(mobile_identity->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(mobile_identity, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(mobile_identity, pkbuf->data - size, size); if (mobile_identity->tmsi.type == NAS_MOBILE_IDENTITY_TMSI) { if (mobile_identity->tmsi.spare != 0xf) - d_warn("Spec warning : mobile_identity->tmsi.spare = 0x%x", mobile_identity->tmsi.spare); + ogs_warn("Spec warning : mobile_identity->tmsi.spare = 0x%x", mobile_identity->tmsi.spare); mobile_identity->tmsi.tmsi = ntohl(mobile_identity->tmsi.tmsi); } - d_trace(25, " MOBILE_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MOBILE_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_mobile_identity(pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity) +int nas_encode_mobile_identity(ogs_pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity) { - c_uint16_t size = mobile_identity->length + sizeof(mobile_identity->length); + uint16_t size = mobile_identity->length + sizeof(mobile_identity->length); nas_mobile_identity_t target; memcpy(&target, mobile_identity, sizeof(nas_mobile_identity_t)); @@ -244,291 +237,291 @@ c_int16_t nas_encode_mobile_identity(pkbuf_t *pkbuf, nas_mobile_identity_t *mobi target.tmsi.spare = 0xf; } - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " MOBILE_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MOBILE_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.4 Mobile station classmark 2 * O TLV 5 */ -c_int16_t nas_decode_mobile_station_classmark_2(nas_mobile_station_classmark_2_t *mobile_station_classmark_2, pkbuf_t *pkbuf) +int nas_decode_mobile_station_classmark_2(nas_mobile_station_classmark_2_t *mobile_station_classmark_2, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_mobile_station_classmark_2_t *source = pkbuf->payload; + uint16_t size = 0; + nas_mobile_station_classmark_2_t *source = pkbuf->data; mobile_station_classmark_2->length = source->length; size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(mobile_station_classmark_2, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(mobile_station_classmark_2, pkbuf->data - size, size); - d_trace(25, " MOBILE_STATION_CLASSMARK_2 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MOBILE_STATION_CLASSMARK_2 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_mobile_station_classmark_2(pkbuf_t *pkbuf, nas_mobile_station_classmark_2_t *mobile_station_classmark_2) +int nas_encode_mobile_station_classmark_2(ogs_pkbuf_t *pkbuf, nas_mobile_station_classmark_2_t *mobile_station_classmark_2) { - c_uint16_t size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length); + uint16_t size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length); nas_mobile_station_classmark_2_t target; memcpy(&target, mobile_station_classmark_2, sizeof(nas_mobile_station_classmark_2_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " MOBILE_STATION_CLASSMARK_2 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MOBILE_STATION_CLASSMARK_2 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.5 Mobile station classmark 3 * O TLV 2-34 */ -c_int16_t nas_decode_mobile_station_classmark_3(nas_mobile_station_classmark_3_t *mobile_station_classmark_3, pkbuf_t *pkbuf) +int nas_decode_mobile_station_classmark_3(nas_mobile_station_classmark_3_t *mobile_station_classmark_3, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_mobile_station_classmark_3_t *source = pkbuf->payload; + uint16_t size = 0; + nas_mobile_station_classmark_3_t *source = pkbuf->data; mobile_station_classmark_3->length = source->length; size = mobile_station_classmark_3->length + sizeof(mobile_station_classmark_3->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(mobile_station_classmark_3, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(mobile_station_classmark_3, pkbuf->data - size, size); - d_trace(25, " MOBILE_STATION_CLASSMARK_3 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MOBILE_STATION_CLASSMARK_3 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_mobile_station_classmark_3(pkbuf_t *pkbuf, nas_mobile_station_classmark_3_t *mobile_station_classmark_3) +int nas_encode_mobile_station_classmark_3(ogs_pkbuf_t *pkbuf, nas_mobile_station_classmark_3_t *mobile_station_classmark_3) { - c_uint16_t size = mobile_station_classmark_3->length + sizeof(mobile_station_classmark_3->length); + uint16_t size = mobile_station_classmark_3->length + sizeof(mobile_station_classmark_3->length); nas_mobile_station_classmark_3_t target; memcpy(&target, mobile_station_classmark_3, sizeof(nas_mobile_station_classmark_3_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " MOBILE_STATION_CLASSMARK_3 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MOBILE_STATION_CLASSMARK_3 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.2.8 PLMN list * O TLV 5-47 */ -c_int16_t nas_decode_plmn_list(nas_plmn_list_t *plmn_list, pkbuf_t *pkbuf) +int nas_decode_plmn_list(nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_plmn_list_t *source = pkbuf->payload; + uint16_t size = 0; + nas_plmn_list_t *source = pkbuf->data; plmn_list->length = source->length; size = plmn_list->length + sizeof(plmn_list->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(plmn_list, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(plmn_list, pkbuf->data - size, size); - d_trace(25, " PLMN_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PLMN_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_plmn_list(pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list) +int nas_encode_plmn_list(ogs_pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list) { - c_uint16_t size = plmn_list->length + sizeof(plmn_list->length); + uint16_t size = plmn_list->length + sizeof(plmn_list->length); nas_plmn_list_t target; memcpy(&target, plmn_list, sizeof(nas_plmn_list_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " PLMN_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PLMN_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.0A Additional update result * O TV 1 */ -c_int16_t nas_decode_additional_update_result(nas_additional_update_result_t *additional_update_result, pkbuf_t *pkbuf) +int nas_decode_additional_update_result(nas_additional_update_result_t *additional_update_result, ogs_pkbuf_t *pkbuf) { - memcpy(additional_update_result, pkbuf->payload - 1, 1); + memcpy(additional_update_result, pkbuf->data - 1, 1); - d_trace(25, " ADDITIONAL_UPDATE_RESULT - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" ADDITIONAL_UPDATE_RESULT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_additional_update_result(pkbuf_t *pkbuf, nas_additional_update_result_t *additional_update_result) +int nas_encode_additional_update_result(ogs_pkbuf_t *pkbuf, nas_additional_update_result_t *additional_update_result) { - c_uint16_t size = sizeof(nas_additional_update_result_t); + uint16_t size = sizeof(nas_additional_update_result_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, additional_update_result, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, additional_update_result, size); - d_trace(25, " ADDITIONAL_UPDATE_RESULT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ADDITIONAL_UPDATE_RESULT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.0B Additional update type * O TV 1 */ -c_int16_t nas_decode_additional_update_type(nas_additional_update_type_t *additional_update_type, pkbuf_t *pkbuf) +int nas_decode_additional_update_type(nas_additional_update_type_t *additional_update_type, ogs_pkbuf_t *pkbuf) { - memcpy(additional_update_type, pkbuf->payload - 1, 1); + memcpy(additional_update_type, pkbuf->data - 1, 1); - d_trace(25, " ADDITIONAL_UPDATE_TYPE - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" ADDITIONAL_UPDATE_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_additional_update_type(pkbuf_t *pkbuf, nas_additional_update_type_t *additional_update_type) +int nas_encode_additional_update_type(ogs_pkbuf_t *pkbuf, nas_additional_update_type_t *additional_update_type) { - c_uint16_t size = sizeof(nas_additional_update_type_t); + uint16_t size = sizeof(nas_additional_update_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, additional_update_type, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, additional_update_type, size); - d_trace(25, " ADDITIONAL_UPDATE_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ADDITIONAL_UPDATE_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.1 Authentication failure parameter * O TLV 16 */ -c_int16_t nas_decode_authentication_failure_parameter(nas_authentication_failure_parameter_t *authentication_failure_parameter, pkbuf_t *pkbuf) +int nas_decode_authentication_failure_parameter(nas_authentication_failure_parameter_t *authentication_failure_parameter, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_authentication_failure_parameter_t *source = pkbuf->payload; + uint16_t size = 0; + nas_authentication_failure_parameter_t *source = pkbuf->data; authentication_failure_parameter->length = source->length; size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(authentication_failure_parameter, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(authentication_failure_parameter, pkbuf->data - size, size); - d_trace(25, " AUTHENTICATION_FAILURE_PARAMETER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_FAILURE_PARAMETER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_authentication_failure_parameter(pkbuf_t *pkbuf, nas_authentication_failure_parameter_t *authentication_failure_parameter) +int nas_encode_authentication_failure_parameter(ogs_pkbuf_t *pkbuf, nas_authentication_failure_parameter_t *authentication_failure_parameter) { - c_uint16_t size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length); + uint16_t size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length); nas_authentication_failure_parameter_t target; memcpy(&target, authentication_failure_parameter, sizeof(nas_authentication_failure_parameter_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " AUTHENTICATION_FAILURE_PARAMETER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_FAILURE_PARAMETER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.10 EPS attach result * M V 1/2 */ -c_int16_t nas_decode_eps_attach_result(nas_eps_attach_result_t *eps_attach_result, pkbuf_t *pkbuf) +int nas_decode_eps_attach_result(nas_eps_attach_result_t *eps_attach_result, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_eps_attach_result_t); + uint16_t size = sizeof(nas_eps_attach_result_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_attach_result, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_attach_result, pkbuf->data - size, size); - d_trace(25, " EPS_ATTACH_RESULT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_ATTACH_RESULT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_attach_result(pkbuf_t *pkbuf, nas_eps_attach_result_t *eps_attach_result) +int nas_encode_eps_attach_result(ogs_pkbuf_t *pkbuf, nas_eps_attach_result_t *eps_attach_result) { - c_uint16_t size = sizeof(nas_eps_attach_result_t); + uint16_t size = sizeof(nas_eps_attach_result_t); nas_eps_attach_result_t target; memcpy(&target, eps_attach_result, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_ATTACH_RESULT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_ATTACH_RESULT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.11 EPS attach type * M V 1/2 */ -c_int16_t nas_decode_eps_attach_type(nas_eps_attach_type_t *eps_attach_type, pkbuf_t *pkbuf) +int nas_decode_eps_attach_type(nas_eps_attach_type_t *eps_attach_type, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_eps_attach_type_t); + uint16_t size = sizeof(nas_eps_attach_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_attach_type, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_attach_type, pkbuf->data - size, size); - d_trace(25, " EPS_ATTACH_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_ATTACH_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_attach_type(pkbuf_t *pkbuf, nas_eps_attach_type_t *eps_attach_type) +int nas_encode_eps_attach_type(ogs_pkbuf_t *pkbuf, nas_eps_attach_type_t *eps_attach_type) { - c_uint16_t size = sizeof(nas_eps_attach_type_t); + uint16_t size = sizeof(nas_eps_attach_type_t); nas_eps_attach_type_t target; memcpy(&target, eps_attach_type, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_ATTACH_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_ATTACH_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.12 EPS mobile identity * M LV 5-12 */ -c_int16_t nas_decode_eps_mobile_identity(nas_eps_mobile_identity_t *eps_mobile_identity, pkbuf_t *pkbuf) +int nas_decode_eps_mobile_identity(nas_eps_mobile_identity_t *eps_mobile_identity, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_eps_mobile_identity_t *source = pkbuf->payload; + uint16_t size = 0; + nas_eps_mobile_identity_t *source = pkbuf->data; eps_mobile_identity->length = source->length; size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_mobile_identity, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_mobile_identity, pkbuf->data - size, size); if (eps_mobile_identity->guti.type == NAS_EPS_MOBILE_IDENTITY_GUTI) { if (eps_mobile_identity->guti.spare != 0xf) - d_warn("Spec warning : eps_mobile_identy->spare = 0x%x", eps_mobile_identity->guti.spare); + ogs_warn("Spec warning : eps_mobile_identy->spare = 0x%x", eps_mobile_identity->guti.spare); eps_mobile_identity->guti.mme_gid = ntohs(eps_mobile_identity->guti.mme_gid); eps_mobile_identity->guti.m_tmsi = ntohl(eps_mobile_identity->guti.m_tmsi); } - d_trace(25, " EPS_MOBILE_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_MOBILE_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_mobile_identity(pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity) +int nas_encode_eps_mobile_identity(ogs_pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity) { - c_uint16_t size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length); + uint16_t size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length); nas_eps_mobile_identity_t target; memcpy(&target, eps_mobile_identity, sizeof(nas_eps_mobile_identity_t)); @@ -539,2388 +532,2388 @@ c_int16_t nas_encode_eps_mobile_identity(pkbuf_t *pkbuf, nas_eps_mobile_identity target.guti.m_tmsi = htonl(eps_mobile_identity->guti.m_tmsi); } - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_MOBILE_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_MOBILE_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.12A EPS network feature support * O TLV 3 */ -c_int16_t nas_decode_eps_network_feature_support(nas_eps_network_feature_support_t *eps_network_feature_support, pkbuf_t *pkbuf) +int nas_decode_eps_network_feature_support(nas_eps_network_feature_support_t *eps_network_feature_support, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_eps_network_feature_support_t *source = pkbuf->payload; + uint16_t size = 0; + nas_eps_network_feature_support_t *source = pkbuf->data; eps_network_feature_support->length = source->length; size = eps_network_feature_support->length + sizeof(eps_network_feature_support->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_network_feature_support, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_network_feature_support, pkbuf->data - size, size); - d_trace(25, " EPS_NETWORK_FEATURE_SUPPORT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_NETWORK_FEATURE_SUPPORT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_network_feature_support(pkbuf_t *pkbuf, nas_eps_network_feature_support_t *eps_network_feature_support) +int nas_encode_eps_network_feature_support(ogs_pkbuf_t *pkbuf, nas_eps_network_feature_support_t *eps_network_feature_support) { - c_uint16_t size = eps_network_feature_support->length + sizeof(eps_network_feature_support->length); + uint16_t size = eps_network_feature_support->length + sizeof(eps_network_feature_support->length); nas_eps_network_feature_support_t target; memcpy(&target, eps_network_feature_support, sizeof(nas_eps_network_feature_support_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_NETWORK_FEATURE_SUPPORT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_NETWORK_FEATURE_SUPPORT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.13 EPS update result * M V 1/2 */ -c_int16_t nas_decode_eps_update_result(nas_eps_update_result_t *eps_update_result, pkbuf_t *pkbuf) +int nas_decode_eps_update_result(nas_eps_update_result_t *eps_update_result, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_eps_update_result_t); + uint16_t size = sizeof(nas_eps_update_result_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_update_result, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_update_result, pkbuf->data - size, size); - d_trace(25, " EPS_UPDATE_RESULT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_UPDATE_RESULT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_update_result(pkbuf_t *pkbuf, nas_eps_update_result_t *eps_update_result) +int nas_encode_eps_update_result(ogs_pkbuf_t *pkbuf, nas_eps_update_result_t *eps_update_result) { - c_uint16_t size = sizeof(nas_eps_update_result_t); + uint16_t size = sizeof(nas_eps_update_result_t); nas_eps_update_result_t target; memcpy(&target, eps_update_result, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_UPDATE_RESULT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_UPDATE_RESULT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.14 EPS update type * M V 1/2 */ -c_int16_t nas_decode_eps_update_type(nas_eps_update_type_t *eps_update_type, pkbuf_t *pkbuf) +int nas_decode_eps_update_type(nas_eps_update_type_t *eps_update_type, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_eps_update_type_t); + uint16_t size = sizeof(nas_eps_update_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_update_type, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_update_type, pkbuf->data - size, size); - d_trace(25, " EPS_UPDATE_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_UPDATE_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_update_type(pkbuf_t *pkbuf, nas_eps_update_type_t *eps_update_type) +int nas_encode_eps_update_type(ogs_pkbuf_t *pkbuf, nas_eps_update_type_t *eps_update_type) { - c_uint16_t size = sizeof(nas_eps_update_type_t); + uint16_t size = sizeof(nas_eps_update_type_t); nas_eps_update_type_t target; memcpy(&target, eps_update_type, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_UPDATE_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_UPDATE_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.15 ESM message container * M LV-E 5-n */ -c_int16_t nas_decode_esm_message_container(nas_esm_message_container_t *esm_message_container, pkbuf_t *pkbuf) +int nas_decode_esm_message_container(nas_esm_message_container_t *esm_message_container, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_esm_message_container_t *source = pkbuf->payload; + uint16_t size = 0; + nas_esm_message_container_t *source = pkbuf->data; esm_message_container->length = ntohs(source->length); size = esm_message_container->length + sizeof(esm_message_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - esm_message_container->buffer = pkbuf->payload - size + sizeof(esm_message_container->length); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + esm_message_container->buffer = pkbuf->data - size + sizeof(esm_message_container->length); - d_trace(25, " ESM_MESSAGE_CONTAINER - "); - d_trace_hex(25, esm_message_container->buffer, esm_message_container->length); + ogs_trace(" ESM_MESSAGE_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, (void*)esm_message_container->buffer, esm_message_container->length); return size; } -c_int16_t nas_encode_esm_message_container(pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container) +int nas_encode_esm_message_container(ogs_pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container) { - c_uint16_t size = 0; - c_uint16_t target; + uint16_t size = 0; + uint16_t target; - d_assert(esm_message_container, return -1, "Null param"); - d_assert(esm_message_container->buffer, return -1, "Null param"); + ogs_assert(esm_message_container); + ogs_assert(esm_message_container->buffer); size = sizeof(esm_message_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); target = htons(esm_message_container->length); - memcpy(pkbuf->payload - size, &target, size); + memcpy(pkbuf->data - size, &target, size); size = esm_message_container->length; - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, esm_message_container->buffer, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, esm_message_container->buffer, size); - d_trace(25, " ESM_MESSAGE_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ESM_MESSAGE_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return esm_message_container->length + sizeof(esm_message_container->length); } /* 9.9.3.16 GPRS timer * M V 1 */ -c_int16_t nas_decode_gprs_timer(nas_gprs_timer_t *gprs_timer, pkbuf_t *pkbuf) +int nas_decode_gprs_timer(nas_gprs_timer_t *gprs_timer, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_gprs_timer_t); + uint16_t size = sizeof(nas_gprs_timer_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(gprs_timer, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(gprs_timer, pkbuf->data - size, size); - d_trace(25, " GPRS_TIMER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GPRS_TIMER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_gprs_timer(pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer) +int nas_encode_gprs_timer(ogs_pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer) { - c_uint16_t size = sizeof(nas_gprs_timer_t); + uint16_t size = sizeof(nas_gprs_timer_t); nas_gprs_timer_t target; memcpy(&target, gprs_timer, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " GPRS_TIMER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GPRS_TIMER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.16A GPRS timer 2 * O TLV 3 */ -c_int16_t nas_decode_gprs_timer_2(nas_gprs_timer_2_t *gprs_timer_2, pkbuf_t *pkbuf) +int nas_decode_gprs_timer_2(nas_gprs_timer_2_t *gprs_timer_2, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_gprs_timer_2_t *source = pkbuf->payload; + uint16_t size = 0; + nas_gprs_timer_2_t *source = pkbuf->data; gprs_timer_2->length = source->length; size = gprs_timer_2->length + sizeof(gprs_timer_2->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(gprs_timer_2, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(gprs_timer_2, pkbuf->data - size, size); - d_trace(25, " GPRS_TIMER_2 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GPRS_TIMER_2 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_gprs_timer_2(pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2) +int nas_encode_gprs_timer_2(ogs_pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2) { - c_uint16_t size = gprs_timer_2->length + sizeof(gprs_timer_2->length); + uint16_t size = gprs_timer_2->length + sizeof(gprs_timer_2->length); nas_gprs_timer_2_t target; memcpy(&target, gprs_timer_2, sizeof(nas_gprs_timer_2_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " GPRS_TIMER_2 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GPRS_TIMER_2 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.16B GPRS timer 3 * O TLV 3 */ -c_int16_t nas_decode_gprs_timer_3(nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf) +int nas_decode_gprs_timer_3(nas_gprs_timer_3_t *gprs_timer_3, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_gprs_timer_3_t *source = pkbuf->payload; + uint16_t size = 0; + nas_gprs_timer_3_t *source = pkbuf->data; gprs_timer_3->length = source->length; size = gprs_timer_3->length + sizeof(gprs_timer_3->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(gprs_timer_3, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(gprs_timer_3, pkbuf->data - size, size); - d_trace(25, " GPRS_TIMER_3 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GPRS_TIMER_3 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_gprs_timer_3(pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3) +int nas_encode_gprs_timer_3(ogs_pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3) { - c_uint16_t size = gprs_timer_3->length + sizeof(gprs_timer_3->length); + uint16_t size = gprs_timer_3->length + sizeof(gprs_timer_3->length); nas_gprs_timer_3_t target; memcpy(&target, gprs_timer_3, sizeof(nas_gprs_timer_3_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " GPRS_TIMER_3 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GPRS_TIMER_3 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.17 Identity type 2 * M V 1/2 */ -c_int16_t nas_decode_identity_type_2(nas_identity_type_2_t *identity_type_2, pkbuf_t *pkbuf) +int nas_decode_identity_type_2(nas_identity_type_2_t *identity_type_2, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_identity_type_2_t); + uint16_t size = sizeof(nas_identity_type_2_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(identity_type_2, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(identity_type_2, pkbuf->data - size, size); - d_trace(25, " IDENTITY_TYPE_2 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" IDENTITY_TYPE_2 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_identity_type_2(pkbuf_t *pkbuf, nas_identity_type_2_t *identity_type_2) +int nas_encode_identity_type_2(ogs_pkbuf_t *pkbuf, nas_identity_type_2_t *identity_type_2) { - c_uint16_t size = sizeof(nas_identity_type_2_t); + uint16_t size = sizeof(nas_identity_type_2_t); nas_identity_type_2_t target; memcpy(&target, identity_type_2, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " IDENTITY_TYPE_2 - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" IDENTITY_TYPE_2 - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.18 IMEISV request * O TV 1 */ -c_int16_t nas_decode_imeisv_request(nas_imeisv_request_t *imeisv_request, pkbuf_t *pkbuf) +int nas_decode_imeisv_request(nas_imeisv_request_t *imeisv_request, ogs_pkbuf_t *pkbuf) { - memcpy(imeisv_request, pkbuf->payload - 1, 1); + memcpy(imeisv_request, pkbuf->data - 1, 1); - d_trace(25, " IMEISV_REQUEST - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" IMEISV_REQUEST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_imeisv_request(pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request) +int nas_encode_imeisv_request(ogs_pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request) { - c_uint16_t size = sizeof(nas_imeisv_request_t); + uint16_t size = sizeof(nas_imeisv_request_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, imeisv_request, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, imeisv_request, size); - d_trace(25, " IMEISV_REQUEST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" IMEISV_REQUEST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.19 KSI and sequence number * M V 1 */ -c_int16_t nas_decode_ksi_and_sequence_number(nas_ksi_and_sequence_number_t *ksi_and_sequence_number, pkbuf_t *pkbuf) +int nas_decode_ksi_and_sequence_number(nas_ksi_and_sequence_number_t *ksi_and_sequence_number, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_ksi_and_sequence_number_t); + uint16_t size = sizeof(nas_ksi_and_sequence_number_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(ksi_and_sequence_number, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(ksi_and_sequence_number, pkbuf->data - size, size); - d_trace(25, " KSI_AND_SEQUENCE_NUMBER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" KSI_AND_SEQUENCE_NUMBER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_ksi_and_sequence_number(pkbuf_t *pkbuf, nas_ksi_and_sequence_number_t *ksi_and_sequence_number) +int nas_encode_ksi_and_sequence_number(ogs_pkbuf_t *pkbuf, nas_ksi_and_sequence_number_t *ksi_and_sequence_number) { - c_uint16_t size = sizeof(nas_ksi_and_sequence_number_t); + uint16_t size = sizeof(nas_ksi_and_sequence_number_t); nas_ksi_and_sequence_number_t target; memcpy(&target, ksi_and_sequence_number, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " KSI_AND_SEQUENCE_NUMBER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" KSI_AND_SEQUENCE_NUMBER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.2 Authentication parameter AUTN * M LV 17 */ -c_int16_t nas_decode_authentication_parameter_autn(nas_authentication_parameter_autn_t *authentication_parameter_autn, pkbuf_t *pkbuf) +int nas_decode_authentication_parameter_autn(nas_authentication_parameter_autn_t *authentication_parameter_autn, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_authentication_parameter_autn_t *source = pkbuf->payload; + uint16_t size = 0; + nas_authentication_parameter_autn_t *source = pkbuf->data; authentication_parameter_autn->length = source->length; size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(authentication_parameter_autn, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(authentication_parameter_autn, pkbuf->data - size, size); - d_trace(25, " AUTHENTICATION_PARAMETER_AUTN - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_PARAMETER_AUTN - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf, nas_authentication_parameter_autn_t *authentication_parameter_autn) +int nas_encode_authentication_parameter_autn(ogs_pkbuf_t *pkbuf, nas_authentication_parameter_autn_t *authentication_parameter_autn) { - c_uint16_t size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length); + uint16_t size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length); nas_authentication_parameter_autn_t target; memcpy(&target, authentication_parameter_autn, sizeof(nas_authentication_parameter_autn_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " AUTHENTICATION_PARAMETER_AUTN - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_PARAMETER_AUTN - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.20 MS network capability * O TLV 4-10 */ -c_int16_t nas_decode_ms_network_capability(nas_ms_network_capability_t *ms_network_capability, pkbuf_t *pkbuf) +int nas_decode_ms_network_capability(nas_ms_network_capability_t *ms_network_capability, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_ms_network_capability_t *source = pkbuf->payload; + uint16_t size = 0; + nas_ms_network_capability_t *source = pkbuf->data; ms_network_capability->length = source->length; size = ms_network_capability->length + sizeof(ms_network_capability->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(ms_network_capability, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(ms_network_capability, pkbuf->data - size, size); - d_trace(25, " MS_NETWORK_CAPABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MS_NETWORK_CAPABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_ms_network_capability(pkbuf_t *pkbuf, nas_ms_network_capability_t *ms_network_capability) +int nas_encode_ms_network_capability(ogs_pkbuf_t *pkbuf, nas_ms_network_capability_t *ms_network_capability) { - c_uint16_t size = ms_network_capability->length + sizeof(ms_network_capability->length); + uint16_t size = ms_network_capability->length + sizeof(ms_network_capability->length); nas_ms_network_capability_t target; memcpy(&target, ms_network_capability, sizeof(nas_ms_network_capability_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " MS_NETWORK_CAPABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MS_NETWORK_CAPABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.20A MS network feature support * O TV 1 */ -c_int16_t nas_decode_ms_network_feature_support(nas_ms_network_feature_support_t *ms_network_feature_support, pkbuf_t *pkbuf) +int nas_decode_ms_network_feature_support(nas_ms_network_feature_support_t *ms_network_feature_support, ogs_pkbuf_t *pkbuf) { - memcpy(ms_network_feature_support, pkbuf->payload - 1, 1); + memcpy(ms_network_feature_support, pkbuf->data - 1, 1); - d_trace(25, " MS_NETWORK_FEATURE_SUPPORT - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" MS_NETWORK_FEATURE_SUPPORT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_ms_network_feature_support(pkbuf_t *pkbuf, nas_ms_network_feature_support_t *ms_network_feature_support) +int nas_encode_ms_network_feature_support(ogs_pkbuf_t *pkbuf, nas_ms_network_feature_support_t *ms_network_feature_support) { - c_uint16_t size = sizeof(nas_ms_network_feature_support_t); + uint16_t size = sizeof(nas_ms_network_feature_support_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, ms_network_feature_support, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, ms_network_feature_support, size); - d_trace(25, " MS_NETWORK_FEATURE_SUPPORT - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MS_NETWORK_FEATURE_SUPPORT - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.21 key set identifier * O TV 1 */ -c_int16_t nas_decode_key_set_identifier(nas_key_set_identifier_t *key_set_identifier, pkbuf_t *pkbuf) +int nas_decode_key_set_identifier(nas_key_set_identifier_t *key_set_identifier, ogs_pkbuf_t *pkbuf) { - memcpy(key_set_identifier, pkbuf->payload - 1, 1); + memcpy(key_set_identifier, pkbuf->data - 1, 1); - d_trace(25, " KEY_SET_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" KEY_SET_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_key_set_identifier(pkbuf_t *pkbuf, nas_key_set_identifier_t *key_set_identifier) +int nas_encode_key_set_identifier(ogs_pkbuf_t *pkbuf, nas_key_set_identifier_t *key_set_identifier) { - c_uint16_t size = sizeof(nas_key_set_identifier_t); + uint16_t size = sizeof(nas_key_set_identifier_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, key_set_identifier, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, key_set_identifier, size); - d_trace(25, " KEY_SET_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" KEY_SET_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.22 message container * M LV 3-252 */ -c_int16_t nas_decode_message_container(nas_message_container_t *message_container, pkbuf_t *pkbuf) +int nas_decode_message_container(nas_message_container_t *message_container, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_message_container_t *source = pkbuf->payload; + uint16_t size = 0; + nas_message_container_t *source = pkbuf->data; message_container->length = source->length; size = message_container->length + sizeof(message_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(message_container, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(message_container, pkbuf->data - size, size); - d_trace(25, " MESSAGE_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MESSAGE_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_message_container(pkbuf_t *pkbuf, nas_message_container_t *message_container) +int nas_encode_message_container(ogs_pkbuf_t *pkbuf, nas_message_container_t *message_container) { - c_uint16_t size = message_container->length + sizeof(message_container->length); + uint16_t size = message_container->length + sizeof(message_container->length); nas_message_container_t target; memcpy(&target, message_container, sizeof(nas_message_container_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " MESSAGE_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" MESSAGE_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.23 security algorithms * M V 1 */ -c_int16_t nas_decode_security_algorithms(nas_security_algorithms_t *security_algorithms, pkbuf_t *pkbuf) +int nas_decode_security_algorithms(nas_security_algorithms_t *security_algorithms, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_security_algorithms_t); + uint16_t size = sizeof(nas_security_algorithms_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(security_algorithms, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(security_algorithms, pkbuf->data - size, size); - d_trace(25, " SECURITY_ALGORITHMS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SECURITY_ALGORITHMS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_security_algorithms(pkbuf_t *pkbuf, nas_security_algorithms_t *security_algorithms) +int nas_encode_security_algorithms(ogs_pkbuf_t *pkbuf, nas_security_algorithms_t *security_algorithms) { - c_uint16_t size = sizeof(nas_security_algorithms_t); + uint16_t size = sizeof(nas_security_algorithms_t); nas_security_algorithms_t target; memcpy(&target, security_algorithms, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " SECURITY_ALGORITHMS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SECURITY_ALGORITHMS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.24 Network name * O TLV 3-n */ -c_int16_t nas_decode_network_name(nas_network_name_t *network_name, pkbuf_t *pkbuf) +int nas_decode_network_name(nas_network_name_t *network_name, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_network_name_t *source = pkbuf->payload; + uint16_t size = 0; + nas_network_name_t *source = pkbuf->data; network_name->length = source->length; size = network_name->length + sizeof(network_name->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(network_name, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(network_name, pkbuf->data - size, size); - d_trace(25, " NETWORK_NAME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NETWORK_NAME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_network_name(pkbuf_t *pkbuf, nas_network_name_t *network_name) +int nas_encode_network_name(ogs_pkbuf_t *pkbuf, nas_network_name_t *network_name) { - c_uint16_t size = network_name->length + sizeof(network_name->length); + uint16_t size = network_name->length + sizeof(network_name->length); nas_network_name_t target; memcpy(&target, network_name, sizeof(nas_network_name_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " NETWORK_NAME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NETWORK_NAME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.24A Network resource identifier container * O TLV 4 */ -c_int16_t nas_decode_network_resource_identifier_container(nas_network_resource_identifier_container_t *network_resource_identifier_container, pkbuf_t *pkbuf) +int nas_decode_network_resource_identifier_container(nas_network_resource_identifier_container_t *network_resource_identifier_container, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_network_resource_identifier_container_t *source = pkbuf->payload; + uint16_t size = 0; + nas_network_resource_identifier_container_t *source = pkbuf->data; network_resource_identifier_container->length = source->length; size = network_resource_identifier_container->length + sizeof(network_resource_identifier_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(network_resource_identifier_container, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(network_resource_identifier_container, pkbuf->data - size, size); - d_trace(25, " NETWORK_RESOURCE_IDENTIFIER_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NETWORK_RESOURCE_IDENTIFIER_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_network_resource_identifier_container(pkbuf_t *pkbuf, nas_network_resource_identifier_container_t *network_resource_identifier_container) +int nas_encode_network_resource_identifier_container(ogs_pkbuf_t *pkbuf, nas_network_resource_identifier_container_t *network_resource_identifier_container) { - c_uint16_t size = network_resource_identifier_container->length + sizeof(network_resource_identifier_container->length); + uint16_t size = network_resource_identifier_container->length + sizeof(network_resource_identifier_container->length); nas_network_resource_identifier_container_t target; memcpy(&target, network_resource_identifier_container, sizeof(nas_network_resource_identifier_container_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " NETWORK_RESOURCE_IDENTIFIER_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NETWORK_RESOURCE_IDENTIFIER_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.25 Nonce * O TV 5 */ -c_int16_t nas_decode_nonce(nas_nonce_t *nonce, pkbuf_t *pkbuf) +int nas_decode_nonce(nas_nonce_t *nonce, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_nonce_t); + uint16_t size = sizeof(nas_nonce_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(nonce, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(nonce, pkbuf->data - size, size); *nonce = ntohl(*nonce); - d_trace(25, " NONCE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NONCE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce) +int nas_encode_nonce(ogs_pkbuf_t *pkbuf, nas_nonce_t *nonce) { - c_uint16_t size = sizeof(nas_nonce_t); + uint16_t size = sizeof(nas_nonce_t); nas_nonce_t target; memcpy(&target, nonce, size); target = htonl(*nonce); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " NONCE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NONCE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.25A Paging identity * M V 1 */ -c_int16_t nas_decode_paging_identity(nas_paging_identity_t *paging_identity, pkbuf_t *pkbuf) +int nas_decode_paging_identity(nas_paging_identity_t *paging_identity, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_paging_identity_t); + uint16_t size = sizeof(nas_paging_identity_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(paging_identity, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(paging_identity, pkbuf->data - size, size); - d_trace(25, " PAGING_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PAGING_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_paging_identity(pkbuf_t *pkbuf, nas_paging_identity_t *paging_identity) +int nas_encode_paging_identity(ogs_pkbuf_t *pkbuf, nas_paging_identity_t *paging_identity) { - c_uint16_t size = sizeof(nas_paging_identity_t); + uint16_t size = sizeof(nas_paging_identity_t); nas_paging_identity_t target; memcpy(&target, paging_identity, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " PAGING_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PAGING_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.26 P-TMSI signature * O TV 4 */ -c_int16_t nas_decode_p_tmsi_signature(nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf) +int nas_decode_p_tmsi_signature(nas_p_tmsi_signature_t *p_tmsi_signature, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 3; + uint16_t size = 3; - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(p_tmsi_signature, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(p_tmsi_signature, pkbuf->data - size, size); *p_tmsi_signature = htonl(*p_tmsi_signature); - d_trace(25, " P_TMSI_SIGNATURE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" P_TMSI_SIGNATURE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_p_tmsi_signature(pkbuf_t *pkbuf, nas_p_tmsi_signature_t *p_tmsi_signature) +int nas_encode_p_tmsi_signature(ogs_pkbuf_t *pkbuf, nas_p_tmsi_signature_t *p_tmsi_signature) { - c_uint16_t size = 3; + uint16_t size = 3; nas_p_tmsi_signature_t target; memcpy(&target, p_tmsi_signature, size); *p_tmsi_signature = ntohl(*p_tmsi_signature); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " P_TMSI_SIGNATURE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" P_TMSI_SIGNATURE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.26A Extended EMM cause * O TV 1 */ -c_int16_t nas_decode_extended_emm_cause(nas_extended_emm_cause_t *extended_emm_cause, pkbuf_t *pkbuf) +int nas_decode_extended_emm_cause(nas_extended_emm_cause_t *extended_emm_cause, ogs_pkbuf_t *pkbuf) { - memcpy(extended_emm_cause, pkbuf->payload - 1, 1); + memcpy(extended_emm_cause, pkbuf->data - 1, 1); - d_trace(25, " EXTENDED_EMM_CAUSE - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" EXTENDED_EMM_CAUSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_extended_emm_cause(pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause) +int nas_encode_extended_emm_cause(ogs_pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause) { - c_uint16_t size = sizeof(nas_extended_emm_cause_t); + uint16_t size = sizeof(nas_extended_emm_cause_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, extended_emm_cause, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, extended_emm_cause, size); - d_trace(25, " EXTENDED_EMM_CAUSE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EXTENDED_EMM_CAUSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.27 Service type * M V 1/2 */ -c_int16_t nas_decode_service_type(nas_service_type_t *service_type, pkbuf_t *pkbuf) +int nas_decode_service_type(nas_service_type_t *service_type, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_service_type_t); + uint16_t size = sizeof(nas_service_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(service_type, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(service_type, pkbuf->data - size, size); - d_trace(25, " SERVICE_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SERVICE_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_service_type(pkbuf_t *pkbuf, nas_service_type_t *service_type) +int nas_encode_service_type(ogs_pkbuf_t *pkbuf, nas_service_type_t *service_type) { - c_uint16_t size = sizeof(nas_service_type_t); + uint16_t size = sizeof(nas_service_type_t); nas_service_type_t target; memcpy(&target, service_type, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " SERVICE_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SERVICE_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.28 Short MAC * M V 2 */ -c_int16_t nas_decode_short_mac(nas_short_mac_t *short_mac, pkbuf_t *pkbuf) +int nas_decode_short_mac(nas_short_mac_t *short_mac, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_short_mac_t); + uint16_t size = sizeof(nas_short_mac_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(short_mac, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(short_mac, pkbuf->data - size, size); *short_mac = ntohs(*short_mac); - d_trace(25, " SHORT_MAC - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SHORT_MAC - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_short_mac(pkbuf_t *pkbuf, nas_short_mac_t *short_mac) +int nas_encode_short_mac(ogs_pkbuf_t *pkbuf, nas_short_mac_t *short_mac) { - c_uint16_t size = sizeof(nas_short_mac_t); + uint16_t size = sizeof(nas_short_mac_t); nas_short_mac_t target; memcpy(&target, short_mac, size); target = htons(*short_mac); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " SHORT_MAC - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SHORT_MAC - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.29 Time zone * O TV 2 */ -c_int16_t nas_decode_time_zone(nas_time_zone_t *time_zone, pkbuf_t *pkbuf) +int nas_decode_time_zone(nas_time_zone_t *time_zone, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_time_zone_t); + uint16_t size = sizeof(nas_time_zone_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(time_zone, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(time_zone, pkbuf->data - size, size); - d_trace(25, " TIME_ZONE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TIME_ZONE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_time_zone(pkbuf_t *pkbuf, nas_time_zone_t *time_zone) +int nas_encode_time_zone(ogs_pkbuf_t *pkbuf, nas_time_zone_t *time_zone) { - c_uint16_t size = sizeof(nas_time_zone_t); + uint16_t size = sizeof(nas_time_zone_t); nas_time_zone_t target; memcpy(&target, time_zone, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TIME_ZONE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TIME_ZONE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.3 Authentication parameter RAND * M V 16 */ -c_int16_t nas_decode_authentication_parameter_rand(nas_authentication_parameter_rand_t *authentication_parameter_rand, pkbuf_t *pkbuf) +int nas_decode_authentication_parameter_rand(nas_authentication_parameter_rand_t *authentication_parameter_rand, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_authentication_parameter_rand_t); + uint16_t size = sizeof(nas_authentication_parameter_rand_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(authentication_parameter_rand, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(authentication_parameter_rand, pkbuf->data - size, size); - d_trace(25, " AUTHENTICATION_PARAMETER_RAND - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_PARAMETER_RAND - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf, nas_authentication_parameter_rand_t *authentication_parameter_rand) +int nas_encode_authentication_parameter_rand(ogs_pkbuf_t *pkbuf, nas_authentication_parameter_rand_t *authentication_parameter_rand) { - c_uint16_t size = sizeof(nas_authentication_parameter_rand_t); + uint16_t size = sizeof(nas_authentication_parameter_rand_t); nas_authentication_parameter_rand_t target; memcpy(&target, authentication_parameter_rand, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " AUTHENTICATION_PARAMETER_RAND - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_PARAMETER_RAND - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.30 Time zone and time * O TV 8 */ -c_int16_t nas_decode_time_zone_and_time(nas_time_zone_and_time_t *time_zone_and_time, pkbuf_t *pkbuf) +int nas_decode_time_zone_and_time(nas_time_zone_and_time_t *time_zone_and_time, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_time_zone_and_time_t); + uint16_t size = sizeof(nas_time_zone_and_time_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(time_zone_and_time, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(time_zone_and_time, pkbuf->data - size, size); - d_trace(25, " TIME_ZONE_AND_TIME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TIME_ZONE_AND_TIME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_time_zone_and_time(pkbuf_t *pkbuf, nas_time_zone_and_time_t *time_zone_and_time) +int nas_encode_time_zone_and_time(ogs_pkbuf_t *pkbuf, nas_time_zone_and_time_t *time_zone_and_time) { - c_uint16_t size = sizeof(nas_time_zone_and_time_t); + uint16_t size = sizeof(nas_time_zone_and_time_t); nas_time_zone_and_time_t target; memcpy(&target, time_zone_and_time, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TIME_ZONE_AND_TIME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TIME_ZONE_AND_TIME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.31 TMSI status * O TV 1 */ -c_int16_t nas_decode_tmsi_status(nas_tmsi_status_t *tmsi_status, pkbuf_t *pkbuf) +int nas_decode_tmsi_status(nas_tmsi_status_t *tmsi_status, ogs_pkbuf_t *pkbuf) { - memcpy(tmsi_status, pkbuf->payload - 1, 1); + memcpy(tmsi_status, pkbuf->data - 1, 1); - d_trace(25, " TMSI_STATUS - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" TMSI_STATUS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_tmsi_status(pkbuf_t *pkbuf, nas_tmsi_status_t *tmsi_status) +int nas_encode_tmsi_status(ogs_pkbuf_t *pkbuf, nas_tmsi_status_t *tmsi_status) { - c_uint16_t size = sizeof(nas_tmsi_status_t); + uint16_t size = sizeof(nas_tmsi_status_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, tmsi_status, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, tmsi_status, size); - d_trace(25, " TMSI_STATUS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TMSI_STATUS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.32 Tracking area identity * O TV 6 */ -c_int16_t nas_decode_tracking_area_identity(nas_tracking_area_identity_t *tracking_area_identity, pkbuf_t *pkbuf) +int nas_decode_tracking_area_identity(nas_tracking_area_identity_t *tracking_area_identity, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_tracking_area_identity_t); + uint16_t size = sizeof(nas_tracking_area_identity_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(tracking_area_identity, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(tracking_area_identity, pkbuf->data - size, size); tracking_area_identity->tac = ntohs(tracking_area_identity->tac); - d_trace(25, " TRACKING_AREA_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRACKING_AREA_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_tracking_area_identity(pkbuf_t *pkbuf, nas_tracking_area_identity_t *tracking_area_identity) +int nas_encode_tracking_area_identity(ogs_pkbuf_t *pkbuf, nas_tracking_area_identity_t *tracking_area_identity) { - c_uint16_t size = sizeof(nas_tracking_area_identity_t); + uint16_t size = sizeof(nas_tracking_area_identity_t); nas_tracking_area_identity_t target; memcpy(&target, tracking_area_identity, size); target.tac = htons(tracking_area_identity->tac); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TRACKING_AREA_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRACKING_AREA_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.33 Tracking area identity list * M LV 7-97 */ -c_int16_t nas_decode_tracking_area_identity_list(nas_tracking_area_identity_list_t *tracking_area_identity_list, pkbuf_t *pkbuf) +int nas_decode_tracking_area_identity_list(nas_tracking_area_identity_list_t *tracking_area_identity_list, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_tracking_area_identity_list_t *source = pkbuf->payload; + uint16_t size = 0; + nas_tracking_area_identity_list_t *source = pkbuf->data; tracking_area_identity_list->length = source->length; size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(tracking_area_identity_list, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(tracking_area_identity_list, pkbuf->data - size, size); - d_trace(25, " TRACKING_AREA_IDENTITY_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRACKING_AREA_IDENTITY_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_tracking_area_identity_list(pkbuf_t *pkbuf, nas_tracking_area_identity_list_t *tracking_area_identity_list) +int nas_encode_tracking_area_identity_list(ogs_pkbuf_t *pkbuf, nas_tracking_area_identity_list_t *tracking_area_identity_list) { - c_uint16_t size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length); + uint16_t size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length); nas_tracking_area_identity_list_t target; memcpy(&target, tracking_area_identity_list, sizeof(nas_tracking_area_identity_list_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TRACKING_AREA_IDENTITY_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRACKING_AREA_IDENTITY_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.34 UE network capability * M LV 3-14 */ -c_int16_t nas_decode_ue_network_capability(nas_ue_network_capability_t *ue_network_capability, pkbuf_t *pkbuf) +int nas_decode_ue_network_capability(nas_ue_network_capability_t *ue_network_capability, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_ue_network_capability_t *source = pkbuf->payload; + uint16_t size = 0; + nas_ue_network_capability_t *source = pkbuf->data; ue_network_capability->length = source->length; size = ue_network_capability->length + sizeof(ue_network_capability->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(ue_network_capability, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(ue_network_capability, pkbuf->data - size, size); - d_trace(25, " UE_NETWORK_CAPABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" UE_NETWORK_CAPABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_ue_network_capability(pkbuf_t *pkbuf, nas_ue_network_capability_t *ue_network_capability) +int nas_encode_ue_network_capability(ogs_pkbuf_t *pkbuf, nas_ue_network_capability_t *ue_network_capability) { - c_uint16_t size = ue_network_capability->length + sizeof(ue_network_capability->length); + uint16_t size = ue_network_capability->length + sizeof(ue_network_capability->length); nas_ue_network_capability_t target; memcpy(&target, ue_network_capability, sizeof(nas_ue_network_capability_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " UE_NETWORK_CAPABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" UE_NETWORK_CAPABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.35 UE radio capability information update needed * O TV 1 */ -c_int16_t nas_decode_ue_radio_capability_information_update_needed(nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed, pkbuf_t *pkbuf) +int nas_decode_ue_radio_capability_information_update_needed(nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed, ogs_pkbuf_t *pkbuf) { - memcpy(ue_radio_capability_information_update_needed, pkbuf->payload - 1, 1); + memcpy(ue_radio_capability_information_update_needed, pkbuf->data - 1, 1); - d_trace(25, " UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_ue_radio_capability_information_update_needed(pkbuf_t *pkbuf, nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed) +int nas_encode_ue_radio_capability_information_update_needed(ogs_pkbuf_t *pkbuf, nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed) { - c_uint16_t size = sizeof(nas_ue_radio_capability_information_update_needed_t); + uint16_t size = sizeof(nas_ue_radio_capability_information_update_needed_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, ue_radio_capability_information_update_needed, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, ue_radio_capability_information_update_needed, size); - d_trace(25, " UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.36 UE security capability * M LV 3-6 */ -c_int16_t nas_decode_ue_security_capability(nas_ue_security_capability_t *ue_security_capability, pkbuf_t *pkbuf) +int nas_decode_ue_security_capability(nas_ue_security_capability_t *ue_security_capability, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_ue_security_capability_t *source = pkbuf->payload; + uint16_t size = 0; + nas_ue_security_capability_t *source = pkbuf->data; ue_security_capability->length = source->length; size = ue_security_capability->length + sizeof(ue_security_capability->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(ue_security_capability, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(ue_security_capability, pkbuf->data - size, size); - d_trace(25, " UE_SECURITY_CAPABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" UE_SECURITY_CAPABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_ue_security_capability(pkbuf_t *pkbuf, nas_ue_security_capability_t *ue_security_capability) +int nas_encode_ue_security_capability(ogs_pkbuf_t *pkbuf, nas_ue_security_capability_t *ue_security_capability) { - c_uint16_t size = ue_security_capability->length + sizeof(ue_security_capability->length); + uint16_t size = ue_security_capability->length + sizeof(ue_security_capability->length); nas_ue_security_capability_t target; memcpy(&target, ue_security_capability, sizeof(nas_ue_security_capability_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " UE_SECURITY_CAPABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" UE_SECURITY_CAPABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.37 Emergency number list * O TLV 5-50 */ -c_int16_t nas_decode_emergency_number_list(nas_emergency_number_list_t *emergency_number_list, pkbuf_t *pkbuf) +int nas_decode_emergency_number_list(nas_emergency_number_list_t *emergency_number_list, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_emergency_number_list_t *source = pkbuf->payload; + uint16_t size = 0; + nas_emergency_number_list_t *source = pkbuf->data; emergency_number_list->length = source->length; size = emergency_number_list->length + sizeof(emergency_number_list->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(emergency_number_list, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(emergency_number_list, pkbuf->data - size, size); - d_trace(25, " EMERGENCY_NUMBER_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EMERGENCY_NUMBER_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_emergency_number_list(pkbuf_t *pkbuf, nas_emergency_number_list_t *emergency_number_list) +int nas_encode_emergency_number_list(ogs_pkbuf_t *pkbuf, nas_emergency_number_list_t *emergency_number_list) { - c_uint16_t size = emergency_number_list->length + sizeof(emergency_number_list->length); + uint16_t size = emergency_number_list->length + sizeof(emergency_number_list->length); nas_emergency_number_list_t target; memcpy(&target, emergency_number_list, sizeof(nas_emergency_number_list_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EMERGENCY_NUMBER_LIST - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EMERGENCY_NUMBER_LIST - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.38 CLI * O TLV 3-14 */ -c_int16_t nas_decode_cli(nas_cli_t *cli, pkbuf_t *pkbuf) +int nas_decode_cli(nas_cli_t *cli, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_cli_t *source = pkbuf->payload; + uint16_t size = 0; + nas_cli_t *source = pkbuf->data; cli->length = source->length; size = cli->length + sizeof(cli->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(cli, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(cli, pkbuf->data - size, size); - d_trace(25, " CLI - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" CLI - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_cli(pkbuf_t *pkbuf, nas_cli_t *cli) +int nas_encode_cli(ogs_pkbuf_t *pkbuf, nas_cli_t *cli) { - c_uint16_t size = cli->length + sizeof(cli->length); + uint16_t size = cli->length + sizeof(cli->length); nas_cli_t target; memcpy(&target, cli, sizeof(nas_cli_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " CLI - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" CLI - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.39 SS Code * O TV 2 */ -c_int16_t nas_decode_ss_code(nas_ss_code_t *ss_code, pkbuf_t *pkbuf) +int nas_decode_ss_code(nas_ss_code_t *ss_code, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_ss_code_t); + uint16_t size = sizeof(nas_ss_code_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(ss_code, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(ss_code, pkbuf->data - size, size); - d_trace(25, " SS_CODE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SS_CODE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_ss_code(pkbuf_t *pkbuf, nas_ss_code_t *ss_code) +int nas_encode_ss_code(ogs_pkbuf_t *pkbuf, nas_ss_code_t *ss_code) { - c_uint16_t size = sizeof(nas_ss_code_t); + uint16_t size = sizeof(nas_ss_code_t); nas_ss_code_t target; memcpy(&target, ss_code, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " SS_CODE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SS_CODE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.4 Authentication response parameter * M LV 5-17 */ -c_int16_t nas_decode_authentication_response_parameter(nas_authentication_response_parameter_t *authentication_response_parameter, pkbuf_t *pkbuf) +int nas_decode_authentication_response_parameter(nas_authentication_response_parameter_t *authentication_response_parameter, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_authentication_response_parameter_t *source = pkbuf->payload; + uint16_t size = 0; + nas_authentication_response_parameter_t *source = pkbuf->data; authentication_response_parameter->length = source->length; size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(authentication_response_parameter, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(authentication_response_parameter, pkbuf->data - size, size); - d_trace(25, " AUTHENTICATION_RESPONSE_PARAMETER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_RESPONSE_PARAMETER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_authentication_response_parameter(pkbuf_t *pkbuf, nas_authentication_response_parameter_t *authentication_response_parameter) +int nas_encode_authentication_response_parameter(ogs_pkbuf_t *pkbuf, nas_authentication_response_parameter_t *authentication_response_parameter) { - c_uint16_t size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length); + uint16_t size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length); nas_authentication_response_parameter_t target; memcpy(&target, authentication_response_parameter, sizeof(nas_authentication_response_parameter_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " AUTHENTICATION_RESPONSE_PARAMETER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" AUTHENTICATION_RESPONSE_PARAMETER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.40 LCS indicator * O TV 2 */ -c_int16_t nas_decode_lcs_indicator(nas_lcs_indicator_t *lcs_indicator, pkbuf_t *pkbuf) +int nas_decode_lcs_indicator(nas_lcs_indicator_t *lcs_indicator, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_lcs_indicator_t); + uint16_t size = sizeof(nas_lcs_indicator_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(lcs_indicator, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(lcs_indicator, pkbuf->data - size, size); - d_trace(25, " LCS_INDICATOR - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LCS_INDICATOR - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_lcs_indicator(pkbuf_t *pkbuf, nas_lcs_indicator_t *lcs_indicator) +int nas_encode_lcs_indicator(ogs_pkbuf_t *pkbuf, nas_lcs_indicator_t *lcs_indicator) { - c_uint16_t size = sizeof(nas_lcs_indicator_t); + uint16_t size = sizeof(nas_lcs_indicator_t); nas_lcs_indicator_t target; memcpy(&target, lcs_indicator, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " LCS_INDICATOR - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LCS_INDICATOR - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.41 LCS client identity * O TLV 3-257 */ -c_int16_t nas_decode_lcs_client_identity(nas_lcs_client_identity_t *lcs_client_identity, pkbuf_t *pkbuf) +int nas_decode_lcs_client_identity(nas_lcs_client_identity_t *lcs_client_identity, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_lcs_client_identity_t *source = pkbuf->payload; + uint16_t size = 0; + nas_lcs_client_identity_t *source = pkbuf->data; lcs_client_identity->length = source->length; size = lcs_client_identity->length + sizeof(lcs_client_identity->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(lcs_client_identity, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(lcs_client_identity, pkbuf->data - size, size); - d_trace(25, " LCS_CLIENT_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LCS_CLIENT_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_lcs_client_identity(pkbuf_t *pkbuf, nas_lcs_client_identity_t *lcs_client_identity) +int nas_encode_lcs_client_identity(ogs_pkbuf_t *pkbuf, nas_lcs_client_identity_t *lcs_client_identity) { - c_uint16_t size = lcs_client_identity->length + sizeof(lcs_client_identity->length); + uint16_t size = lcs_client_identity->length + sizeof(lcs_client_identity->length); nas_lcs_client_identity_t target; memcpy(&target, lcs_client_identity, sizeof(nas_lcs_client_identity_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " LCS_CLIENT_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LCS_CLIENT_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.42 Generic message container type * M V 1 */ -c_int16_t nas_decode_generic_message_container_type(nas_generic_message_container_type_t *generic_message_container_type, pkbuf_t *pkbuf) +int nas_decode_generic_message_container_type(nas_generic_message_container_type_t *generic_message_container_type, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_generic_message_container_type_t); + uint16_t size = sizeof(nas_generic_message_container_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(generic_message_container_type, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(generic_message_container_type, pkbuf->data - size, size); - d_trace(25, " GENERIC_MESSAGE_CONTAINER_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GENERIC_MESSAGE_CONTAINER_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_generic_message_container_type(pkbuf_t *pkbuf, nas_generic_message_container_type_t *generic_message_container_type) +int nas_encode_generic_message_container_type(ogs_pkbuf_t *pkbuf, nas_generic_message_container_type_t *generic_message_container_type) { - c_uint16_t size = sizeof(nas_generic_message_container_type_t); + uint16_t size = sizeof(nas_generic_message_container_type_t); nas_generic_message_container_type_t target; memcpy(&target, generic_message_container_type, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " GENERIC_MESSAGE_CONTAINER_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GENERIC_MESSAGE_CONTAINER_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.43 Generic message container * M LV-E 3-n */ -c_int16_t nas_decode_generic_message_container(nas_generic_message_container_t *generic_message_container, pkbuf_t *pkbuf) +int nas_decode_generic_message_container(nas_generic_message_container_t *generic_message_container, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_generic_message_container_t *source = pkbuf->payload; + uint16_t size = 0; + nas_generic_message_container_t *source = pkbuf->data; generic_message_container->length = ntohs(source->length); size = generic_message_container->length + sizeof(generic_message_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - generic_message_container->buffer = pkbuf->payload - size + sizeof(generic_message_container->length); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + generic_message_container->buffer = pkbuf->data - size + sizeof(generic_message_container->length); - d_trace(25, " GENERIC_MESSAGE_CONTAINER - "); - d_trace_hex(25, generic_message_container->buffer, generic_message_container->length); + ogs_trace(" GENERIC_MESSAGE_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, (void*)generic_message_container->buffer, generic_message_container->length); return size; } -c_int16_t nas_encode_generic_message_container(pkbuf_t *pkbuf, nas_generic_message_container_t *generic_message_container) +int nas_encode_generic_message_container(ogs_pkbuf_t *pkbuf, nas_generic_message_container_t *generic_message_container) { - c_uint16_t size = 0; - c_uint16_t target; + uint16_t size = 0; + uint16_t target; - d_assert(generic_message_container, return -1, "Null param"); - d_assert(generic_message_container->buffer, return -1, "Null param"); + ogs_assert(generic_message_container); + ogs_assert(generic_message_container->buffer); size = sizeof(generic_message_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); target = htons(generic_message_container->length); - memcpy(pkbuf->payload - size, &target, size); + memcpy(pkbuf->data - size, &target, size); size = generic_message_container->length; - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, generic_message_container->buffer, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, generic_message_container->buffer, size); - d_trace(25, " GENERIC_MESSAGE_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GENERIC_MESSAGE_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return generic_message_container->length + sizeof(generic_message_container->length); } /* 9.9.3.44 Voice domain preference and UE usage setting * O TLV 3 */ -c_int16_t nas_decode_voice_domain_preference_and_ue_usage_setting(nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting, pkbuf_t *pkbuf) +int nas_decode_voice_domain_preference_and_ue_usage_setting(nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_voice_domain_preference_and_ue_usage_setting_t *source = pkbuf->payload; + uint16_t size = 0; + nas_voice_domain_preference_and_ue_usage_setting_t *source = pkbuf->data; voice_domain_preference_and_ue_usage_setting->length = source->length; size = voice_domain_preference_and_ue_usage_setting->length + sizeof(voice_domain_preference_and_ue_usage_setting->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(voice_domain_preference_and_ue_usage_setting, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(voice_domain_preference_and_ue_usage_setting, pkbuf->data - size, size); - d_trace(25, " VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_voice_domain_preference_and_ue_usage_setting(pkbuf_t *pkbuf, nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting) +int nas_encode_voice_domain_preference_and_ue_usage_setting(ogs_pkbuf_t *pkbuf, nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting) { - c_uint16_t size = voice_domain_preference_and_ue_usage_setting->length + sizeof(voice_domain_preference_and_ue_usage_setting->length); + uint16_t size = voice_domain_preference_and_ue_usage_setting->length + sizeof(voice_domain_preference_and_ue_usage_setting->length); nas_voice_domain_preference_and_ue_usage_setting_t target; memcpy(&target, voice_domain_preference_and_ue_usage_setting, sizeof(nas_voice_domain_preference_and_ue_usage_setting_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.45 GUTI type * O TV 1 */ -c_int16_t nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf) +int nas_decode_guti_type(nas_guti_type_t *guti_type, ogs_pkbuf_t *pkbuf) { - memcpy(guti_type, pkbuf->payload - 1, 1); + memcpy(guti_type, pkbuf->data - 1, 1); - d_trace(25, " GUTI_TYPE - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" GUTI_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_guti_type(pkbuf_t *pkbuf, nas_guti_type_t *guti_type) +int nas_encode_guti_type(ogs_pkbuf_t *pkbuf, nas_guti_type_t *guti_type) { - c_uint16_t size = sizeof(nas_guti_type_t); + uint16_t size = sizeof(nas_guti_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, guti_type, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, guti_type, size); - d_trace(25, " GUTI_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" GUTI_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.46 Extended DRX parameters * O TLV 3 */ -c_int16_t nas_decode_extended_drx_parameters(nas_extended_drx_parameters_t *extended_drx_parameters, pkbuf_t *pkbuf) +int nas_decode_extended_drx_parameters(nas_extended_drx_parameters_t *extended_drx_parameters, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_extended_drx_parameters_t *source = pkbuf->payload; + uint16_t size = 0; + nas_extended_drx_parameters_t *source = pkbuf->data; extended_drx_parameters->length = source->length; size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(extended_drx_parameters, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(extended_drx_parameters, pkbuf->data - size, size); - d_trace(25, " EXTENDED_DRX_PARAMETERS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EXTENDED_DRX_PARAMETERS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_extended_drx_parameters(pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters) +int nas_encode_extended_drx_parameters(ogs_pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters) { - c_uint16_t size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length); + uint16_t size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length); nas_extended_drx_parameters_t target; memcpy(&target, extended_drx_parameters, sizeof(nas_extended_drx_parameters_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EXTENDED_DRX_PARAMETERS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EXTENDED_DRX_PARAMETERS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.4a Ciphering key sequence number * O TV 1 */ -c_int16_t nas_decode_ciphering_key_sequence_number(nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number, pkbuf_t *pkbuf) +int nas_decode_ciphering_key_sequence_number(nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number, ogs_pkbuf_t *pkbuf) { - memcpy(ciphering_key_sequence_number, pkbuf->payload - 1, 1); + memcpy(ciphering_key_sequence_number, pkbuf->data - 1, 1); - d_trace(25, " CIPHERING_KEY_SEQUENCE_NUMBER - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" CIPHERING_KEY_SEQUENCE_NUMBER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_ciphering_key_sequence_number(pkbuf_t *pkbuf, nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number) +int nas_encode_ciphering_key_sequence_number(ogs_pkbuf_t *pkbuf, nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number) { - c_uint16_t size = sizeof(nas_ciphering_key_sequence_number_t); + uint16_t size = sizeof(nas_ciphering_key_sequence_number_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, ciphering_key_sequence_number, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, ciphering_key_sequence_number, size); - d_trace(25, " CIPHERING_KEY_SEQUENCE_NUMBER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" CIPHERING_KEY_SEQUENCE_NUMBER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.5 CSFB response * O TV 1 */ -c_int16_t nas_decode_csfb_response(nas_csfb_response_t *csfb_response, pkbuf_t *pkbuf) +int nas_decode_csfb_response(nas_csfb_response_t *csfb_response, ogs_pkbuf_t *pkbuf) { - memcpy(csfb_response, pkbuf->payload - 1, 1); + memcpy(csfb_response, pkbuf->data - 1, 1); - d_trace(25, " CSFB_RESPONSE - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" CSFB_RESPONSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_csfb_response(pkbuf_t *pkbuf, nas_csfb_response_t *csfb_response) +int nas_encode_csfb_response(ogs_pkbuf_t *pkbuf, nas_csfb_response_t *csfb_response) { - c_uint16_t size = sizeof(nas_csfb_response_t); + uint16_t size = sizeof(nas_csfb_response_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, csfb_response, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, csfb_response, size); - d_trace(25, " CSFB_RESPONSE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" CSFB_RESPONSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.6 Daylight saving time * O TLV 3 */ -c_int16_t nas_decode_daylight_saving_time(nas_daylight_saving_time_t *daylight_saving_time, pkbuf_t *pkbuf) +int nas_decode_daylight_saving_time(nas_daylight_saving_time_t *daylight_saving_time, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_daylight_saving_time_t *source = pkbuf->payload; + uint16_t size = 0; + nas_daylight_saving_time_t *source = pkbuf->data; daylight_saving_time->length = source->length; size = daylight_saving_time->length + sizeof(daylight_saving_time->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(daylight_saving_time, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(daylight_saving_time, pkbuf->data - size, size); - d_trace(25, " DAYLIGHT_SAVING_TIME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DAYLIGHT_SAVING_TIME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_daylight_saving_time(pkbuf_t *pkbuf, nas_daylight_saving_time_t *daylight_saving_time) +int nas_encode_daylight_saving_time(ogs_pkbuf_t *pkbuf, nas_daylight_saving_time_t *daylight_saving_time) { - c_uint16_t size = daylight_saving_time->length + sizeof(daylight_saving_time->length); + uint16_t size = daylight_saving_time->length + sizeof(daylight_saving_time->length); nas_daylight_saving_time_t target; memcpy(&target, daylight_saving_time, sizeof(nas_daylight_saving_time_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " DAYLIGHT_SAVING_TIME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DAYLIGHT_SAVING_TIME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.7 Detach type * M V 1/2 */ -c_int16_t nas_decode_detach_type(nas_detach_type_t *detach_type, pkbuf_t *pkbuf) +int nas_decode_detach_type(nas_detach_type_t *detach_type, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_detach_type_t); + uint16_t size = sizeof(nas_detach_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(detach_type, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(detach_type, pkbuf->data - size, size); - d_trace(25, " DETACH_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DETACH_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_detach_type(pkbuf_t *pkbuf, nas_detach_type_t *detach_type) +int nas_encode_detach_type(ogs_pkbuf_t *pkbuf, nas_detach_type_t *detach_type) { - c_uint16_t size = sizeof(nas_detach_type_t); + uint16_t size = sizeof(nas_detach_type_t); nas_detach_type_t target; memcpy(&target, detach_type, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " DETACH_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DETACH_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.8 DRX parameter * O TV 3 */ -c_int16_t nas_decode_drx_parameter(nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf) +int nas_decode_drx_parameter(nas_drx_parameter_t *drx_parameter, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_drx_parameter_t); + uint16_t size = sizeof(nas_drx_parameter_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(drx_parameter, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(drx_parameter, pkbuf->data - size, size); - d_trace(25, " DRX_PARAMETER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DRX_PARAMETER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_drx_parameter(pkbuf_t *pkbuf, nas_drx_parameter_t *drx_parameter) +int nas_encode_drx_parameter(ogs_pkbuf_t *pkbuf, nas_drx_parameter_t *drx_parameter) { - c_uint16_t size = sizeof(nas_drx_parameter_t); + uint16_t size = sizeof(nas_drx_parameter_t); nas_drx_parameter_t target; memcpy(&target, drx_parameter, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " DRX_PARAMETER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" DRX_PARAMETER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.3.9 EMM cause * O TV 2 */ -c_int16_t nas_decode_emm_cause(nas_emm_cause_t *emm_cause, pkbuf_t *pkbuf) +int nas_decode_emm_cause(nas_emm_cause_t *emm_cause, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_emm_cause_t); + uint16_t size = sizeof(nas_emm_cause_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(emm_cause, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(emm_cause, pkbuf->data - size, size); - d_trace(25, " EMM_CAUSE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EMM_CAUSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_emm_cause(pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause) +int nas_encode_emm_cause(ogs_pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause) { - c_uint16_t size = sizeof(nas_emm_cause_t); + uint16_t size = sizeof(nas_emm_cause_t); nas_emm_cause_t target; memcpy(&target, emm_cause, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EMM_CAUSE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EMM_CAUSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.1 Access point name * M LV 2-101 */ -c_int16_t nas_decode_access_point_name(nas_access_point_name_t *access_point_name, pkbuf_t *pkbuf) +int nas_decode_access_point_name(nas_access_point_name_t *access_point_name, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_access_point_name_t *source = pkbuf->payload; + uint16_t size = 0; + nas_access_point_name_t *source = pkbuf->data; access_point_name->length = source->length; size = access_point_name->length + sizeof(access_point_name->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(access_point_name, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(access_point_name, pkbuf->data - size, size); { - c_int8_t apn[MAX_APN_LEN]; + char apn[MAX_APN_LEN]; access_point_name->length = apn_parse(apn, access_point_name->apn, access_point_name->length); - core_cpystrn(access_point_name->apn, apn, c_min(access_point_name->length, MAX_APN_LEN) + 1); + ogs_cpystrn(access_point_name->apn, apn, ogs_min(access_point_name->length, MAX_APN_LEN) + 1); } - d_trace(25, " ACCESS_POINT_NAME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ACCESS_POINT_NAME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_access_point_name(pkbuf_t *pkbuf, nas_access_point_name_t *access_point_name) +int nas_encode_access_point_name(ogs_pkbuf_t *pkbuf, nas_access_point_name_t *access_point_name) { - c_uint16_t size = access_point_name->length + sizeof(access_point_name->length); + uint16_t size = access_point_name->length + sizeof(access_point_name->length); nas_access_point_name_t target; memcpy(&target, access_point_name, sizeof(nas_access_point_name_t)); target.length = apn_build(target.apn, access_point_name->apn, access_point_name->length); size = target.length + sizeof(target.length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " ACCESS_POINT_NAME - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ACCESS_POINT_NAME - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.11 Protocol configuration options * O TLV 3-253 */ -c_int16_t nas_decode_protocol_configuration_options(nas_protocol_configuration_options_t *protocol_configuration_options, pkbuf_t *pkbuf) +int nas_decode_protocol_configuration_options(nas_protocol_configuration_options_t *protocol_configuration_options, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_protocol_configuration_options_t *source = pkbuf->payload; + uint16_t size = 0; + nas_protocol_configuration_options_t *source = pkbuf->data; protocol_configuration_options->length = source->length; size = protocol_configuration_options->length + sizeof(protocol_configuration_options->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(protocol_configuration_options, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(protocol_configuration_options, pkbuf->data - size, size); - d_trace(25, " PROTOCOL_CONFIGURATION_OPTIONS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PROTOCOL_CONFIGURATION_OPTIONS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_protocol_configuration_options(pkbuf_t *pkbuf, nas_protocol_configuration_options_t *protocol_configuration_options) +int nas_encode_protocol_configuration_options(ogs_pkbuf_t *pkbuf, nas_protocol_configuration_options_t *protocol_configuration_options) { - c_uint16_t size = protocol_configuration_options->length + sizeof(protocol_configuration_options->length); + uint16_t size = protocol_configuration_options->length + sizeof(protocol_configuration_options->length); nas_protocol_configuration_options_t target; memcpy(&target, protocol_configuration_options, sizeof(nas_protocol_configuration_options_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " PROTOCOL_CONFIGURATION_OPTIONS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PROTOCOL_CONFIGURATION_OPTIONS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.12 Quality of service * O TLV 14-22 */ -c_int16_t nas_decode_quality_of_service(nas_quality_of_service_t *quality_of_service, pkbuf_t *pkbuf) +int nas_decode_quality_of_service(nas_quality_of_service_t *quality_of_service, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_quality_of_service_t *source = pkbuf->payload; + uint16_t size = 0; + nas_quality_of_service_t *source = pkbuf->data; quality_of_service->length = source->length; size = quality_of_service->length + sizeof(quality_of_service->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(quality_of_service, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(quality_of_service, pkbuf->data - size, size); - d_trace(25, " QUALITY_OF_SERVICE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" QUALITY_OF_SERVICE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_quality_of_service(pkbuf_t *pkbuf, nas_quality_of_service_t *quality_of_service) +int nas_encode_quality_of_service(ogs_pkbuf_t *pkbuf, nas_quality_of_service_t *quality_of_service) { - c_uint16_t size = quality_of_service->length + sizeof(quality_of_service->length); + uint16_t size = quality_of_service->length + sizeof(quality_of_service->length); nas_quality_of_service_t target; memcpy(&target, quality_of_service, sizeof(nas_quality_of_service_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " QUALITY_OF_SERVICE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" QUALITY_OF_SERVICE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.13 Radio priority * O TV 1 */ -c_int16_t nas_decode_radio_priority(nas_radio_priority_t *radio_priority, pkbuf_t *pkbuf) +int nas_decode_radio_priority(nas_radio_priority_t *radio_priority, ogs_pkbuf_t *pkbuf) { - memcpy(radio_priority, pkbuf->payload - 1, 1); + memcpy(radio_priority, pkbuf->data - 1, 1); - d_trace(25, " RADIO_PRIORITY - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" RADIO_PRIORITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_radio_priority(pkbuf_t *pkbuf, nas_radio_priority_t *radio_priority) +int nas_encode_radio_priority(ogs_pkbuf_t *pkbuf, nas_radio_priority_t *radio_priority) { - c_uint16_t size = sizeof(nas_radio_priority_t); + uint16_t size = sizeof(nas_radio_priority_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, radio_priority, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, radio_priority, size); - d_trace(25, " RADIO_PRIORITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" RADIO_PRIORITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.13A Re-attempt indicator * O TLV 3 */ -c_int16_t nas_decode_re_attempt_indicator(nas_re_attempt_indicator_t *re_attempt_indicator, pkbuf_t *pkbuf) +int nas_decode_re_attempt_indicator(nas_re_attempt_indicator_t *re_attempt_indicator, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_re_attempt_indicator_t *source = pkbuf->payload; + uint16_t size = 0; + nas_re_attempt_indicator_t *source = pkbuf->data; re_attempt_indicator->length = source->length; size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(re_attempt_indicator, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(re_attempt_indicator, pkbuf->data - size, size); - d_trace(25, " RE_ATTEMPT_INDICATOR - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" RE_ATTEMPT_INDICATOR - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_re_attempt_indicator(pkbuf_t *pkbuf, nas_re_attempt_indicator_t *re_attempt_indicator) +int nas_encode_re_attempt_indicator(ogs_pkbuf_t *pkbuf, nas_re_attempt_indicator_t *re_attempt_indicator) { - c_uint16_t size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length); + uint16_t size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length); nas_re_attempt_indicator_t target; memcpy(&target, re_attempt_indicator, sizeof(nas_re_attempt_indicator_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " RE_ATTEMPT_INDICATOR - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" RE_ATTEMPT_INDICATOR - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.14 Request type * M V 1/2 */ -c_int16_t nas_decode_request_type(nas_request_type_t *request_type, pkbuf_t *pkbuf) +int nas_decode_request_type(nas_request_type_t *request_type, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_request_type_t); + uint16_t size = sizeof(nas_request_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(request_type, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(request_type, pkbuf->data - size, size); - d_trace(25, " REQUEST_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" REQUEST_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_request_type(pkbuf_t *pkbuf, nas_request_type_t *request_type) +int nas_encode_request_type(ogs_pkbuf_t *pkbuf, nas_request_type_t *request_type) { - c_uint16_t size = sizeof(nas_request_type_t); + uint16_t size = sizeof(nas_request_type_t); nas_request_type_t target; memcpy(&target, request_type, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " REQUEST_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" REQUEST_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.15 Traffic flow aggregate description * M LV 2-256 */ -c_int16_t nas_decode_traffic_flow_aggregate_description(nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description, pkbuf_t *pkbuf) +int nas_decode_traffic_flow_aggregate_description(nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_traffic_flow_aggregate_description_t *source = pkbuf->payload; + uint16_t size = 0; + nas_traffic_flow_aggregate_description_t *source = pkbuf->data; traffic_flow_aggregate_description->length = source->length; size = traffic_flow_aggregate_description->length + sizeof(traffic_flow_aggregate_description->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(traffic_flow_aggregate_description, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(traffic_flow_aggregate_description, pkbuf->data - size, size); - d_trace(25, " TRAFFIC_FLOW_AGGREGATE_DESCRIPTION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRAFFIC_FLOW_AGGREGATE_DESCRIPTION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_traffic_flow_aggregate_description(pkbuf_t *pkbuf, nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description) +int nas_encode_traffic_flow_aggregate_description(ogs_pkbuf_t *pkbuf, nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description) { - c_uint16_t size = traffic_flow_aggregate_description->length + sizeof(traffic_flow_aggregate_description->length); + uint16_t size = traffic_flow_aggregate_description->length + sizeof(traffic_flow_aggregate_description->length); nas_traffic_flow_aggregate_description_t target; memcpy(&target, traffic_flow_aggregate_description, sizeof(nas_traffic_flow_aggregate_description_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TRAFFIC_FLOW_AGGREGATE_DESCRIPTION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRAFFIC_FLOW_AGGREGATE_DESCRIPTION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.16 Traffic flow template * M LV 2-256 */ -c_int16_t nas_decode_traffic_flow_template(nas_traffic_flow_template_t *traffic_flow_template, pkbuf_t *pkbuf) +int nas_decode_traffic_flow_template(nas_traffic_flow_template_t *traffic_flow_template, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_traffic_flow_template_t *source = pkbuf->payload; + uint16_t size = 0; + nas_traffic_flow_template_t *source = pkbuf->data; traffic_flow_template->length = source->length; size = traffic_flow_template->length + sizeof(traffic_flow_template->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(traffic_flow_template, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(traffic_flow_template, pkbuf->data - size, size); - d_trace(25, " TRAFFIC_FLOW_TEMPLATE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRAFFIC_FLOW_TEMPLATE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_traffic_flow_template(pkbuf_t *pkbuf, nas_traffic_flow_template_t *traffic_flow_template) +int nas_encode_traffic_flow_template(ogs_pkbuf_t *pkbuf, nas_traffic_flow_template_t *traffic_flow_template) { - c_uint16_t size = traffic_flow_template->length + sizeof(traffic_flow_template->length); + uint16_t size = traffic_flow_template->length + sizeof(traffic_flow_template->length); nas_traffic_flow_template_t target; memcpy(&target, traffic_flow_template, sizeof(nas_traffic_flow_template_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TRAFFIC_FLOW_TEMPLATE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRAFFIC_FLOW_TEMPLATE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.17 Transaction identifier * O TLV 3-4 */ -c_int16_t nas_decode_transaction_identifier(nas_transaction_identifier_t *transaction_identifier, pkbuf_t *pkbuf) +int nas_decode_transaction_identifier(nas_transaction_identifier_t *transaction_identifier, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_transaction_identifier_t *source = pkbuf->payload; + uint16_t size = 0; + nas_transaction_identifier_t *source = pkbuf->data; transaction_identifier->length = source->length; size = transaction_identifier->length + sizeof(transaction_identifier->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(transaction_identifier, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(transaction_identifier, pkbuf->data - size, size); - d_trace(25, " TRANSACTION_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRANSACTION_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_transaction_identifier(pkbuf_t *pkbuf, nas_transaction_identifier_t *transaction_identifier) +int nas_encode_transaction_identifier(ogs_pkbuf_t *pkbuf, nas_transaction_identifier_t *transaction_identifier) { - c_uint16_t size = transaction_identifier->length + sizeof(transaction_identifier->length); + uint16_t size = transaction_identifier->length + sizeof(transaction_identifier->length); nas_transaction_identifier_t target; memcpy(&target, transaction_identifier, sizeof(nas_transaction_identifier_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " TRANSACTION_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" TRANSACTION_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.18 WLAN offload acceptability * O TV 1 */ -c_int16_t nas_decode_wlan_offload_acceptability(nas_wlan_offload_acceptability_t *wlan_offload_acceptability, pkbuf_t *pkbuf) +int nas_decode_wlan_offload_acceptability(nas_wlan_offload_acceptability_t *wlan_offload_acceptability, ogs_pkbuf_t *pkbuf) { - memcpy(wlan_offload_acceptability, pkbuf->payload - 1, 1); + memcpy(wlan_offload_acceptability, pkbuf->data - 1, 1); - d_trace(25, " WLAN_OFFLOAD_ACCEPTABILITY - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" WLAN_OFFLOAD_ACCEPTABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_wlan_offload_acceptability(pkbuf_t *pkbuf, nas_wlan_offload_acceptability_t *wlan_offload_acceptability) +int nas_encode_wlan_offload_acceptability(ogs_pkbuf_t *pkbuf, nas_wlan_offload_acceptability_t *wlan_offload_acceptability) { - c_uint16_t size = sizeof(nas_wlan_offload_acceptability_t); + uint16_t size = sizeof(nas_wlan_offload_acceptability_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, wlan_offload_acceptability, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, wlan_offload_acceptability, size); - d_trace(25, " WLAN_OFFLOAD_ACCEPTABILITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" WLAN_OFFLOAD_ACCEPTABILITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.19 NBIFOM container * O TLV 3-257 */ -c_int16_t nas_decode_nbifom_container(nas_nbifom_container_t *nbifom_container, pkbuf_t *pkbuf) +int nas_decode_nbifom_container(nas_nbifom_container_t *nbifom_container, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_nbifom_container_t *source = pkbuf->payload; + uint16_t size = 0; + nas_nbifom_container_t *source = pkbuf->data; nbifom_container->length = source->length; size = nbifom_container->length + sizeof(nbifom_container->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(nbifom_container, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(nbifom_container, pkbuf->data - size, size); - d_trace(25, " NBIFOM_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NBIFOM_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_nbifom_container(pkbuf_t *pkbuf, nas_nbifom_container_t *nbifom_container) +int nas_encode_nbifom_container(ogs_pkbuf_t *pkbuf, nas_nbifom_container_t *nbifom_container) { - c_uint16_t size = nbifom_container->length + sizeof(nbifom_container->length); + uint16_t size = nbifom_container->length + sizeof(nbifom_container->length); nas_nbifom_container_t target; memcpy(&target, nbifom_container, sizeof(nas_nbifom_container_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " NBIFOM_CONTAINER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" NBIFOM_CONTAINER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.2 APN aggregate maximum bit rate * O TLV 4-8 */ -c_int16_t nas_decode_apn_aggregate_maximum_bit_rate(nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate, pkbuf_t *pkbuf) +int nas_decode_apn_aggregate_maximum_bit_rate(nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_apn_aggregate_maximum_bit_rate_t *source = pkbuf->payload; + uint16_t size = 0; + nas_apn_aggregate_maximum_bit_rate_t *source = pkbuf->data; apn_aggregate_maximum_bit_rate->length = source->length; size = apn_aggregate_maximum_bit_rate->length + sizeof(apn_aggregate_maximum_bit_rate->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(apn_aggregate_maximum_bit_rate, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(apn_aggregate_maximum_bit_rate, pkbuf->data - size, size); - d_trace(25, " APN_AGGREGATE_MAXIMUM_BIT_RATE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" APN_AGGREGATE_MAXIMUM_BIT_RATE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_apn_aggregate_maximum_bit_rate(pkbuf_t *pkbuf, nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate) +int nas_encode_apn_aggregate_maximum_bit_rate(ogs_pkbuf_t *pkbuf, nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate) { - c_uint16_t size = apn_aggregate_maximum_bit_rate->length + sizeof(apn_aggregate_maximum_bit_rate->length); + uint16_t size = apn_aggregate_maximum_bit_rate->length + sizeof(apn_aggregate_maximum_bit_rate->length); nas_apn_aggregate_maximum_bit_rate_t target; memcpy(&target, apn_aggregate_maximum_bit_rate, sizeof(nas_apn_aggregate_maximum_bit_rate_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " APN_AGGREGATE_MAXIMUM_BIT_RATE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" APN_AGGREGATE_MAXIMUM_BIT_RATE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.22 Header compression configuration * O TLV 5-257 */ -c_int16_t nas_decode_header_compression_configuration(nas_header_compression_configuration_t *header_compression_configuration, pkbuf_t *pkbuf) +int nas_decode_header_compression_configuration(nas_header_compression_configuration_t *header_compression_configuration, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_header_compression_configuration_t *source = pkbuf->payload; + uint16_t size = 0; + nas_header_compression_configuration_t *source = pkbuf->data; header_compression_configuration->length = source->length; size = header_compression_configuration->length + sizeof(header_compression_configuration->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(header_compression_configuration, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(header_compression_configuration, pkbuf->data - size, size); header_compression_configuration->max_cid = ntohs(header_compression_configuration->max_cid); - d_trace(25, " HEADER_COMPRESSION_CONFIGURATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" HEADER_COMPRESSION_CONFIGURATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_header_compression_configuration(pkbuf_t *pkbuf, nas_header_compression_configuration_t *header_compression_configuration) +int nas_encode_header_compression_configuration(ogs_pkbuf_t *pkbuf, nas_header_compression_configuration_t *header_compression_configuration) { - c_uint16_t size = header_compression_configuration->length + sizeof(header_compression_configuration->length); + uint16_t size = header_compression_configuration->length + sizeof(header_compression_configuration->length); nas_header_compression_configuration_t target; memcpy(&target, header_compression_configuration, sizeof(nas_header_compression_configuration_t)); target.max_cid = htons(header_compression_configuration->max_cid); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " HEADER_COMPRESSION_CONFIGURATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" HEADER_COMPRESSION_CONFIGURATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.23 Control plane only indication * O TV 1 */ -c_int16_t nas_decode_control_plane_only_indication(nas_control_plane_only_indication_t *control_plane_only_indication, pkbuf_t *pkbuf) +int nas_decode_control_plane_only_indication(nas_control_plane_only_indication_t *control_plane_only_indication, ogs_pkbuf_t *pkbuf) { - memcpy(control_plane_only_indication, pkbuf->payload - 1, 1); + memcpy(control_plane_only_indication, pkbuf->data - 1, 1); - d_trace(25, " CONTROL_PLANE_ONLY_INDICATION - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" CONTROL_PLANE_ONLY_INDICATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_control_plane_only_indication(pkbuf_t *pkbuf, nas_control_plane_only_indication_t *control_plane_only_indication) +int nas_encode_control_plane_only_indication(ogs_pkbuf_t *pkbuf, nas_control_plane_only_indication_t *control_plane_only_indication) { - c_uint16_t size = sizeof(nas_control_plane_only_indication_t); + uint16_t size = sizeof(nas_control_plane_only_indication_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, control_plane_only_indication, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, control_plane_only_indication, size); - d_trace(25, " CONTROL_PLANE_ONLY_INDICATION - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" CONTROL_PLANE_ONLY_INDICATION - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.26 Extended protocol configuration options * O TLV-E 4-65538 */ -c_int16_t nas_decode_extended_protocol_configuration_options(nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, pkbuf_t *pkbuf) +int nas_decode_extended_protocol_configuration_options(nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_extended_protocol_configuration_options_t *source = pkbuf->payload; + uint16_t size = 0; + nas_extended_protocol_configuration_options_t *source = pkbuf->data; extended_protocol_configuration_options->length = ntohs(source->length); size = extended_protocol_configuration_options->length + sizeof(extended_protocol_configuration_options->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - extended_protocol_configuration_options->buffer = pkbuf->payload - size + sizeof(extended_protocol_configuration_options->length); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + extended_protocol_configuration_options->buffer = pkbuf->data - size + sizeof(extended_protocol_configuration_options->length); - d_trace(25, " EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS - "); - d_trace_hex(25, extended_protocol_configuration_options->buffer, extended_protocol_configuration_options->length); + ogs_trace(" EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS - "); + ogs_log_hexdump(OGS_LOG_TRACE, (void*)extended_protocol_configuration_options->buffer, extended_protocol_configuration_options->length); return size; } -c_int16_t nas_encode_extended_protocol_configuration_options(pkbuf_t *pkbuf, nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options) +int nas_encode_extended_protocol_configuration_options(ogs_pkbuf_t *pkbuf, nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options) { - c_uint16_t size = 0; - c_uint16_t target; + uint16_t size = 0; + uint16_t target; - d_assert(extended_protocol_configuration_options, return -1, "Null param"); - d_assert(extended_protocol_configuration_options->buffer, return -1, "Null param"); + ogs_assert(extended_protocol_configuration_options); + ogs_assert(extended_protocol_configuration_options->buffer); size = sizeof(extended_protocol_configuration_options->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); target = htons(extended_protocol_configuration_options->length); - memcpy(pkbuf->payload - size, &target, size); + memcpy(pkbuf->data - size, &target, size); size = extended_protocol_configuration_options->length; - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, extended_protocol_configuration_options->buffer, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, extended_protocol_configuration_options->buffer, size); - d_trace(25, " EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return extended_protocol_configuration_options->length + sizeof(extended_protocol_configuration_options->length); } /* 9.9.4.27 Header compression configuration status * O TLV 4 */ -c_int16_t nas_decode_header_compression_configuration_status(nas_header_compression_configuration_status_t *header_compression_configuration_status, pkbuf_t *pkbuf) +int nas_decode_header_compression_configuration_status(nas_header_compression_configuration_status_t *header_compression_configuration_status, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_header_compression_configuration_status_t *source = pkbuf->payload; + uint16_t size = 0; + nas_header_compression_configuration_status_t *source = pkbuf->data; header_compression_configuration_status->length = source->length; size = header_compression_configuration_status->length + sizeof(header_compression_configuration_status->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(header_compression_configuration_status, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(header_compression_configuration_status, pkbuf->data - size, size); - d_trace(25, " HEADER_COMPRESSION_CONFIGURATION_STATUS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" HEADER_COMPRESSION_CONFIGURATION_STATUS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_header_compression_configuration_status(pkbuf_t *pkbuf, nas_header_compression_configuration_status_t *header_compression_configuration_status) +int nas_encode_header_compression_configuration_status(ogs_pkbuf_t *pkbuf, nas_header_compression_configuration_status_t *header_compression_configuration_status) { - c_uint16_t size = header_compression_configuration_status->length + sizeof(header_compression_configuration_status->length); + uint16_t size = header_compression_configuration_status->length + sizeof(header_compression_configuration_status->length); nas_header_compression_configuration_status_t target; memcpy(&target, header_compression_configuration_status, sizeof(nas_header_compression_configuration_status_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " HEADER_COMPRESSION_CONFIGURATION_STATUS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" HEADER_COMPRESSION_CONFIGURATION_STATUS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.28 Serving PLMN rate control * O TLV 4 */ -c_int16_t nas_decode_serving_plmn_rate_control(nas_serving_plmn_rate_control_t *serving_plmn_rate_control, pkbuf_t *pkbuf) +int nas_decode_serving_plmn_rate_control(nas_serving_plmn_rate_control_t *serving_plmn_rate_control, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_serving_plmn_rate_control_t *source = pkbuf->payload; + uint16_t size = 0; + nas_serving_plmn_rate_control_t *source = pkbuf->data; serving_plmn_rate_control->length = source->length; size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(serving_plmn_rate_control, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(serving_plmn_rate_control, pkbuf->data - size, size); - d_trace(25, " SERVING_PLMN_RATE_CONTROL - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SERVING_PLMN_RATE_CONTROL - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_serving_plmn_rate_control(pkbuf_t *pkbuf, nas_serving_plmn_rate_control_t *serving_plmn_rate_control) +int nas_encode_serving_plmn_rate_control(ogs_pkbuf_t *pkbuf, nas_serving_plmn_rate_control_t *serving_plmn_rate_control) { - c_uint16_t size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length); + uint16_t size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length); nas_serving_plmn_rate_control_t target; memcpy(&target, serving_plmn_rate_control, sizeof(nas_serving_plmn_rate_control_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " SERVING_PLMN_RATE_CONTROL - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" SERVING_PLMN_RATE_CONTROL - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.2A Connectivity type * O TV 1 */ -c_int16_t nas_decode_connectivity_type(nas_connectivity_type_t *connectivity_type, pkbuf_t *pkbuf) +int nas_decode_connectivity_type(nas_connectivity_type_t *connectivity_type, ogs_pkbuf_t *pkbuf) { - memcpy(connectivity_type, pkbuf->payload - 1, 1); + memcpy(connectivity_type, pkbuf->data - 1, 1); - d_trace(25, " CONNECTIVITY_TYPE - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" CONNECTIVITY_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_connectivity_type(pkbuf_t *pkbuf, nas_connectivity_type_t *connectivity_type) +int nas_encode_connectivity_type(ogs_pkbuf_t *pkbuf, nas_connectivity_type_t *connectivity_type) { - c_uint16_t size = sizeof(nas_connectivity_type_t); + uint16_t size = sizeof(nas_connectivity_type_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, connectivity_type, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, connectivity_type, size); - d_trace(25, " CONNECTIVITY_TYPE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" CONNECTIVITY_TYPE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.3 EPS quality of service * M LV 2-14 */ -c_int16_t nas_decode_eps_quality_of_service(nas_eps_quality_of_service_t *eps_quality_of_service, pkbuf_t *pkbuf) +int nas_decode_eps_quality_of_service(nas_eps_quality_of_service_t *eps_quality_of_service, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_eps_quality_of_service_t *source = pkbuf->payload; + uint16_t size = 0; + nas_eps_quality_of_service_t *source = pkbuf->data; eps_quality_of_service->length = source->length; size = eps_quality_of_service->length + sizeof(eps_quality_of_service->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(eps_quality_of_service, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(eps_quality_of_service, pkbuf->data - size, size); - d_trace(25, " EPS_QUALITY_OF_SERVICE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_QUALITY_OF_SERVICE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_eps_quality_of_service(pkbuf_t *pkbuf, nas_eps_quality_of_service_t *eps_quality_of_service) +int nas_encode_eps_quality_of_service(ogs_pkbuf_t *pkbuf, nas_eps_quality_of_service_t *eps_quality_of_service) { - c_uint16_t size = eps_quality_of_service->length + sizeof(eps_quality_of_service->length); + uint16_t size = eps_quality_of_service->length + sizeof(eps_quality_of_service->length); nas_eps_quality_of_service_t target; memcpy(&target, eps_quality_of_service, sizeof(nas_eps_quality_of_service_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " EPS_QUALITY_OF_SERVICE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" EPS_QUALITY_OF_SERVICE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.4 ESM cause * O TV 2 */ -c_int16_t nas_decode_esm_cause(nas_esm_cause_t *esm_cause, pkbuf_t *pkbuf) +int nas_decode_esm_cause(nas_esm_cause_t *esm_cause, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_esm_cause_t); + uint16_t size = sizeof(nas_esm_cause_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(esm_cause, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(esm_cause, pkbuf->data - size, size); - d_trace(25, " ESM_CAUSE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ESM_CAUSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_esm_cause(pkbuf_t *pkbuf, nas_esm_cause_t *esm_cause) +int nas_encode_esm_cause(ogs_pkbuf_t *pkbuf, nas_esm_cause_t *esm_cause) { - c_uint16_t size = sizeof(nas_esm_cause_t); + uint16_t size = sizeof(nas_esm_cause_t); nas_esm_cause_t target; memcpy(&target, esm_cause, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " ESM_CAUSE - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ESM_CAUSE - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.5 ESM information transfer flag * O TV 1 */ -c_int16_t nas_decode_esm_information_transfer_flag(nas_esm_information_transfer_flag_t *esm_information_transfer_flag, pkbuf_t *pkbuf) +int nas_decode_esm_information_transfer_flag(nas_esm_information_transfer_flag_t *esm_information_transfer_flag, ogs_pkbuf_t *pkbuf) { - memcpy(esm_information_transfer_flag, pkbuf->payload - 1, 1); + memcpy(esm_information_transfer_flag, pkbuf->data - 1, 1); - d_trace(25, " ESM_INFORMATION_TRANSFER_FLAG - "); - d_trace_hex(25, pkbuf->payload - 1, 1); + ogs_trace(" ESM_INFORMATION_TRANSFER_FLAG - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1); return 0; } -c_int16_t nas_encode_esm_information_transfer_flag(pkbuf_t *pkbuf, nas_esm_information_transfer_flag_t *esm_information_transfer_flag) +int nas_encode_esm_information_transfer_flag(ogs_pkbuf_t *pkbuf, nas_esm_information_transfer_flag_t *esm_information_transfer_flag) { - c_uint16_t size = sizeof(nas_esm_information_transfer_flag_t); + uint16_t size = sizeof(nas_esm_information_transfer_flag_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, esm_information_transfer_flag, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, esm_information_transfer_flag, size); - d_trace(25, " ESM_INFORMATION_TRANSFER_FLAG - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" ESM_INFORMATION_TRANSFER_FLAG - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.6 Linked EPS bearer identity * M V 1/2 */ -c_int16_t nas_decode_linked_eps_bearer_identity(nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity, pkbuf_t *pkbuf) +int nas_decode_linked_eps_bearer_identity(nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_linked_eps_bearer_identity_t); + uint16_t size = sizeof(nas_linked_eps_bearer_identity_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(linked_eps_bearer_identity, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(linked_eps_bearer_identity, pkbuf->data - size, size); - d_trace(25, " LINKED_EPS_BEARER_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LINKED_EPS_BEARER_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_linked_eps_bearer_identity(pkbuf_t *pkbuf, nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity) +int nas_encode_linked_eps_bearer_identity(ogs_pkbuf_t *pkbuf, nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity) { - c_uint16_t size = sizeof(nas_linked_eps_bearer_identity_t); + uint16_t size = sizeof(nas_linked_eps_bearer_identity_t); nas_linked_eps_bearer_identity_t target; memcpy(&target, linked_eps_bearer_identity, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " LINKED_EPS_BEARER_IDENTITY - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LINKED_EPS_BEARER_IDENTITY - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.7 LLC service access point identifier * O TV 2 */ -c_int16_t nas_decode_llc_service_access_point_identifier(nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier, pkbuf_t *pkbuf) +int nas_decode_llc_service_access_point_identifier(nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = sizeof(nas_llc_service_access_point_identifier_t); + uint16_t size = sizeof(nas_llc_service_access_point_identifier_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(llc_service_access_point_identifier, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(llc_service_access_point_identifier, pkbuf->data - size, size); - d_trace(25, " LLC_SERVICE_ACCESS_POINT_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LLC_SERVICE_ACCESS_POINT_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_llc_service_access_point_identifier(pkbuf_t *pkbuf, nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier) +int nas_encode_llc_service_access_point_identifier(ogs_pkbuf_t *pkbuf, nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier) { - c_uint16_t size = sizeof(nas_llc_service_access_point_identifier_t); + uint16_t size = sizeof(nas_llc_service_access_point_identifier_t); nas_llc_service_access_point_identifier_t target; memcpy(&target, llc_service_access_point_identifier, size); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " LLC_SERVICE_ACCESS_POINT_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" LLC_SERVICE_ACCESS_POINT_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.8 Packet flow Identifier * O TLV 3 */ -c_int16_t nas_decode_packet_flow_identifier(nas_packet_flow_identifier_t *packet_flow_identifier, pkbuf_t *pkbuf) +int nas_decode_packet_flow_identifier(nas_packet_flow_identifier_t *packet_flow_identifier, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_packet_flow_identifier_t *source = pkbuf->payload; + uint16_t size = 0; + nas_packet_flow_identifier_t *source = pkbuf->data; packet_flow_identifier->length = source->length; size = packet_flow_identifier->length + sizeof(packet_flow_identifier->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(packet_flow_identifier, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(packet_flow_identifier, pkbuf->data - size, size); - d_trace(25, " PACKET_FLOW_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PACKET_FLOW_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_packet_flow_identifier(pkbuf_t *pkbuf, nas_packet_flow_identifier_t *packet_flow_identifier) +int nas_encode_packet_flow_identifier(ogs_pkbuf_t *pkbuf, nas_packet_flow_identifier_t *packet_flow_identifier) { - c_uint16_t size = packet_flow_identifier->length + sizeof(packet_flow_identifier->length); + uint16_t size = packet_flow_identifier->length + sizeof(packet_flow_identifier->length); nas_packet_flow_identifier_t target; memcpy(&target, packet_flow_identifier, sizeof(nas_packet_flow_identifier_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " PACKET_FLOW_IDENTIFIER - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PACKET_FLOW_IDENTIFIER - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } /* 9.9.4.9 PDN address * M LV 6-14 */ -c_int16_t nas_decode_pdn_address(nas_pdn_address_t *pdn_address, pkbuf_t *pkbuf) +int nas_decode_pdn_address(nas_pdn_address_t *pdn_address, ogs_pkbuf_t *pkbuf) { - c_uint16_t size = 0; - nas_pdn_address_t *source = pkbuf->payload; + uint16_t size = 0; + nas_pdn_address_t *source = pkbuf->data; pdn_address->length = source->length; size = pdn_address->length + sizeof(pdn_address->length); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pdn_address, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pdn_address, pkbuf->data - size, size); - d_trace(25, " PDN_ADDRESS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PDN_ADDRESS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } -c_int16_t nas_encode_pdn_address(pkbuf_t *pkbuf, nas_pdn_address_t *pdn_address) +int nas_encode_pdn_address(ogs_pkbuf_t *pkbuf, nas_pdn_address_t *pdn_address) { - c_uint16_t size = pdn_address->length + sizeof(pdn_address->length); + uint16_t size = pdn_address->length + sizeof(pdn_address->length); nas_pdn_address_t target; memcpy(&target, pdn_address, sizeof(nas_pdn_address_t)); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &target, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &target, size); - d_trace(25, " PDN_ADDRESS - "); - d_trace_hex(25, pkbuf->payload - size, size); + ogs_trace(" PDN_ADDRESS - "); + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size); return size; } diff --git a/lib/nas/nas_ies.h b/lib/nas/nas_ies.h index dbb1c69f8..8ca07ee3f 100644 --- a/lib/nas/nas_ies.h +++ b/lib/nas/nas_ies.h @@ -1,228 +1,221 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by nas_message.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2019-03-17 01:58:02.723555 by acetcom + * Created on: 2019-03-17 02:01:09.521707 by acetcom * from 24301-d80.docx ******************************************************************************/ #ifndef __NAS_IES_H__ #define __NAS_IES_H__ -#include "core_pkbuf.h" #include "nas_types.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(c_int16_t) nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type); +int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type); -CORE_DECLARE(c_int16_t) nas_decode_additional_information(nas_additional_information_t *additional_information, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_device_properties(nas_device_properties_t *device_properties, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_bearer_context_status(nas_eps_bearer_context_status_t *eps_bearer_context_status, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_supported_codec_list(nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_location_area_identification(nas_location_area_identification_t *location_area_identification, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_mobile_identity(nas_mobile_identity_t *mobile_identity, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_mobile_station_classmark_2(nas_mobile_station_classmark_2_t *mobile_station_classmark_2, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_mobile_station_classmark_3(nas_mobile_station_classmark_3_t *mobile_station_classmark_3, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_plmn_list(nas_plmn_list_t *plmn_list, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_additional_update_result(nas_additional_update_result_t *additional_update_result, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_additional_update_type(nas_additional_update_type_t *additional_update_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_authentication_failure_parameter(nas_authentication_failure_parameter_t *authentication_failure_parameter, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_attach_result(nas_eps_attach_result_t *eps_attach_result, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_attach_type(nas_eps_attach_type_t *eps_attach_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_mobile_identity(nas_eps_mobile_identity_t *eps_mobile_identity, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_network_feature_support(nas_eps_network_feature_support_t *eps_network_feature_support, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_update_result(nas_eps_update_result_t *eps_update_result, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_update_type(nas_eps_update_type_t *eps_update_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_esm_message_container(nas_esm_message_container_t *esm_message_container, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_gprs_timer(nas_gprs_timer_t *gprs_timer, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_gprs_timer_2(nas_gprs_timer_2_t *gprs_timer_2, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_gprs_timer_3(nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_identity_type_2(nas_identity_type_2_t *identity_type_2, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_imeisv_request(nas_imeisv_request_t *imeisv_request, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ksi_and_sequence_number(nas_ksi_and_sequence_number_t *ksi_and_sequence_number, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_authentication_parameter_autn(nas_authentication_parameter_autn_t *authentication_parameter_autn, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ms_network_capability(nas_ms_network_capability_t *ms_network_capability, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ms_network_feature_support(nas_ms_network_feature_support_t *ms_network_feature_support, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_key_set_identifier(nas_key_set_identifier_t *key_set_identifier, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_message_container(nas_message_container_t *message_container, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_security_algorithms(nas_security_algorithms_t *security_algorithms, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_network_name(nas_network_name_t *network_name, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_network_resource_identifier_container(nas_network_resource_identifier_container_t *network_resource_identifier_container, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_nonce(nas_nonce_t *nonce, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_paging_identity(nas_paging_identity_t *paging_identity, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_p_tmsi_signature(nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_extended_emm_cause(nas_extended_emm_cause_t *extended_emm_cause, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_service_type(nas_service_type_t *service_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_short_mac(nas_short_mac_t *short_mac, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_time_zone(nas_time_zone_t *time_zone, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_authentication_parameter_rand(nas_authentication_parameter_rand_t *authentication_parameter_rand, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_time_zone_and_time(nas_time_zone_and_time_t *time_zone_and_time, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_tmsi_status(nas_tmsi_status_t *tmsi_status, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_tracking_area_identity(nas_tracking_area_identity_t *tracking_area_identity, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_tracking_area_identity_list(nas_tracking_area_identity_list_t *tracking_area_identity_list, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ue_network_capability(nas_ue_network_capability_t *ue_network_capability, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ue_radio_capability_information_update_needed(nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ue_security_capability(nas_ue_security_capability_t *ue_security_capability, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_emergency_number_list(nas_emergency_number_list_t *emergency_number_list, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_cli(nas_cli_t *cli, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ss_code(nas_ss_code_t *ss_code, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_authentication_response_parameter(nas_authentication_response_parameter_t *authentication_response_parameter, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_lcs_indicator(nas_lcs_indicator_t *lcs_indicator, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_lcs_client_identity(nas_lcs_client_identity_t *lcs_client_identity, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_generic_message_container_type(nas_generic_message_container_type_t *generic_message_container_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_generic_message_container(nas_generic_message_container_t *generic_message_container, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_voice_domain_preference_and_ue_usage_setting(nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_extended_drx_parameters(nas_extended_drx_parameters_t *extended_drx_parameters, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_ciphering_key_sequence_number(nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_csfb_response(nas_csfb_response_t *csfb_response, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_daylight_saving_time(nas_daylight_saving_time_t *daylight_saving_time, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_detach_type(nas_detach_type_t *detach_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_drx_parameter(nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_emm_cause(nas_emm_cause_t *emm_cause, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_access_point_name(nas_access_point_name_t *access_point_name, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_protocol_configuration_options(nas_protocol_configuration_options_t *protocol_configuration_options, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_quality_of_service(nas_quality_of_service_t *quality_of_service, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_radio_priority(nas_radio_priority_t *radio_priority, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_re_attempt_indicator(nas_re_attempt_indicator_t *re_attempt_indicator, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_request_type(nas_request_type_t *request_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_traffic_flow_aggregate_description(nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_traffic_flow_template(nas_traffic_flow_template_t *traffic_flow_template, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_transaction_identifier(nas_transaction_identifier_t *transaction_identifier, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_wlan_offload_acceptability(nas_wlan_offload_acceptability_t *wlan_offload_acceptability, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_nbifom_container(nas_nbifom_container_t *nbifom_container, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_apn_aggregate_maximum_bit_rate(nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_header_compression_configuration(nas_header_compression_configuration_t *header_compression_configuration, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_control_plane_only_indication(nas_control_plane_only_indication_t *control_plane_only_indication, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_extended_protocol_configuration_options(nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_header_compression_configuration_status(nas_header_compression_configuration_status_t *header_compression_configuration_status, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_serving_plmn_rate_control(nas_serving_plmn_rate_control_t *serving_plmn_rate_control, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_connectivity_type(nas_connectivity_type_t *connectivity_type, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_eps_quality_of_service(nas_eps_quality_of_service_t *eps_quality_of_service, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_esm_cause(nas_esm_cause_t *esm_cause, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_esm_information_transfer_flag(nas_esm_information_transfer_flag_t *esm_information_transfer_flag, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_linked_eps_bearer_identity(nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_llc_service_access_point_identifier(nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_packet_flow_identifier(nas_packet_flow_identifier_t *packet_flow_identifier, pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_decode_pdn_address(nas_pdn_address_t *pdn_address, pkbuf_t *pkbuf); +int nas_decode_additional_information(nas_additional_information_t *additional_information, ogs_pkbuf_t *pkbuf); +int nas_decode_device_properties(nas_device_properties_t *device_properties, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_bearer_context_status(nas_eps_bearer_context_status_t *eps_bearer_context_status, ogs_pkbuf_t *pkbuf); +int nas_decode_supported_codec_list(nas_supported_codec_list_t *supported_codec_list, ogs_pkbuf_t *pkbuf); +int nas_decode_location_area_identification(nas_location_area_identification_t *location_area_identification, ogs_pkbuf_t *pkbuf); +int nas_decode_mobile_identity(nas_mobile_identity_t *mobile_identity, ogs_pkbuf_t *pkbuf); +int nas_decode_mobile_station_classmark_2(nas_mobile_station_classmark_2_t *mobile_station_classmark_2, ogs_pkbuf_t *pkbuf); +int nas_decode_mobile_station_classmark_3(nas_mobile_station_classmark_3_t *mobile_station_classmark_3, ogs_pkbuf_t *pkbuf); +int nas_decode_plmn_list(nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pkbuf); +int nas_decode_additional_update_result(nas_additional_update_result_t *additional_update_result, ogs_pkbuf_t *pkbuf); +int nas_decode_additional_update_type(nas_additional_update_type_t *additional_update_type, ogs_pkbuf_t *pkbuf); +int nas_decode_authentication_failure_parameter(nas_authentication_failure_parameter_t *authentication_failure_parameter, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_attach_result(nas_eps_attach_result_t *eps_attach_result, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_attach_type(nas_eps_attach_type_t *eps_attach_type, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_mobile_identity(nas_eps_mobile_identity_t *eps_mobile_identity, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_network_feature_support(nas_eps_network_feature_support_t *eps_network_feature_support, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_update_result(nas_eps_update_result_t *eps_update_result, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_update_type(nas_eps_update_type_t *eps_update_type, ogs_pkbuf_t *pkbuf); +int nas_decode_esm_message_container(nas_esm_message_container_t *esm_message_container, ogs_pkbuf_t *pkbuf); +int nas_decode_gprs_timer(nas_gprs_timer_t *gprs_timer, ogs_pkbuf_t *pkbuf); +int nas_decode_gprs_timer_2(nas_gprs_timer_2_t *gprs_timer_2, ogs_pkbuf_t *pkbuf); +int nas_decode_gprs_timer_3(nas_gprs_timer_3_t *gprs_timer_3, ogs_pkbuf_t *pkbuf); +int nas_decode_identity_type_2(nas_identity_type_2_t *identity_type_2, ogs_pkbuf_t *pkbuf); +int nas_decode_imeisv_request(nas_imeisv_request_t *imeisv_request, ogs_pkbuf_t *pkbuf); +int nas_decode_ksi_and_sequence_number(nas_ksi_and_sequence_number_t *ksi_and_sequence_number, ogs_pkbuf_t *pkbuf); +int nas_decode_authentication_parameter_autn(nas_authentication_parameter_autn_t *authentication_parameter_autn, ogs_pkbuf_t *pkbuf); +int nas_decode_ms_network_capability(nas_ms_network_capability_t *ms_network_capability, ogs_pkbuf_t *pkbuf); +int nas_decode_ms_network_feature_support(nas_ms_network_feature_support_t *ms_network_feature_support, ogs_pkbuf_t *pkbuf); +int nas_decode_key_set_identifier(nas_key_set_identifier_t *key_set_identifier, ogs_pkbuf_t *pkbuf); +int nas_decode_message_container(nas_message_container_t *message_container, ogs_pkbuf_t *pkbuf); +int nas_decode_security_algorithms(nas_security_algorithms_t *security_algorithms, ogs_pkbuf_t *pkbuf); +int nas_decode_network_name(nas_network_name_t *network_name, ogs_pkbuf_t *pkbuf); +int nas_decode_network_resource_identifier_container(nas_network_resource_identifier_container_t *network_resource_identifier_container, ogs_pkbuf_t *pkbuf); +int nas_decode_nonce(nas_nonce_t *nonce, ogs_pkbuf_t *pkbuf); +int nas_decode_paging_identity(nas_paging_identity_t *paging_identity, ogs_pkbuf_t *pkbuf); +int nas_decode_p_tmsi_signature(nas_p_tmsi_signature_t *p_tmsi_signature, ogs_pkbuf_t *pkbuf); +int nas_decode_extended_emm_cause(nas_extended_emm_cause_t *extended_emm_cause, ogs_pkbuf_t *pkbuf); +int nas_decode_service_type(nas_service_type_t *service_type, ogs_pkbuf_t *pkbuf); +int nas_decode_short_mac(nas_short_mac_t *short_mac, ogs_pkbuf_t *pkbuf); +int nas_decode_time_zone(nas_time_zone_t *time_zone, ogs_pkbuf_t *pkbuf); +int nas_decode_authentication_parameter_rand(nas_authentication_parameter_rand_t *authentication_parameter_rand, ogs_pkbuf_t *pkbuf); +int nas_decode_time_zone_and_time(nas_time_zone_and_time_t *time_zone_and_time, ogs_pkbuf_t *pkbuf); +int nas_decode_tmsi_status(nas_tmsi_status_t *tmsi_status, ogs_pkbuf_t *pkbuf); +int nas_decode_tracking_area_identity(nas_tracking_area_identity_t *tracking_area_identity, ogs_pkbuf_t *pkbuf); +int nas_decode_tracking_area_identity_list(nas_tracking_area_identity_list_t *tracking_area_identity_list, ogs_pkbuf_t *pkbuf); +int nas_decode_ue_network_capability(nas_ue_network_capability_t *ue_network_capability, ogs_pkbuf_t *pkbuf); +int nas_decode_ue_radio_capability_information_update_needed(nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed, ogs_pkbuf_t *pkbuf); +int nas_decode_ue_security_capability(nas_ue_security_capability_t *ue_security_capability, ogs_pkbuf_t *pkbuf); +int nas_decode_emergency_number_list(nas_emergency_number_list_t *emergency_number_list, ogs_pkbuf_t *pkbuf); +int nas_decode_cli(nas_cli_t *cli, ogs_pkbuf_t *pkbuf); +int nas_decode_ss_code(nas_ss_code_t *ss_code, ogs_pkbuf_t *pkbuf); +int nas_decode_authentication_response_parameter(nas_authentication_response_parameter_t *authentication_response_parameter, ogs_pkbuf_t *pkbuf); +int nas_decode_lcs_indicator(nas_lcs_indicator_t *lcs_indicator, ogs_pkbuf_t *pkbuf); +int nas_decode_lcs_client_identity(nas_lcs_client_identity_t *lcs_client_identity, ogs_pkbuf_t *pkbuf); +int nas_decode_generic_message_container_type(nas_generic_message_container_type_t *generic_message_container_type, ogs_pkbuf_t *pkbuf); +int nas_decode_generic_message_container(nas_generic_message_container_t *generic_message_container, ogs_pkbuf_t *pkbuf); +int nas_decode_voice_domain_preference_and_ue_usage_setting(nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting, ogs_pkbuf_t *pkbuf); +int nas_decode_guti_type(nas_guti_type_t *guti_type, ogs_pkbuf_t *pkbuf); +int nas_decode_extended_drx_parameters(nas_extended_drx_parameters_t *extended_drx_parameters, ogs_pkbuf_t *pkbuf); +int nas_decode_ciphering_key_sequence_number(nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number, ogs_pkbuf_t *pkbuf); +int nas_decode_csfb_response(nas_csfb_response_t *csfb_response, ogs_pkbuf_t *pkbuf); +int nas_decode_daylight_saving_time(nas_daylight_saving_time_t *daylight_saving_time, ogs_pkbuf_t *pkbuf); +int nas_decode_detach_type(nas_detach_type_t *detach_type, ogs_pkbuf_t *pkbuf); +int nas_decode_drx_parameter(nas_drx_parameter_t *drx_parameter, ogs_pkbuf_t *pkbuf); +int nas_decode_emm_cause(nas_emm_cause_t *emm_cause, ogs_pkbuf_t *pkbuf); +int nas_decode_access_point_name(nas_access_point_name_t *access_point_name, ogs_pkbuf_t *pkbuf); +int nas_decode_protocol_configuration_options(nas_protocol_configuration_options_t *protocol_configuration_options, ogs_pkbuf_t *pkbuf); +int nas_decode_quality_of_service(nas_quality_of_service_t *quality_of_service, ogs_pkbuf_t *pkbuf); +int nas_decode_radio_priority(nas_radio_priority_t *radio_priority, ogs_pkbuf_t *pkbuf); +int nas_decode_re_attempt_indicator(nas_re_attempt_indicator_t *re_attempt_indicator, ogs_pkbuf_t *pkbuf); +int nas_decode_request_type(nas_request_type_t *request_type, ogs_pkbuf_t *pkbuf); +int nas_decode_traffic_flow_aggregate_description(nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description, ogs_pkbuf_t *pkbuf); +int nas_decode_traffic_flow_template(nas_traffic_flow_template_t *traffic_flow_template, ogs_pkbuf_t *pkbuf); +int nas_decode_transaction_identifier(nas_transaction_identifier_t *transaction_identifier, ogs_pkbuf_t *pkbuf); +int nas_decode_wlan_offload_acceptability(nas_wlan_offload_acceptability_t *wlan_offload_acceptability, ogs_pkbuf_t *pkbuf); +int nas_decode_nbifom_container(nas_nbifom_container_t *nbifom_container, ogs_pkbuf_t *pkbuf); +int nas_decode_apn_aggregate_maximum_bit_rate(nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate, ogs_pkbuf_t *pkbuf); +int nas_decode_header_compression_configuration(nas_header_compression_configuration_t *header_compression_configuration, ogs_pkbuf_t *pkbuf); +int nas_decode_control_plane_only_indication(nas_control_plane_only_indication_t *control_plane_only_indication, ogs_pkbuf_t *pkbuf); +int nas_decode_extended_protocol_configuration_options(nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, ogs_pkbuf_t *pkbuf); +int nas_decode_header_compression_configuration_status(nas_header_compression_configuration_status_t *header_compression_configuration_status, ogs_pkbuf_t *pkbuf); +int nas_decode_serving_plmn_rate_control(nas_serving_plmn_rate_control_t *serving_plmn_rate_control, ogs_pkbuf_t *pkbuf); +int nas_decode_connectivity_type(nas_connectivity_type_t *connectivity_type, ogs_pkbuf_t *pkbuf); +int nas_decode_eps_quality_of_service(nas_eps_quality_of_service_t *eps_quality_of_service, ogs_pkbuf_t *pkbuf); +int nas_decode_esm_cause(nas_esm_cause_t *esm_cause, ogs_pkbuf_t *pkbuf); +int nas_decode_esm_information_transfer_flag(nas_esm_information_transfer_flag_t *esm_information_transfer_flag, ogs_pkbuf_t *pkbuf); +int nas_decode_linked_eps_bearer_identity(nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity, ogs_pkbuf_t *pkbuf); +int nas_decode_llc_service_access_point_identifier(nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier, ogs_pkbuf_t *pkbuf); +int nas_decode_packet_flow_identifier(nas_packet_flow_identifier_t *packet_flow_identifier, ogs_pkbuf_t *pkbuf); +int nas_decode_pdn_address(nas_pdn_address_t *pdn_address, ogs_pkbuf_t *pkbuf); -CORE_DECLARE(c_int16_t) nas_encode_additional_information(pkbuf_t *pkbuf, nas_additional_information_t *additional_information); -CORE_DECLARE(c_int16_t) nas_encode_device_properties(pkbuf_t *pkbuf, nas_device_properties_t *device_properties); -CORE_DECLARE(c_int16_t) nas_encode_eps_bearer_context_status(pkbuf_t *pkbuf, nas_eps_bearer_context_status_t *eps_bearer_context_status); -CORE_DECLARE(c_int16_t) nas_encode_supported_codec_list(pkbuf_t *pkbuf, nas_supported_codec_list_t *supported_codec_list); -CORE_DECLARE(c_int16_t) nas_encode_location_area_identification(pkbuf_t *pkbuf, nas_location_area_identification_t *location_area_identification); -CORE_DECLARE(c_int16_t) nas_encode_mobile_identity(pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity); -CORE_DECLARE(c_int16_t) nas_encode_mobile_station_classmark_2(pkbuf_t *pkbuf, nas_mobile_station_classmark_2_t *mobile_station_classmark_2); -CORE_DECLARE(c_int16_t) nas_encode_mobile_station_classmark_3(pkbuf_t *pkbuf, nas_mobile_station_classmark_3_t *mobile_station_classmark_3); -CORE_DECLARE(c_int16_t) nas_encode_plmn_list(pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list); -CORE_DECLARE(c_int16_t) nas_encode_additional_update_result(pkbuf_t *pkbuf, nas_additional_update_result_t *additional_update_result); -CORE_DECLARE(c_int16_t) nas_encode_additional_update_type(pkbuf_t *pkbuf, nas_additional_update_type_t *additional_update_type); -CORE_DECLARE(c_int16_t) nas_encode_authentication_failure_parameter(pkbuf_t *pkbuf, nas_authentication_failure_parameter_t *authentication_failure_parameter); -CORE_DECLARE(c_int16_t) nas_encode_eps_attach_result(pkbuf_t *pkbuf, nas_eps_attach_result_t *eps_attach_result); -CORE_DECLARE(c_int16_t) nas_encode_eps_attach_type(pkbuf_t *pkbuf, nas_eps_attach_type_t *eps_attach_type); -CORE_DECLARE(c_int16_t) nas_encode_eps_mobile_identity(pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity); -CORE_DECLARE(c_int16_t) nas_encode_eps_network_feature_support(pkbuf_t *pkbuf, nas_eps_network_feature_support_t *eps_network_feature_support); -CORE_DECLARE(c_int16_t) nas_encode_eps_update_result(pkbuf_t *pkbuf, nas_eps_update_result_t *eps_update_result); -CORE_DECLARE(c_int16_t) nas_encode_eps_update_type(pkbuf_t *pkbuf, nas_eps_update_type_t *eps_update_type); -CORE_DECLARE(c_int16_t) nas_encode_esm_message_container(pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container); -CORE_DECLARE(c_int16_t) nas_encode_gprs_timer(pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer); -CORE_DECLARE(c_int16_t) nas_encode_gprs_timer_2(pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2); -CORE_DECLARE(c_int16_t) nas_encode_gprs_timer_3(pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3); -CORE_DECLARE(c_int16_t) nas_encode_identity_type_2(pkbuf_t *pkbuf, nas_identity_type_2_t *identity_type_2); -CORE_DECLARE(c_int16_t) nas_encode_imeisv_request(pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request); -CORE_DECLARE(c_int16_t) nas_encode_ksi_and_sequence_number(pkbuf_t *pkbuf, nas_ksi_and_sequence_number_t *ksi_and_sequence_number); -CORE_DECLARE(c_int16_t) nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf, nas_authentication_parameter_autn_t *authentication_parameter_autn); -CORE_DECLARE(c_int16_t) nas_encode_ms_network_capability(pkbuf_t *pkbuf, nas_ms_network_capability_t *ms_network_capability); -CORE_DECLARE(c_int16_t) nas_encode_ms_network_feature_support(pkbuf_t *pkbuf, nas_ms_network_feature_support_t *ms_network_feature_support); -CORE_DECLARE(c_int16_t) nas_encode_key_set_identifier(pkbuf_t *pkbuf, nas_key_set_identifier_t *key_set_identifier); -CORE_DECLARE(c_int16_t) nas_encode_message_container(pkbuf_t *pkbuf, nas_message_container_t *message_container); -CORE_DECLARE(c_int16_t) nas_encode_security_algorithms(pkbuf_t *pkbuf, nas_security_algorithms_t *security_algorithms); -CORE_DECLARE(c_int16_t) nas_encode_network_name(pkbuf_t *pkbuf, nas_network_name_t *network_name); -CORE_DECLARE(c_int16_t) nas_encode_network_resource_identifier_container(pkbuf_t *pkbuf, nas_network_resource_identifier_container_t *network_resource_identifier_container); -CORE_DECLARE(c_int16_t) nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce); -CORE_DECLARE(c_int16_t) nas_encode_paging_identity(pkbuf_t *pkbuf, nas_paging_identity_t *paging_identity); -CORE_DECLARE(c_int16_t) nas_encode_p_tmsi_signature(pkbuf_t *pkbuf, nas_p_tmsi_signature_t *p_tmsi_signature); -CORE_DECLARE(c_int16_t) nas_encode_extended_emm_cause(pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause); -CORE_DECLARE(c_int16_t) nas_encode_service_type(pkbuf_t *pkbuf, nas_service_type_t *service_type); -CORE_DECLARE(c_int16_t) nas_encode_short_mac(pkbuf_t *pkbuf, nas_short_mac_t *short_mac); -CORE_DECLARE(c_int16_t) nas_encode_time_zone(pkbuf_t *pkbuf, nas_time_zone_t *time_zone); -CORE_DECLARE(c_int16_t) nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf, nas_authentication_parameter_rand_t *authentication_parameter_rand); -CORE_DECLARE(c_int16_t) nas_encode_time_zone_and_time(pkbuf_t *pkbuf, nas_time_zone_and_time_t *time_zone_and_time); -CORE_DECLARE(c_int16_t) nas_encode_tmsi_status(pkbuf_t *pkbuf, nas_tmsi_status_t *tmsi_status); -CORE_DECLARE(c_int16_t) nas_encode_tracking_area_identity(pkbuf_t *pkbuf, nas_tracking_area_identity_t *tracking_area_identity); -CORE_DECLARE(c_int16_t) nas_encode_tracking_area_identity_list(pkbuf_t *pkbuf, nas_tracking_area_identity_list_t *tracking_area_identity_list); -CORE_DECLARE(c_int16_t) nas_encode_ue_network_capability(pkbuf_t *pkbuf, nas_ue_network_capability_t *ue_network_capability); -CORE_DECLARE(c_int16_t) nas_encode_ue_radio_capability_information_update_needed(pkbuf_t *pkbuf, nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed); -CORE_DECLARE(c_int16_t) nas_encode_ue_security_capability(pkbuf_t *pkbuf, nas_ue_security_capability_t *ue_security_capability); -CORE_DECLARE(c_int16_t) nas_encode_emergency_number_list(pkbuf_t *pkbuf, nas_emergency_number_list_t *emergency_number_list); -CORE_DECLARE(c_int16_t) nas_encode_cli(pkbuf_t *pkbuf, nas_cli_t *cli); -CORE_DECLARE(c_int16_t) nas_encode_ss_code(pkbuf_t *pkbuf, nas_ss_code_t *ss_code); -CORE_DECLARE(c_int16_t) nas_encode_authentication_response_parameter(pkbuf_t *pkbuf, nas_authentication_response_parameter_t *authentication_response_parameter); -CORE_DECLARE(c_int16_t) nas_encode_lcs_indicator(pkbuf_t *pkbuf, nas_lcs_indicator_t *lcs_indicator); -CORE_DECLARE(c_int16_t) nas_encode_lcs_client_identity(pkbuf_t *pkbuf, nas_lcs_client_identity_t *lcs_client_identity); -CORE_DECLARE(c_int16_t) nas_encode_generic_message_container_type(pkbuf_t *pkbuf, nas_generic_message_container_type_t *generic_message_container_type); -CORE_DECLARE(c_int16_t) nas_encode_generic_message_container(pkbuf_t *pkbuf, nas_generic_message_container_t *generic_message_container); -CORE_DECLARE(c_int16_t) nas_encode_voice_domain_preference_and_ue_usage_setting(pkbuf_t *pkbuf, nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting); -CORE_DECLARE(c_int16_t) nas_encode_guti_type(pkbuf_t *pkbuf, nas_guti_type_t *guti_type); -CORE_DECLARE(c_int16_t) nas_encode_extended_drx_parameters(pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters); -CORE_DECLARE(c_int16_t) nas_encode_ciphering_key_sequence_number(pkbuf_t *pkbuf, nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number); -CORE_DECLARE(c_int16_t) nas_encode_csfb_response(pkbuf_t *pkbuf, nas_csfb_response_t *csfb_response); -CORE_DECLARE(c_int16_t) nas_encode_daylight_saving_time(pkbuf_t *pkbuf, nas_daylight_saving_time_t *daylight_saving_time); -CORE_DECLARE(c_int16_t) nas_encode_detach_type(pkbuf_t *pkbuf, nas_detach_type_t *detach_type); -CORE_DECLARE(c_int16_t) nas_encode_drx_parameter(pkbuf_t *pkbuf, nas_drx_parameter_t *drx_parameter); -CORE_DECLARE(c_int16_t) nas_encode_emm_cause(pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause); -CORE_DECLARE(c_int16_t) nas_encode_access_point_name(pkbuf_t *pkbuf, nas_access_point_name_t *access_point_name); -CORE_DECLARE(c_int16_t) nas_encode_protocol_configuration_options(pkbuf_t *pkbuf, nas_protocol_configuration_options_t *protocol_configuration_options); -CORE_DECLARE(c_int16_t) nas_encode_quality_of_service(pkbuf_t *pkbuf, nas_quality_of_service_t *quality_of_service); -CORE_DECLARE(c_int16_t) nas_encode_radio_priority(pkbuf_t *pkbuf, nas_radio_priority_t *radio_priority); -CORE_DECLARE(c_int16_t) nas_encode_re_attempt_indicator(pkbuf_t *pkbuf, nas_re_attempt_indicator_t *re_attempt_indicator); -CORE_DECLARE(c_int16_t) nas_encode_request_type(pkbuf_t *pkbuf, nas_request_type_t *request_type); -CORE_DECLARE(c_int16_t) nas_encode_traffic_flow_aggregate_description(pkbuf_t *pkbuf, nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description); -CORE_DECLARE(c_int16_t) nas_encode_traffic_flow_template(pkbuf_t *pkbuf, nas_traffic_flow_template_t *traffic_flow_template); -CORE_DECLARE(c_int16_t) nas_encode_transaction_identifier(pkbuf_t *pkbuf, nas_transaction_identifier_t *transaction_identifier); -CORE_DECLARE(c_int16_t) nas_encode_wlan_offload_acceptability(pkbuf_t *pkbuf, nas_wlan_offload_acceptability_t *wlan_offload_acceptability); -CORE_DECLARE(c_int16_t) nas_encode_nbifom_container(pkbuf_t *pkbuf, nas_nbifom_container_t *nbifom_container); -CORE_DECLARE(c_int16_t) nas_encode_apn_aggregate_maximum_bit_rate(pkbuf_t *pkbuf, nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate); -CORE_DECLARE(c_int16_t) nas_encode_header_compression_configuration(pkbuf_t *pkbuf, nas_header_compression_configuration_t *header_compression_configuration); -CORE_DECLARE(c_int16_t) nas_encode_control_plane_only_indication(pkbuf_t *pkbuf, nas_control_plane_only_indication_t *control_plane_only_indication); -CORE_DECLARE(c_int16_t) nas_encode_extended_protocol_configuration_options(pkbuf_t *pkbuf, nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options); -CORE_DECLARE(c_int16_t) nas_encode_header_compression_configuration_status(pkbuf_t *pkbuf, nas_header_compression_configuration_status_t *header_compression_configuration_status); -CORE_DECLARE(c_int16_t) nas_encode_serving_plmn_rate_control(pkbuf_t *pkbuf, nas_serving_plmn_rate_control_t *serving_plmn_rate_control); -CORE_DECLARE(c_int16_t) nas_encode_connectivity_type(pkbuf_t *pkbuf, nas_connectivity_type_t *connectivity_type); -CORE_DECLARE(c_int16_t) nas_encode_eps_quality_of_service(pkbuf_t *pkbuf, nas_eps_quality_of_service_t *eps_quality_of_service); -CORE_DECLARE(c_int16_t) nas_encode_esm_cause(pkbuf_t *pkbuf, nas_esm_cause_t *esm_cause); -CORE_DECLARE(c_int16_t) nas_encode_esm_information_transfer_flag(pkbuf_t *pkbuf, nas_esm_information_transfer_flag_t *esm_information_transfer_flag); -CORE_DECLARE(c_int16_t) nas_encode_linked_eps_bearer_identity(pkbuf_t *pkbuf, nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity); -CORE_DECLARE(c_int16_t) nas_encode_llc_service_access_point_identifier(pkbuf_t *pkbuf, nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier); -CORE_DECLARE(c_int16_t) nas_encode_packet_flow_identifier(pkbuf_t *pkbuf, nas_packet_flow_identifier_t *packet_flow_identifier); -CORE_DECLARE(c_int16_t) nas_encode_pdn_address(pkbuf_t *pkbuf, nas_pdn_address_t *pdn_address); +int nas_encode_additional_information(ogs_pkbuf_t *pkbuf, nas_additional_information_t *additional_information); +int nas_encode_device_properties(ogs_pkbuf_t *pkbuf, nas_device_properties_t *device_properties); +int nas_encode_eps_bearer_context_status(ogs_pkbuf_t *pkbuf, nas_eps_bearer_context_status_t *eps_bearer_context_status); +int nas_encode_supported_codec_list(ogs_pkbuf_t *pkbuf, nas_supported_codec_list_t *supported_codec_list); +int nas_encode_location_area_identification(ogs_pkbuf_t *pkbuf, nas_location_area_identification_t *location_area_identification); +int nas_encode_mobile_identity(ogs_pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity); +int nas_encode_mobile_station_classmark_2(ogs_pkbuf_t *pkbuf, nas_mobile_station_classmark_2_t *mobile_station_classmark_2); +int nas_encode_mobile_station_classmark_3(ogs_pkbuf_t *pkbuf, nas_mobile_station_classmark_3_t *mobile_station_classmark_3); +int nas_encode_plmn_list(ogs_pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list); +int nas_encode_additional_update_result(ogs_pkbuf_t *pkbuf, nas_additional_update_result_t *additional_update_result); +int nas_encode_additional_update_type(ogs_pkbuf_t *pkbuf, nas_additional_update_type_t *additional_update_type); +int nas_encode_authentication_failure_parameter(ogs_pkbuf_t *pkbuf, nas_authentication_failure_parameter_t *authentication_failure_parameter); +int nas_encode_eps_attach_result(ogs_pkbuf_t *pkbuf, nas_eps_attach_result_t *eps_attach_result); +int nas_encode_eps_attach_type(ogs_pkbuf_t *pkbuf, nas_eps_attach_type_t *eps_attach_type); +int nas_encode_eps_mobile_identity(ogs_pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity); +int nas_encode_eps_network_feature_support(ogs_pkbuf_t *pkbuf, nas_eps_network_feature_support_t *eps_network_feature_support); +int nas_encode_eps_update_result(ogs_pkbuf_t *pkbuf, nas_eps_update_result_t *eps_update_result); +int nas_encode_eps_update_type(ogs_pkbuf_t *pkbuf, nas_eps_update_type_t *eps_update_type); +int nas_encode_esm_message_container(ogs_pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container); +int nas_encode_gprs_timer(ogs_pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer); +int nas_encode_gprs_timer_2(ogs_pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2); +int nas_encode_gprs_timer_3(ogs_pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3); +int nas_encode_identity_type_2(ogs_pkbuf_t *pkbuf, nas_identity_type_2_t *identity_type_2); +int nas_encode_imeisv_request(ogs_pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request); +int nas_encode_ksi_and_sequence_number(ogs_pkbuf_t *pkbuf, nas_ksi_and_sequence_number_t *ksi_and_sequence_number); +int nas_encode_authentication_parameter_autn(ogs_pkbuf_t *pkbuf, nas_authentication_parameter_autn_t *authentication_parameter_autn); +int nas_encode_ms_network_capability(ogs_pkbuf_t *pkbuf, nas_ms_network_capability_t *ms_network_capability); +int nas_encode_ms_network_feature_support(ogs_pkbuf_t *pkbuf, nas_ms_network_feature_support_t *ms_network_feature_support); +int nas_encode_key_set_identifier(ogs_pkbuf_t *pkbuf, nas_key_set_identifier_t *key_set_identifier); +int nas_encode_message_container(ogs_pkbuf_t *pkbuf, nas_message_container_t *message_container); +int nas_encode_security_algorithms(ogs_pkbuf_t *pkbuf, nas_security_algorithms_t *security_algorithms); +int nas_encode_network_name(ogs_pkbuf_t *pkbuf, nas_network_name_t *network_name); +int nas_encode_network_resource_identifier_container(ogs_pkbuf_t *pkbuf, nas_network_resource_identifier_container_t *network_resource_identifier_container); +int nas_encode_nonce(ogs_pkbuf_t *pkbuf, nas_nonce_t *nonce); +int nas_encode_paging_identity(ogs_pkbuf_t *pkbuf, nas_paging_identity_t *paging_identity); +int nas_encode_p_tmsi_signature(ogs_pkbuf_t *pkbuf, nas_p_tmsi_signature_t *p_tmsi_signature); +int nas_encode_extended_emm_cause(ogs_pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause); +int nas_encode_service_type(ogs_pkbuf_t *pkbuf, nas_service_type_t *service_type); +int nas_encode_short_mac(ogs_pkbuf_t *pkbuf, nas_short_mac_t *short_mac); +int nas_encode_time_zone(ogs_pkbuf_t *pkbuf, nas_time_zone_t *time_zone); +int nas_encode_authentication_parameter_rand(ogs_pkbuf_t *pkbuf, nas_authentication_parameter_rand_t *authentication_parameter_rand); +int nas_encode_time_zone_and_time(ogs_pkbuf_t *pkbuf, nas_time_zone_and_time_t *time_zone_and_time); +int nas_encode_tmsi_status(ogs_pkbuf_t *pkbuf, nas_tmsi_status_t *tmsi_status); +int nas_encode_tracking_area_identity(ogs_pkbuf_t *pkbuf, nas_tracking_area_identity_t *tracking_area_identity); +int nas_encode_tracking_area_identity_list(ogs_pkbuf_t *pkbuf, nas_tracking_area_identity_list_t *tracking_area_identity_list); +int nas_encode_ue_network_capability(ogs_pkbuf_t *pkbuf, nas_ue_network_capability_t *ue_network_capability); +int nas_encode_ue_radio_capability_information_update_needed(ogs_pkbuf_t *pkbuf, nas_ue_radio_capability_information_update_needed_t *ue_radio_capability_information_update_needed); +int nas_encode_ue_security_capability(ogs_pkbuf_t *pkbuf, nas_ue_security_capability_t *ue_security_capability); +int nas_encode_emergency_number_list(ogs_pkbuf_t *pkbuf, nas_emergency_number_list_t *emergency_number_list); +int nas_encode_cli(ogs_pkbuf_t *pkbuf, nas_cli_t *cli); +int nas_encode_ss_code(ogs_pkbuf_t *pkbuf, nas_ss_code_t *ss_code); +int nas_encode_authentication_response_parameter(ogs_pkbuf_t *pkbuf, nas_authentication_response_parameter_t *authentication_response_parameter); +int nas_encode_lcs_indicator(ogs_pkbuf_t *pkbuf, nas_lcs_indicator_t *lcs_indicator); +int nas_encode_lcs_client_identity(ogs_pkbuf_t *pkbuf, nas_lcs_client_identity_t *lcs_client_identity); +int nas_encode_generic_message_container_type(ogs_pkbuf_t *pkbuf, nas_generic_message_container_type_t *generic_message_container_type); +int nas_encode_generic_message_container(ogs_pkbuf_t *pkbuf, nas_generic_message_container_t *generic_message_container); +int nas_encode_voice_domain_preference_and_ue_usage_setting(ogs_pkbuf_t *pkbuf, nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting); +int nas_encode_guti_type(ogs_pkbuf_t *pkbuf, nas_guti_type_t *guti_type); +int nas_encode_extended_drx_parameters(ogs_pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters); +int nas_encode_ciphering_key_sequence_number(ogs_pkbuf_t *pkbuf, nas_ciphering_key_sequence_number_t *ciphering_key_sequence_number); +int nas_encode_csfb_response(ogs_pkbuf_t *pkbuf, nas_csfb_response_t *csfb_response); +int nas_encode_daylight_saving_time(ogs_pkbuf_t *pkbuf, nas_daylight_saving_time_t *daylight_saving_time); +int nas_encode_detach_type(ogs_pkbuf_t *pkbuf, nas_detach_type_t *detach_type); +int nas_encode_drx_parameter(ogs_pkbuf_t *pkbuf, nas_drx_parameter_t *drx_parameter); +int nas_encode_emm_cause(ogs_pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause); +int nas_encode_access_point_name(ogs_pkbuf_t *pkbuf, nas_access_point_name_t *access_point_name); +int nas_encode_protocol_configuration_options(ogs_pkbuf_t *pkbuf, nas_protocol_configuration_options_t *protocol_configuration_options); +int nas_encode_quality_of_service(ogs_pkbuf_t *pkbuf, nas_quality_of_service_t *quality_of_service); +int nas_encode_radio_priority(ogs_pkbuf_t *pkbuf, nas_radio_priority_t *radio_priority); +int nas_encode_re_attempt_indicator(ogs_pkbuf_t *pkbuf, nas_re_attempt_indicator_t *re_attempt_indicator); +int nas_encode_request_type(ogs_pkbuf_t *pkbuf, nas_request_type_t *request_type); +int nas_encode_traffic_flow_aggregate_description(ogs_pkbuf_t *pkbuf, nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description); +int nas_encode_traffic_flow_template(ogs_pkbuf_t *pkbuf, nas_traffic_flow_template_t *traffic_flow_template); +int nas_encode_transaction_identifier(ogs_pkbuf_t *pkbuf, nas_transaction_identifier_t *transaction_identifier); +int nas_encode_wlan_offload_acceptability(ogs_pkbuf_t *pkbuf, nas_wlan_offload_acceptability_t *wlan_offload_acceptability); +int nas_encode_nbifom_container(ogs_pkbuf_t *pkbuf, nas_nbifom_container_t *nbifom_container); +int nas_encode_apn_aggregate_maximum_bit_rate(ogs_pkbuf_t *pkbuf, nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate); +int nas_encode_header_compression_configuration(ogs_pkbuf_t *pkbuf, nas_header_compression_configuration_t *header_compression_configuration); +int nas_encode_control_plane_only_indication(ogs_pkbuf_t *pkbuf, nas_control_plane_only_indication_t *control_plane_only_indication); +int nas_encode_extended_protocol_configuration_options(ogs_pkbuf_t *pkbuf, nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options); +int nas_encode_header_compression_configuration_status(ogs_pkbuf_t *pkbuf, nas_header_compression_configuration_status_t *header_compression_configuration_status); +int nas_encode_serving_plmn_rate_control(ogs_pkbuf_t *pkbuf, nas_serving_plmn_rate_control_t *serving_plmn_rate_control); +int nas_encode_connectivity_type(ogs_pkbuf_t *pkbuf, nas_connectivity_type_t *connectivity_type); +int nas_encode_eps_quality_of_service(ogs_pkbuf_t *pkbuf, nas_eps_quality_of_service_t *eps_quality_of_service); +int nas_encode_esm_cause(ogs_pkbuf_t *pkbuf, nas_esm_cause_t *esm_cause); +int nas_encode_esm_information_transfer_flag(ogs_pkbuf_t *pkbuf, nas_esm_information_transfer_flag_t *esm_information_transfer_flag); +int nas_encode_linked_eps_bearer_identity(ogs_pkbuf_t *pkbuf, nas_linked_eps_bearer_identity_t *linked_eps_bearer_identity); +int nas_encode_llc_service_access_point_identifier(ogs_pkbuf_t *pkbuf, nas_llc_service_access_point_identifier_t *llc_service_access_point_identifier); +int nas_encode_packet_flow_identifier(ogs_pkbuf_t *pkbuf, nas_packet_flow_identifier_t *packet_flow_identifier); +int nas_encode_pdn_address(ogs_pkbuf_t *pkbuf, nas_pdn_address_t *pdn_address); #ifdef __cplusplus } diff --git a/lib/nas/nas_message.h b/lib/nas/nas_message.h index 8786715a0..8688e6aef 100644 --- a/lib/nas/nas_message.h +++ b/lib/nas/nas_message.h @@ -1,32 +1,26 @@ /* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ /******************************************************************************* * This file had been created by nas_message.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2019-03-17 01:58:02.754073 by acetcom + * Created on: 2019-03-17 02:01:09.555771 by acetcom * from 24301-d80.docx ******************************************************************************/ @@ -39,7 +33,7 @@ extern "C" { #endif /* __cplusplus */ -/* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. +/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ #define NAS_HEADROOM 16 @@ -58,23 +52,23 @@ extern "C" { #define NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0 typedef struct _nas_emm_header_t { -ED2(c_uint8_t security_header_type:4;, - c_uint8_t protocol_discriminator:4;) - c_uint8_t message_type; +ED2(uint8_t security_header_type:4;, + uint8_t protocol_discriminator:4;) + uint8_t message_type; } __attribute__ ((packed)) nas_emm_header_t; typedef struct _nas_esm_header_t { -ED2(c_uint8_t eps_bearer_identity:4;, - c_uint8_t protocol_discriminator:4;) - c_uint8_t procedure_transaction_identity; - c_uint8_t message_type; +ED2(uint8_t eps_bearer_identity:4;, + uint8_t protocol_discriminator:4;) + uint8_t procedure_transaction_identity; + uint8_t message_type; } __attribute__ ((packed)) nas_esm_header_t; typedef struct _nas_security_header_t { -ED2(c_uint8_t security_header_type:4;, - c_uint8_t protocol_discriminator:4;) - c_uint32_t message_authentication_code; - c_uint8_t sequence_number; +ED2(uint8_t security_header_type:4;, + uint8_t protocol_discriminator:4;) + uint32_t message_authentication_code; + uint8_t sequence_number; } __attribute__ ((packed)) nas_security_header_t; #define NAS_ATTACH_REQUEST 65 @@ -181,7 +175,7 @@ typedef struct _nas_attach_request_t { nas_esm_message_container_t esm_message_container; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_p_tmsi_signature_t old_p_tmsi_signature; nas_eps_mobile_identity_t additional_guti; nas_tracking_area_identity_t last_visited_registered_tai; @@ -242,7 +236,7 @@ typedef struct _nas_attach_accept_t { nas_esm_message_container_t esm_message_container; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_eps_mobile_identity_t guti; nas_location_area_identification_t location_area_identification; nas_mobile_identity_t ms_identity; @@ -286,7 +280,7 @@ typedef struct _nas_attach_reject_t { nas_emm_cause_t emm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_esm_message_container_t esm_message_container; nas_gprs_timer_2_t t3346_value; nas_gprs_timer_2_t t3402_value; @@ -316,7 +310,7 @@ typedef struct _nas_detach_request_to_ue_t { nas_detach_type_t detach_type; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_emm_cause_t emm_cause; } nas_detach_request_to_ue_t; @@ -381,7 +375,7 @@ typedef struct _nas_tracking_area_update_request_t { nas_eps_mobile_identity_t old_guti; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_key_set_identifier_t non_current_native_nas_key_set_identifier; nas_ciphering_key_sequence_number_t gprs_ciphering_key_sequence_number; nas_p_tmsi_signature_t old_p_tmsi_signature; @@ -453,7 +447,7 @@ typedef struct _nas_tracking_area_update_accept_t { nas_eps_update_result_t eps_update_result; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_gprs_timer_t t3412_value; nas_eps_mobile_identity_t guti; nas_tracking_area_identity_list_t tai_list; @@ -487,7 +481,7 @@ typedef struct _nas_tracking_area_update_reject_t { nas_emm_cause_t emm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_gprs_timer_2_t t3346_value; nas_extended_emm_cause_t extended_emm_cause; } nas_tracking_area_update_reject_t; @@ -509,7 +503,7 @@ typedef struct _nas_extended_service_request_t { nas_mobile_identity_t m_tmsi; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_csfb_response_t csfb_response; nas_eps_bearer_context_status_t eps_bearer_context_status; nas_device_properties_t device_properties; @@ -539,7 +533,7 @@ typedef struct _nas_service_reject_t { nas_gprs_timer_t t3442_value; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_gprs_timer_2_t t3346_value; } nas_service_reject_t; @@ -555,7 +549,7 @@ typedef struct _nas_guti_reallocation_command_t { nas_eps_mobile_identity_t guti; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_tracking_area_identity_list_t tai_list; } nas_guti_reallocation_command_t; @@ -613,7 +607,7 @@ typedef struct _nas_authentication_failure_t { nas_emm_cause_t emm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_authentication_failure_parameter_t authentication_failure_parameter; } nas_authentication_failure_t; @@ -635,7 +629,7 @@ typedef struct _nas_security_mode_command_t { nas_ue_security_capability_t replayed_ue_security_capabilities; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_imeisv_request_t imeisv_request; nas_nonce_t replayed_nonceue; nas_nonce_t noncemme; @@ -651,7 +645,7 @@ typedef struct _nas_security_mode_command_t { typedef struct _nas_security_mode_complete_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_mobile_identity_t imeisv; } nas_security_mode_complete_t; @@ -693,7 +687,7 @@ typedef struct _nas_emm_status_t { typedef struct _nas_emm_information_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_network_name_t full_name_for_network; nas_network_name_t short_name_for_network; nas_time_zone_t local_time_zone; @@ -739,7 +733,7 @@ typedef struct _nas_cs_service_notification_t { nas_paging_identity_t paging_identity; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_cli_t cli; nas_ss_code_t ss_code; nas_lcs_indicator_t lcs_indicator; @@ -759,7 +753,7 @@ typedef struct _nas_uplink_generic_nas_transport_t { nas_generic_message_container_t generic_message_container; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_additional_information_t additional_information; } nas_uplink_generic_nas_transport_t; @@ -776,7 +770,7 @@ typedef struct _nas_downlink_generic_nas_transport_t { nas_generic_message_container_t generic_message_container; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_additional_information_t additional_information; } nas_downlink_generic_nas_transport_t; @@ -822,7 +816,7 @@ typedef struct _nas_activate_default_eps_bearer_context_request_t { nas_pdn_address_t pdn_address; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_transaction_identifier_t transaction_identifier; nas_quality_of_service_t negotiated_qos; nas_llc_service_access_point_identifier_t negotiated_llc_sapi; @@ -852,7 +846,7 @@ typedef struct _nas_activate_default_eps_bearer_context_request_t { typedef struct _nas_activate_default_eps_bearer_context_accept_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } nas_activate_default_eps_bearer_context_accept_t; @@ -871,7 +865,7 @@ typedef struct _nas_activate_default_eps_bearer_context_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } nas_activate_default_eps_bearer_context_reject_t; @@ -906,7 +900,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_request_t { nas_traffic_flow_template_t tft; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_transaction_identifier_t transaction_identifier; nas_quality_of_service_t negotiated_qos; nas_llc_service_access_point_identifier_t negotiated_llc_sapi; @@ -932,7 +926,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_request_t { typedef struct _nas_activate_dedicated_eps_bearer_context_accept_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_nbifom_container_t nbifom_container; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; @@ -954,7 +948,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_nbifom_container_t nbifom_container; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; @@ -992,7 +986,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_reject_t { typedef struct _nas_modify_eps_bearer_context_request_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_eps_quality_of_service_t new_eps_qos; nas_traffic_flow_template_t tft; nas_quality_of_service_t new_qos; @@ -1021,7 +1015,7 @@ typedef struct _nas_modify_eps_bearer_context_request_t { typedef struct _nas_modify_eps_bearer_context_accept_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_nbifom_container_t nbifom_container; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; @@ -1043,7 +1037,7 @@ typedef struct _nas_modify_eps_bearer_context_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_nbifom_container_t nbifom_container; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; @@ -1069,7 +1063,7 @@ typedef struct _nas_deactivate_eps_bearer_context_request_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_gprs_timer_3_t t3396_value; nas_wlan_offload_acceptability_t wlan_offload_indication; @@ -1089,7 +1083,7 @@ typedef struct _nas_deactivate_eps_bearer_context_request_t { typedef struct _nas_deactivate_eps_bearer_context_accept_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } nas_deactivate_eps_bearer_context_accept_t; @@ -1118,7 +1112,7 @@ typedef struct _nas_pdn_connectivity_request_t { nas_request_type_t request_type; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_esm_information_transfer_flag_t esm_information_transfer_flag; nas_access_point_name_t access_point_name; nas_protocol_configuration_options_t protocol_configuration_options; @@ -1148,7 +1142,7 @@ typedef struct _nas_pdn_connectivity_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_gprs_timer_3_t back_off_timer_value; nas_re_attempt_indicator_t re_attempt_indicator; @@ -1170,7 +1164,7 @@ typedef struct _nas_pdn_disconnect_request_t { nas_linked_eps_bearer_identity_t linked_eps_bearer_identity; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } nas_pdn_disconnect_request_t; @@ -1189,7 +1183,7 @@ typedef struct _nas_pdn_disconnect_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; } nas_pdn_disconnect_reject_t; @@ -1214,7 +1208,7 @@ typedef struct _nas_bearer_resource_allocation_request_t { nas_eps_quality_of_service_t required_traffic_flow_qos; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_device_properties_t device_properties; nas_nbifom_container_t nbifom_container; @@ -1241,7 +1235,7 @@ typedef struct _nas_bearer_resource_allocation_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_gprs_timer_3_t back_off_timer_value; nas_re_attempt_indicator_t re_attempt_indicator; @@ -1274,7 +1268,7 @@ typedef struct _nas_bearer_resource_modification_request_t { nas_traffic_flow_aggregate_description_t traffic_flow_aggregate; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_eps_quality_of_service_t required_traffic_flow_qos; nas_esm_cause_t esm_cause; nas_protocol_configuration_options_t protocol_configuration_options; @@ -1304,7 +1298,7 @@ typedef struct _nas_bearer_resource_modification_reject_t { nas_esm_cause_t esm_cause; /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_protocol_configuration_options_t protocol_configuration_options; nas_gprs_timer_3_t back_off_timer_value; nas_re_attempt_indicator_t re_attempt_indicator; @@ -1326,7 +1320,7 @@ typedef struct _nas_bearer_resource_modification_reject_t { typedef struct _nas_esm_information_response_t { /* Optional fields */ - c_uint32_t presencemask; + uint32_t presencemask; nas_access_point_name_t access_point_name; nas_protocol_configuration_options_t protocol_configuration_options; nas_extended_protocol_configuration_options_t extended_protocol_configuration_options; @@ -1412,10 +1406,10 @@ typedef struct _nas_message_t { }; } nas_message_t; -CORE_DECLARE(status_t) nas_emm_decode(nas_message_t *message, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) nas_esm_decode(nas_message_t *message, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) nas_plain_encode( - pkbuf_t **pkbuf, nas_message_t *message); +int nas_emm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf); +int nas_esm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf); +int nas_plain_encode( + ogs_pkbuf_t **pkbuf, nas_message_t *message); #ifdef __cplusplus } diff --git a/lib/nas/nas_types.c b/lib/nas/nas_types.c index 443dd2853..e232a83bd 100644 --- a/lib/nas/nas_types.c +++ b/lib/nas/nas_types.c @@ -1,10 +1,27 @@ -#define TRACE_MODULE _nas_types - -#include "core_debug.h" -#include "core_lib.h" +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "nas_types.h" +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain + void *nas_from_plmn_id(nas_plmn_id_t *nas_plmn_id, plmn_id_t *plmn_id) { memcpy(nas_plmn_id, plmn_id, PLMN_ID_LEN); @@ -28,17 +45,17 @@ void *nas_to_plmn_id(plmn_id_t *plmn_id, nas_plmn_id_t *nas_plmn_id) return plmn_id; } -static c_uint8_t br_calculate( - c_uint8_t *br, c_uint8_t *extended, c_uint8_t *extended2, - c_uint64_t input) +static uint8_t br_calculate( + uint8_t *br, uint8_t *extended, uint8_t *extended2, + uint64_t input) { - c_uint8_t length = 0; + uint8_t length = 0; /* Octet 3 : 00000000 Reserved, 11111111 0kbps */ if (input < 1) { *br = 0xff; - length = c_max(length, 1); + length = ogs_max(length, 1); return length; } @@ -57,14 +74,14 @@ static c_uint8_t br_calculate( if (input > (65200*1024)) { *extended2 = 0b11111110; - length = c_max(length, 3); + length = ogs_max(length, 3); input %= (256*1024); } else if (input >= (256*1024) && input <= (65200*1024)) { *extended2 = input / (256*1024); - length = c_max(length, 3); + length = ogs_max(length, 3); input %= (256*1024); } @@ -75,7 +92,7 @@ static c_uint8_t br_calculate( if (input >= 1 && input <= 63) { *br = input; - length = c_max(length, 1); + length = ogs_max(length, 1); } /* Octet 3 : 01000000 - 01111111 * The APN-AMBR is @@ -85,13 +102,13 @@ static c_uint8_t br_calculate( else if (input >= 64 && input <= 568) { *br = ((input - 64) / 8) + 0b01000000; - length = c_max(length, 1); + length = ogs_max(length, 1); } /* Set to 568 Kbps */ else if (input > 568 && input < 576) { *br = 0b01111111; - length = c_max(length, 1); + length = ogs_max(length, 1); } /* Octet 3 : 10000000 - 111111110 * The APN-AMBR is @@ -101,13 +118,13 @@ static c_uint8_t br_calculate( else if (input >= 576 && input <= 8640) { *br = ((input - 576) / 64) + 0b10000000; - length = c_max(length, 1); + length = ogs_max(length, 1); } /* Set to 8640 Kbps */ else if (input > 8640 && input < 8700) { *br = 0b11111110; - length = c_max(length, 1); + length = ogs_max(length, 1); } /* If the network wants to indicate an APN-AMBR @@ -130,14 +147,14 @@ static c_uint8_t br_calculate( { *br = 0b11111110; *extended = ((input - 8600) / 100); - length = c_max(length, 2); + length = ogs_max(length, 2); } /* Set to 16000 Kbps */ else if (input > 16000 && input < (17*1024)) { *br = 0b11111110; *extended = 0b01001010; - length = c_max(length, 2); + length = ogs_max(length, 2); } /* Octet 5: 01001011 - 10111010 * The APN-AMBR is @@ -148,14 +165,14 @@ static c_uint8_t br_calculate( { *br = 0b11111110; *extended = ((input - (16*1024)) / (1*1024)) + 0b01001010; - length = c_max(length, 2); + length = ogs_max(length, 2); } /* Set to 128 Mbps */ else if (input > (128*1024) && input < (130*1024)) { *br = 0b11111110; *extended = 0b10111010; - length = c_max(length, 2); + length = ogs_max(length, 2); } /* Octet 5: 10111011 - 11111010 * The APN-AMBR is @@ -166,7 +183,7 @@ static c_uint8_t br_calculate( { *br = 0b11111110; *extended = ((input - (128*1024)) / (2*1024)) + 0b10111010; - length = c_max(length, 2); + length = ogs_max(length, 2); } return length; @@ -174,9 +191,9 @@ static c_uint8_t br_calculate( void apn_ambr_build( nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate, - c_uint32_t dl_apn_ambr, c_uint32_t ul_apn_ambr) + uint32_t dl_apn_ambr, uint32_t ul_apn_ambr) { - c_uint8_t length = 0; + uint8_t length = 0; dl_apn_ambr = dl_apn_ambr / 1024; /* Kbps */ ul_apn_ambr = ul_apn_ambr / 1024; /* Kbps */ @@ -184,13 +201,13 @@ void apn_ambr_build( memset(apn_aggregate_maximum_bit_rate, 0, sizeof(nas_apn_aggregate_maximum_bit_rate_t)); - length = c_max(length, br_calculate( + length = ogs_max(length, br_calculate( &apn_aggregate_maximum_bit_rate->dl_apn_ambr, &apn_aggregate_maximum_bit_rate->dl_apn_ambr_extended, &apn_aggregate_maximum_bit_rate->dl_apn_ambr_extended2, dl_apn_ambr)); - length = c_max(length, br_calculate( + length = ogs_max(length, br_calculate( &apn_aggregate_maximum_bit_rate->ul_apn_ambr, &apn_aggregate_maximum_bit_rate->ul_apn_ambr_extended, &apn_aggregate_maximum_bit_rate->ul_apn_ambr_extended2, @@ -199,10 +216,10 @@ void apn_ambr_build( apn_aggregate_maximum_bit_rate->length = length*2; } -void eps_qos_build(nas_eps_quality_of_service_t *eps_qos, c_uint8_t qci, - c_uint64_t dl_mbr, c_uint64_t ul_mbr, c_uint64_t dl_gbr, c_uint64_t ul_gbr) +void eps_qos_build(nas_eps_quality_of_service_t *eps_qos, uint8_t qci, + uint64_t dl_mbr, uint64_t ul_mbr, uint64_t dl_gbr, uint64_t ul_gbr) { - c_uint8_t length = 0; + uint8_t length = 0; dl_mbr = dl_mbr / 1024; /* Kbps */ ul_mbr = ul_mbr / 1024; /* Kbps */ @@ -214,28 +231,28 @@ void eps_qos_build(nas_eps_quality_of_service_t *eps_qos, c_uint8_t qci, eps_qos->qci = qci; if (dl_mbr) - length = c_max(length, br_calculate( + length = ogs_max(length, br_calculate( &eps_qos->dl_mbr, &eps_qos->dl_mbr_extended, &eps_qos->dl_mbr_extended2, dl_mbr)); if (ul_mbr) - length = c_max(length, br_calculate( + length = ogs_max(length, br_calculate( &eps_qos->ul_mbr, &eps_qos->ul_mbr_extended, &eps_qos->ul_mbr_extended2, ul_mbr)); if (dl_gbr) - length = c_max(length, br_calculate( + length = ogs_max(length, br_calculate( &eps_qos->dl_gbr, &eps_qos->dl_gbr_extended, &eps_qos->dl_gbr_extended2, dl_gbr)); if (ul_gbr) - length = c_max(length, br_calculate( + length = ogs_max(length, br_calculate( &eps_qos->ul_gbr, &eps_qos->ul_gbr_extended, &eps_qos->ul_gbr_extended2, @@ -254,9 +271,9 @@ void nas_tai_list_build( tai2_list_t target2; nas_plmn_id_t nas_plmn_id; - d_assert(target, return,); - d_assert(source0, return,); - d_assert(source2, return,); + ogs_assert(target); + ogs_assert(source0); + ogs_assert(source2); memset(target, 0, sizeof(nas_tracking_area_identity_list_t)); memset(&target0, 0, sizeof(tai0_list_t)); @@ -264,13 +281,11 @@ void nas_tai_list_build( for (i = 0; source0->tai[i].num; i++) { - d_assert(source0->tai[i].type == TAI0_TYPE, - return, "type = %d", source0->tai[i].type); + ogs_assert(source0->tai[i].type == TAI0_TYPE); target0.tai[i].type = source0->tai[i].type; /* target->num = source->num - 1 */ - d_assert(source0->tai[i].num < MAX_NUM_OF_TAI, - return, "num = %d", source0->tai[i].num); + ogs_assert(source0->tai[i].num < MAX_NUM_OF_TAI); target0.tai[i].num = source0->tai[i].num - 1; memcpy(&target0.tai[i].plmn_id, nas_from_plmn_id(&nas_plmn_id, &source0->tai[i].plmn_id), @@ -284,7 +299,7 @@ void nas_tai_list_build( size = (1 + 3 + 2 * source0->tai[i].num); if ((target->length + size) > NAS_MAX_TAI_LIST_LEN) { - d_warn("Overflow: Ignore remained TAI LIST(length:%d, size:%d)", + ogs_warn("Overflow: Ignore remained TAI LIST(length:%d, size:%d)", target->length, size); return; } @@ -296,19 +311,17 @@ void nas_tai_list_build( { memset(&target2, 0, sizeof(target2)); - d_assert(source2->type == TAI1_TYPE || source2->type == TAI2_TYPE, - return, "type = %d", source2->type); + ogs_assert(source2->type == TAI1_TYPE || source2->type == TAI2_TYPE); target2.type = source2->type; /* target->num = source->num - 1 */ - d_assert(source2->num < MAX_NUM_OF_TAI, - return, "num = %d", source2->num); + ogs_assert(source2->num < MAX_NUM_OF_TAI); target2.num = source2->num - 1; size = (1 + (3 + 2) * source2->num); if ((target->length + size) > NAS_MAX_TAI_LIST_LEN) { - d_warn("Overflow: Ignore remained TAI LIST(length:%d, size:%d)", + ogs_warn("Overflow: Ignore remained TAI LIST(length:%d, size:%d)", target->length, size); return; } diff --git a/lib/nas/nas_types.h b/lib/nas/nas_types.h index fd9fb5546..1a0684088 100644 --- a/lib/nas/nas_types.h +++ b/lib/nas/nas_types.h @@ -1,7 +1,27 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef _NAS_TYPES_H__ #define _NAS_TYPES_H__ -#include "3gpp_types.h" +#include "base/types.h" +#include "base/context.h" #ifdef __cplusplus extern "C" { @@ -9,22 +29,22 @@ extern "C" { #define NAS_CLEAR_DATA(__dATA) \ do { \ - d_assert((__dATA), , "Null param"); \ + ogs_assert((__dATA)); \ if ((__dATA)->buffer) \ { \ - CORE_FREE((__dATA)->buffer); \ + ogs_free((__dATA)->buffer); \ (__dATA)->buffer = NULL; \ (__dATA)->length = 0; \ } \ } while(0) #define NAS_STORE_DATA(__dST, __sRC) \ do { \ - d_assert((__sRC),, "Null param") \ - d_assert((__sRC)->buffer,, "Null param") \ - d_assert((__dST),, "Null param") \ + ogs_assert((__sRC)); \ + ogs_assert((__sRC)->buffer); \ + ogs_assert((__dST)); \ NAS_CLEAR_DATA(__dST); \ (__dST)->length = (__sRC)->length; \ - (__dST)->buffer = core_calloc((__dST)->length, sizeof(c_uint8_t)); \ + (__dST)->buffer = ogs_calloc((__dST)->length, sizeof(uint8_t)); \ memcpy((__dST)->buffer, (__sRC)->buffer, (__dST)->length); \ } while(0) @@ -55,39 +75,39 @@ typedef struct _guti_t { * O TLV 3-n */ #define NAX_MAX_ADDITIONAL_INFORMATION_LEN 255 typedef struct _nas_additional_information_t { - c_uint8_t length; - c_uint8_t buffer[NAX_MAX_ADDITIONAL_INFORMATION_LEN]; + uint8_t length; + uint8_t buffer[NAX_MAX_ADDITIONAL_INFORMATION_LEN]; } __attribute__ ((packed)) nas_additional_information_t; /* 9.9.2.0A Device properties * See subclause 10.5.7.8 in 3GPP TS 24.008 [13]. * O TV 1 */ typedef struct _nas_device_properties_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t low_priority:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t low_priority:1;) } __attribute__ ((packed)) nas_device_properties_t; /* 9.9.2.1 EPS bearer context status * O TLV 4 */ typedef struct _nas_eps_bearer_context_status_t { - c_uint8_t length; -ED8(c_uint8_t ebi7:1;, - c_uint8_t ebi6:1;, - c_uint8_t ebi5:1;, - c_uint8_t ebi4:1;, - c_uint8_t ebi3:1;, - c_uint8_t ebi2:1;, - c_uint8_t ebi1:1;, - c_uint8_t ebi0:1;) -ED8(c_uint8_t ebi15:1;, - c_uint8_t ebi14:1;, - c_uint8_t ebi13:1;, - c_uint8_t ebi12:1;, - c_uint8_t ebi11:1;, - c_uint8_t ebi10:1;, - c_uint8_t ebi9:1;, - c_uint8_t ebi8:1;) + uint8_t length; +ED8(uint8_t ebi7:1;, + uint8_t ebi6:1;, + uint8_t ebi5:1;, + uint8_t ebi4:1;, + uint8_t ebi3:1;, + uint8_t ebi2:1;, + uint8_t ebi1:1;, + uint8_t ebi0:1;) +ED8(uint8_t ebi15:1;, + uint8_t ebi14:1;, + uint8_t ebi13:1;, + uint8_t ebi12:1;, + uint8_t ebi11:1;, + uint8_t ebi10:1;, + uint8_t ebi9:1;, + uint8_t ebi8:1;) } __attribute__ ((packed)) nas_eps_bearer_context_status_t; /* 9.9.2.2 Location area identification @@ -95,7 +115,7 @@ ED8(c_uint8_t ebi15:1;, * O TV 6 */ typedef struct _nas_location_area_identification_t { nas_plmn_id_t plmn_id; - c_uint16_t lac; + uint16_t lac; } __attribute__ ((packed)) nas_location_area_identification_t; /* 9.9.2.3 Mobile identity @@ -109,45 +129,45 @@ typedef struct _nas_location_area_identification_t { #define NAS_MOBILE_IDENTITY_TMGI 5 #define NAS_MOBILE_IDENTITY_GUTI 6 typedef struct _nas_mobile_identity_imsi { -ED3(c_uint8_t digit1:4;, - c_uint8_t odd_even:1;, - c_uint8_t type:3;) -ED2(c_uint8_t digit3:4;, - c_uint8_t digit2:4;) -ED2(c_uint8_t digit5:4;, - c_uint8_t digit4:4;) -ED2(c_uint8_t digit7:4;, - c_uint8_t digit6:4;) -ED2(c_uint8_t digit9:4;, - c_uint8_t digit8:4;) -ED2(c_uint8_t digit11:4;, - c_uint8_t digit10:4;) -ED2(c_uint8_t digit13:4;, - c_uint8_t digit12:4;) -ED2(c_uint8_t digit15:4;, - c_uint8_t digit14:4;) +ED3(uint8_t digit1:4;, + uint8_t odd_even:1;, + uint8_t type:3;) +ED2(uint8_t digit3:4;, + uint8_t digit2:4;) +ED2(uint8_t digit5:4;, + uint8_t digit4:4;) +ED2(uint8_t digit7:4;, + uint8_t digit6:4;) +ED2(uint8_t digit9:4;, + uint8_t digit8:4;) +ED2(uint8_t digit11:4;, + uint8_t digit10:4;) +ED2(uint8_t digit13:4;, + uint8_t digit12:4;) +ED2(uint8_t digit15:4;, + uint8_t digit14:4;) } __attribute__ ((packed)) nas_mobile_identity_imsi_t; typedef struct _nas_mobile_identity_tmsi { -ED3(c_uint8_t spare:4;, - c_uint8_t odd_even:1;, - c_uint8_t type:3;) - c_uint32_t tmsi; +ED3(uint8_t spare:4;, + uint8_t odd_even:1;, + uint8_t type:3;) + uint32_t tmsi; } __attribute__ ((packed)) nas_mobile_identity_tmsi_t; typedef struct _nas_mobile_identity_tmgi { -ED5(c_uint8_t spare:2;, - c_uint8_t mbms_session_id:1;, - c_uint8_t mcc_mnc:1;, - c_uint8_t odd_even:1;, - c_uint8_t type:3;) - c_uint8_t mbms_servicec_id[3]; +ED5(uint8_t spare:2;, + uint8_t mbms_session_id:1;, + uint8_t mcc_mnc:1;, + uint8_t odd_even:1;, + uint8_t type:3;) + uint8_t mbms_servicec_id[3]; nas_plmn_id_t plmn_id; - c_uint8_t mbms_session_identity; + uint8_t mbms_session_identity; } __attribute__ ((packed)) nas_mobile_identity_tmgi_t; typedef struct _nas_mobile_identity_t { - c_uint8_t length; + uint8_t length; union { nas_mobile_identity_imsi_t imsi; nas_mobile_identity_tmsi_t tmsi; @@ -170,27 +190,27 @@ typedef struct _nas_mobile_identity_t { #define NAS_MS_CLASSMARK_2_RF_CLASS5 4 #define NAS_MS_CLASSMARK_2_RF_IRRELEVANT 7 typedef struct nas_mobile_station_classmark_2_t { - c_uint8_t length; -ED5(c_uint8_t spare1:1;, - c_uint8_t revision_level:2;, - c_uint8_t es_ind:1;, - c_uint8_t a5_1:1;, - c_uint8_t rf_power_capability:3;) -ED7(c_uint8_t spare:1;, - c_uint8_t ps_capa:1;, - c_uint8_t ss_screen_indicator:2;, - c_uint8_t sm_capabi:1;, - c_uint8_t vbs:1;, - c_uint8_t vgcs:1;, - c_uint8_t fc:1;) -ED8(c_uint8_t cm3:1;, - c_uint8_t spare2:1;, - c_uint8_t lcsva_cap:1;, - c_uint8_t ucs2:1;, - c_uint8_t solsa:1;, - c_uint8_t cmsp:1;, - c_uint8_t a5_3:1;, - c_uint8_t a5_2:1;) + uint8_t length; +ED5(uint8_t spare1:1;, + uint8_t revision_level:2;, + uint8_t es_ind:1;, + uint8_t a5_1:1;, + uint8_t rf_power_capability:3;) +ED7(uint8_t spare:1;, + uint8_t ps_capa:1;, + uint8_t ss_screen_indicator:2;, + uint8_t sm_capabi:1;, + uint8_t vbs:1;, + uint8_t vgcs:1;, + uint8_t fc:1;) +ED8(uint8_t cm3:1;, + uint8_t spare2:1;, + uint8_t lcsva_cap:1;, + uint8_t ucs2:1;, + uint8_t solsa:1;, + uint8_t cmsp:1;, + uint8_t a5_3:1;, + uint8_t a5_2:1;) } __attribute__ ((packed)) nas_mobile_station_classmark_2_t; /*9.9.2.5 Mobile station classmark 3 @@ -198,8 +218,8 @@ ED8(c_uint8_t cm3:1;, * O TLV 2-34 */ #define NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN 32 typedef struct _nas_mobile_station_classmark_3_t { - c_uint8_t length; - c_uint8_t buffer[NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN]; + uint8_t length; + uint8_t buffer[NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN]; } __attribute__ ((packed)) nas_mobile_station_classmark_3_t; /* 9.9.2.8 PLMN list @@ -207,7 +227,7 @@ typedef struct _nas_mobile_station_classmark_3_t { * O TLV 5-47 */ #define NAS_MAX_PLMN 15 typedef struct _nas_plmn_list_t { - c_uint8_t length; + uint8_t length; nas_plmn_id_t plmn_id[NAS_MAX_PLMN]; } __attribute__ ((packed)) nas_plmn_list_t; @@ -215,23 +235,23 @@ typedef struct _nas_plmn_list_t { * See subclause 10.5.4.32 in 3GPP TS 24.008 [13]. * O TLV 5-n */ typedef struct _nas_supported_codec_item_t { - c_uint8_t system_identification; - c_uint8_t length_of_bitmap; - c_uint16_t codec_bitmap; + uint8_t system_identification; + uint8_t length_of_bitmap; + uint16_t codec_bitmap; } __attribute__ ((packed)) nas_supported_codec_item_t; #define NAS_MAX_SUPPORTED_CODECS 8 typedef struct _nas_supported_codec_list_t { - c_uint8_t length; + uint8_t length; nas_supported_codec_item_t item[NAS_MAX_SUPPORTED_CODECS]; } __attribute__ ((packed)) nas_supported_codec_list_t; /* 9.9.3.0A Additional update result * O TV 1 */ typedef struct _nas_additional_update_result_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:2;, - c_uint8_t additional_update_result_value:2;) +ED3(uint8_t type:4;, + uint8_t spare:2;, + uint8_t additional_update_result_value:2;) } __attribute__ ((packed)) nas_additional_update_result_t; /* 9.9.3.0B Additional update type @@ -241,40 +261,40 @@ ED3(c_uint8_t type:4;, #define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_DATA_PLANE 2 #define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_RESERVED 3 typedef struct _nas_additional_update_type_t { -ED4(c_uint8_t type:4;, - c_uint8_t pnb_ciot:2;, - c_uint8_t saf:1;, - c_uint8_t autv:1;) +ED4(uint8_t type:4;, + uint8_t pnb_ciot:2;, + uint8_t saf:1;, + uint8_t autv:1;) } __attribute__ ((packed)) nas_additional_update_type_t; /* 9.9.3.1 Authentication failure parameter * See subclause 10.5.3.2.2 in 3GPP TS 24.008 [13]. * O TLV 16 */ typedef struct _nas_authentication_failure_parameter_t { - c_uint8_t length; - c_uint8_t auts[AUTS_LEN]; + uint8_t length; + uint8_t auts[AUTS_LEN]; } __attribute__ ((packed)) nas_authentication_failure_parameter_t; /* 9.9.3.2 Authentication parameter AUTN * See subclause 10.5.3.1.1 in 3GPP TS 24.008 [13]. * M LV 17 */ typedef struct _nas_authentication_parameter_autn_t { - c_uint8_t length; - c_uint8_t autn[AUTN_LEN]; + uint8_t length; + uint8_t autn[AUTN_LEN]; } nas_authentication_parameter_autn_t; /* 9.9.3.3 Authentication parameter RAND * See subclause 10.5.3.1 in 3GPP TS 24.008 [13]. * M V 16 */ typedef struct _nas_authentication_parameter_rand_t { - c_uint8_t rand[RAND_LEN]; + uint8_t rand[RAND_LEN]; } nas_authentication_parameter_rand_t; /* 9.9.3.4 Authentication response parameter * M LV 5-17 */ typedef struct _nas_authentication_response_parameter_t { - c_uint8_t length; - c_uint8_t res[MAX_RES_LEN]; + uint8_t length; + uint8_t res[MAX_RES_LEN]; } nas_authentication_response_parameter_t; /* 9.9.3.4a Ciphering key sequence number @@ -282,9 +302,9 @@ typedef struct _nas_authentication_response_parameter_t { * O TV 1 */ #define NAS_CIPHERING_KEY_SEQUENCE_NUMBER_NO_KEY_FROM_MS 7 typedef struct _nas_ciphering_key_sequence_number_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:1;, - c_uint8_t key_sequence:3;) +ED3(uint8_t type:4;, + uint8_t spare:1;, + uint8_t key_sequence:3;) } __attribute__ ((packed)) nas_ciphering_key_sequence_number_t; /* 9.9.3.5 CSFB response @@ -292,9 +312,9 @@ ED3(c_uint8_t type:4;, #define NAS_CS_FALLBACK_RESPONSE_REJECTED_BY_THE_UE 0 #define NAS_CS_FALLBACK_RESPONSE_ACCEPTED_BY_THE_UE 1 typedef struct _nas_csfb_response_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:1;, - c_uint8_t response:3;) +ED3(uint8_t type:4;, + uint8_t spare:1;, + uint8_t response:3;) } __attribute__ ((packed)) nas_csfb_response_t; /* 9.9.3.6 Daylight saving time @@ -304,9 +324,9 @@ ED3(c_uint8_t type:4;, #define NAS_PLUS_1_HOUR_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 1 #define NAS_PLUS_2_HOURS_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 2 typedef struct _nas_daylight_saving_time_t { - c_uint8_t length; -ED2(c_uint8_t spare:6;, - c_uint8_t value:2;) + uint8_t length; +ED2(uint8_t spare:6;, + uint8_t value:2;) } __attribute__ ((packed)) nas_daylight_saving_time_t; /* 9.9.3.7 Detach type @@ -320,10 +340,10 @@ ED2(c_uint8_t spare:6;, #define NAS_DETACH_TYPE_TO_UE_RE_ATTACH_NOT_REQUIRED 2 #define NAS_DETACH_TYPE_TO_UE_IMSI_DETACH 3 typedef struct _nas_detach_type_t { -ED4(c_uint8_t tsc:1;, - c_uint8_t nas_key_set_identifier:3;, - c_uint8_t switch_off:1;, - c_uint8_t detach_type:3;) +ED4(uint8_t tsc:1;, + uint8_t nas_key_set_identifier:3;, + uint8_t switch_off:1;, + uint8_t detach_type:3;) } __attribute__ ((packed)) nas_detach_type_t; /* 9.9.3.8 DRX parameter @@ -343,10 +363,10 @@ ED4(c_uint8_t tsc:1;, #define NAS_DRX_PARAMETER_COEFFICIENT_8_T_128 8 #define NAS_DRX_PARAMETER_COEFFICIENT_9_T_256 9 typedef struct _nas_drx_parameter_t { - c_uint8_t split_pg_cycle_code; -ED3(c_uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode:4;, - c_uint8_t split_on_ccch:1;, - c_uint8_t non_DRX_timer:3;) + uint8_t split_pg_cycle_code; +ED3(uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode:4;, + uint8_t split_on_ccch:1;, + uint8_t non_DRX_timer:3;) } __attribute__ ((packed)) nas_drx_parameter_t; /* 9.9.3.9 EMM cause @@ -394,15 +414,15 @@ ED3(c_uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode #define EMM_CAUSE_CONDITIONAL_IE_ERROR 100 #define EMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 101 #define EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 -typedef c_uint8_t nas_emm_cause_t; +typedef uint8_t nas_emm_cause_t; /* 9.9.3.10 * EPS attach result * M V 1/2 */ #define NAS_ATTACH_RESULT_EPS_ONLY 1 #define NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH 2 typedef struct _nas_eps_attach_result_t { -ED2(c_uint8_t spare:5;, - c_uint8_t result:3;) +ED2(uint8_t spare:5;, + uint8_t result:3;) } __attribute__ ((packed)) nas_eps_attach_result_t; /* 9.9.3.11 EPS attach type @@ -418,10 +438,10 @@ ED2(c_uint8_t spare:5;, #define NAS_ATTACH_TYPE_EPS_ERMERGENCY_ATTCH 3 #define NAS_ATTACH_TYPE_RESERVED 4 typedef struct _nas_eps_attach_type_t { -ED4(c_uint8_t tsc:1;, - c_uint8_t nas_key_set_identifier:3;, - c_uint8_t spare:1;, - c_uint8_t attach_type:3;) +ED4(uint8_t tsc:1;, + uint8_t nas_key_set_identifier:3;, + uint8_t spare:1;, + uint8_t attach_type:3;) } __attribute__ ((packed)) nas_eps_attach_type_t; /* 9.9.3.12 EPS mobile identity @@ -433,20 +453,20 @@ ED4(c_uint8_t tsc:1;, #define NAS_EPS_MOBILE_IDENTITY_EVEN 0 #define NAS_EPS_MOBILE_IDENTITY_ODD 1 typedef struct _nas_eps_mobile_identity_guti_t { -ED3(c_uint8_t spare:4;, - c_uint8_t odd_even:1;, - c_uint8_t type:3;) +ED3(uint8_t spare:4;, + uint8_t odd_even:1;, + uint8_t type:3;) nas_plmn_id_t plmn_id; - c_uint16_t mme_gid; - c_uint8_t mme_code; - c_uint32_t m_tmsi; + uint16_t mme_gid; + uint8_t mme_code; + uint32_t m_tmsi; } __attribute__ ((packed)) nas_eps_mobile_identity_guti_t; typedef nas_mobile_identity_imsi_t nas_eps_mobile_identity_imsi_t; typedef nas_eps_mobile_identity_imsi_t nas_eps_mobile_identity_imei_t; typedef struct _nas_eps_mobile_identity_t { - c_uint8_t length; + uint8_t length; union { nas_eps_mobile_identity_imsi_t imsi; nas_eps_mobile_identity_guti_t guti; @@ -457,19 +477,19 @@ typedef struct _nas_eps_mobile_identity_t { /* 9.9.3.12A EPS network feature support * O TLV 3 */ typedef struct _nas_eps_network_feature_support_t { - c_uint8_t length; -ED7(c_uint8_t cp_ciot:1;, - c_uint8_t erw_opdn:1;, - c_uint8_t esr_ps:1;, - c_uint8_t cs_lcs:2;, - c_uint8_t epc_lcs:1;, - c_uint8_t emc_bs:1;, - c_uint8_t ims_vops:1;) -ED5(c_uint8_t spare:4;, - c_uint8_t e_pco:1;, - c_uint8_t hc_cp_ciot:1;, - c_uint8_t s1_u_data:1;, - c_uint8_t up_ciot :1;) + uint8_t length; +ED7(uint8_t cp_ciot:1;, + uint8_t erw_opdn:1;, + uint8_t esr_ps:1;, + uint8_t cs_lcs:2;, + uint8_t epc_lcs:1;, + uint8_t emc_bs:1;, + uint8_t ims_vops:1;) +ED5(uint8_t spare:4;, + uint8_t e_pco:1;, + uint8_t hc_cp_ciot:1;, + uint8_t s1_u_data:1;, + uint8_t up_ciot :1;) } __attribute__ ((packed)) nas_eps_network_feature_support_t; /* 9.9.3.13 EPS update result @@ -479,8 +499,8 @@ ED5(c_uint8_t spare:4;, #define NAS_EPS_UPDATE_RESULT_TA_UPDATED_AND_ISR_ACTIVATED 4 #define NAS_EPS_UPDATE_RESULT_COMBINED_TA_LA_UPDATED_AND_ISR_ACTIVATED 5 typedef struct _nas_eps_update_result_t { -ED2(c_uint8_t spare:5;, - c_uint8_t result:3;) +ED2(uint8_t spare:5;, + uint8_t result:3;) } __attribute__ ((packed)) nas_eps_update_result_t; /* 9.9.3.14 EPS update type @@ -492,17 +512,17 @@ ED2(c_uint8_t spare:5;, #define NAS_EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING_WITH_IMSI_ATTACH 2 #define NAS_EPS_UPDATE_TYPE_PERIODIC_UPDATING 3 typedef struct _nas_eps_update_type_t { -ED4(c_uint8_t tsc:1;, - c_uint8_t nas_key_set_identifier:3;, - c_uint8_t active_flag:1;, - c_uint8_t update_type:3;) +ED4(uint8_t tsc:1;, + uint8_t nas_key_set_identifier:3;, + uint8_t active_flag:1;, + uint8_t update_type:3;) } __attribute__ ((packed)) nas_eps_update_type_t; /* 9.9.3.15 ESM message container * M LV-E 5-n */ typedef struct _nas_esm_message_container_t { - c_uint16_t length; - c_uint8_t *buffer; + uint16_t length; + uint8_t *buffer; } nas_esm_message_container_t; /* 9.9.3.16 GPRS timer @@ -513,16 +533,16 @@ typedef struct _nas_esm_message_container_t { #define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH 2 #define NAS_GRPS_TIMER_UNIT_DEACTIVATED 7 typedef struct _nas_gprs_timer_t { -ED2(c_uint8_t unit:3;, - c_uint8_t value:5;) +ED2(uint8_t unit:3;, + uint8_t value:5;) } __attribute__ ((packed)) nas_gprs_timer_t; /* 9.9.3.16A GPRS timer 2 * See subclause 10.5.7.4 in 3GPP TS 24.008 [13]. * O TLV 3 */ typedef struct _nas_gprs_timer_2_t { - c_uint8_t length; - c_uint8_t gprs_timer_2_value; + uint8_t length; + uint8_t gprs_timer_2_value; } __attribute__ ((packed)) nas_gprs_timer_2_t; /* 9.9.3.16B GPRS timer 3 @@ -538,9 +558,9 @@ typedef struct _nas_gprs_timer_2_t { #define NAS_GRPS_TIMER_3_UNIT_DEACTIVATED 7 typedef struct _nas_gprs_timer_3_t { - c_uint8_t length; -ED2(c_uint8_t unit:3;, - c_uint8_t timer_value:5;) + uint8_t length; +ED2(uint8_t unit:3;, + uint8_t timer_value:5;) } __attribute__ ((packed)) nas_gprs_timer_3_t; /* 9.9.3.17 Identity type 2 @@ -551,24 +571,24 @@ ED2(c_uint8_t unit:3;, #define NAS_IDENTITY_TYPE_2_IMEISV 3 #define NAS_IDENTITY_TYPE_2_TMSI 4 typedef struct _nas_identity_type_2_t { -ED2(c_uint8_t spare:5;, - c_uint8_t type:3;) +ED2(uint8_t spare:5;, + uint8_t type:3;) } __attribute__ ((packed)) nas_identity_type_2_t; /* 9.9.3.18 IMEISV request * See subclause 10.5.5.10 in 3GPP TS 24.008 [13]. * O TV 1 */ typedef struct _nas_imeisv_request_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:1;, - c_uint8_t imeisv_request_value:3;) +ED3(uint8_t type:4;, + uint8_t spare:1;, + uint8_t imeisv_request_value:3;) } __attribute__ ((packed)) nas_imeisv_request_t; /* 9.9.3.19 KSI and sequence number * M V 1 */ typedef struct _nas_ksi_and_sequence_number_t { -ED2(c_uint8_t ksi:3;, - c_uint8_t sequence_number:5;) +ED2(uint8_t ksi:3;, + uint8_t sequence_number:5;) } __attribute__ ((packed)) nas_ksi_and_sequence_number_t; /* 9.9.3.20 MS network capability @@ -581,40 +601,40 @@ ED2(c_uint8_t ksi:3;, #define NAS_MS_NETWORK_CAPABILITY_GEA6 0b00000100 #define NAS_MS_NETWORK_CAPABILITY_GEA7 0b00000010 typedef struct _nas_ms_network_capability_t { - c_uint8_t length; -ED7(c_uint8_t gea1:1;, - c_uint8_t sm_capabilities_via_dedicated_channels:1;, - c_uint8_t sm_capabilities_via_gprs_channels:1;, - c_uint8_t ucs2:1;, - c_uint8_t ss_screening_indicator:2;, - c_uint8_t solsa_capability:1;, - c_uint8_t revision_level_indicator:1;) -ED3(c_uint8_t pfc_feature_mode:1;, - c_uint8_t extended_gea:6;, - c_uint8_t lcs_va_capability:1;) -ED8(c_uint8_t ps_inter_rat_ho_from_geran_to_utran_iu_mode_capability:1;, - c_uint8_t ps_inter_rat_ho_from_geran_to_e_utran_s1_mode_capability:1;, - c_uint8_t emm_combined_procedures_capability:1;, - c_uint8_t isr_support:1;, - c_uint8_t srvcc_to_geran_utran_capability:1;, - c_uint8_t epc_capability:1;, - c_uint8_t nf_capability:1;, - c_uint8_t geran_network_sharing_capability:1;) -ED6(c_uint8_t user_plane_integrity_protection_support:1;, - c_uint8_t gia4:1;, - c_uint8_t gia5:1;, - c_uint8_t gia6:1;, - c_uint8_t gia7:1;, - c_uint8_t spare:3;) + uint8_t length; +ED7(uint8_t gea1:1;, + uint8_t sm_capabilities_via_dedicated_channels:1;, + uint8_t sm_capabilities_via_gprs_channels:1;, + uint8_t ucs2:1;, + uint8_t ss_screening_indicator:2;, + uint8_t solsa_capability:1;, + uint8_t revision_level_indicator:1;) +ED3(uint8_t pfc_feature_mode:1;, + uint8_t extended_gea:6;, + uint8_t lcs_va_capability:1;) +ED8(uint8_t ps_inter_rat_ho_from_geran_to_utran_iu_mode_capability:1;, + uint8_t ps_inter_rat_ho_from_geran_to_e_utran_s1_mode_capability:1;, + uint8_t emm_combined_procedures_capability:1;, + uint8_t isr_support:1;, + uint8_t srvcc_to_geran_utran_capability:1;, + uint8_t epc_capability:1;, + uint8_t nf_capability:1;, + uint8_t geran_network_sharing_capability:1;) +ED6(uint8_t user_plane_integrity_protection_support:1;, + uint8_t gia4:1;, + uint8_t gia5:1;, + uint8_t gia6:1;, + uint8_t gia7:1;, + uint8_t spare:3;) } __attribute__ ((packed)) nas_ms_network_capability_t; /* 9.9.3.20A MS network feature support * See subclause 10.5.1.15 in 3GPP TS 24.008 [13]. * O TV 1 */ typedef struct _nas_ms_network_feature_support_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t extended_periodic_timers:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t extended_periodic_timers:1;) } __attribute__ ((packed)) nas_ms_network_feature_support_t; /* 9.9.3.21 NAS key set identifier @@ -622,17 +642,17 @@ ED3(c_uint8_t type:4;, * 9.9.2.9 Spare half octet * M V 1/2 */ typedef struct _nas_key_set_identifier_t { -ED3(c_uint8_t type:4;, - c_uint8_t tsc:1;, - c_uint8_t nas_key_set_identifier:3;) +ED3(uint8_t type:4;, + uint8_t tsc:1;, + uint8_t nas_key_set_identifier:3;) } __attribute__ ((packed)) nas_key_set_identifier_t; /* 9.9.3.22 message container * M LV 3-252 */ #define NAS_MAX_MESSAGE_CONTAINER_LEN 250 typedef struct _nas_message_container_t { - c_uint8_t length; - c_uint8_t buffer[NAS_MAX_MESSAGE_CONTAINER_LEN]; + uint8_t length; + uint8_t buffer[NAS_MAX_MESSAGE_CONTAINER_LEN]; } __attribute__ ((packed)) nas_message_container_t; /* 9.9.3.23 NAS security algorithms @@ -646,10 +666,10 @@ typedef struct _nas_message_container_t { #define NAS_SECURITY_ALGORITHMS_128_EEA2 2 #define NAS_SECURITY_ALGORITHMS_128_EEA3 3 typedef struct _nas_security_algorithms_t { -ED4(c_uint8_t spare1:1;, - c_uint8_t type_of_ciphering_algorithm:3;, - c_uint8_t spare2:1;, - c_uint8_t type_of_integrity_protection_algorithm:3;) +ED4(uint8_t spare1:1;, + uint8_t type_of_ciphering_algorithm:3;, + uint8_t spare2:1;, + uint8_t type_of_integrity_protection_algorithm:3;) } __attribute__ ((packed)) nas_security_algorithms_t; /* 9.9.3.24 Network name @@ -657,49 +677,49 @@ ED4(c_uint8_t spare1:1;, * O TLV 3-n */ #define NAS_MAX_NETWORK_NAME_LEN 255 typedef struct _nas_network_name_t { - c_uint8_t length; -ED4(c_uint8_t ext:1;, - c_uint8_t coding_scheme:3;, - c_uint8_t add_ci:1;, - c_uint8_t number_of_spare_bits_in_last_octet:3;) - c_uint8_t name[NAS_MAX_NETWORK_NAME_LEN]; + uint8_t length; +ED4(uint8_t ext:1;, + uint8_t coding_scheme:3;, + uint8_t add_ci:1;, + uint8_t number_of_spare_bits_in_last_octet:3;) + uint8_t name[NAS_MAX_NETWORK_NAME_LEN]; } __attribute__ ((packed)) nas_network_name_t; /* 9.9.3.24A Network resource identifier container * See subclause 10.5.5.31 in 3GPP TS 24.008 [13]. * O TLV 4 */ typedef struct _nas_network_resource_identifier_container_t { - c_uint8_t length; - c_uint8_t nri_container_value1; -ED2(c_uint8_t nri_container_value2:2;, - c_uint8_t spare:6;) + uint8_t length; + uint8_t nri_container_value1; +ED2(uint8_t nri_container_value2:2;, + uint8_t spare:6;) } __attribute__ ((packed)) nas_network_resource_identifier_container_t; /* 9.9.3.25 Nonce * O TV 5 */ -typedef c_uint32_t nas_nonce_t; +typedef uint32_t nas_nonce_t; /* 9.9.3.25A Paging identity * M V 1 */ #define NAS_PAGING_IDENTITY_IMSI 0 #define NAS_PAGING_IDENTITY_TMSI 1 typedef struct _nas_paging_identity_t { -ED2(c_uint8_t spare:7;, - c_uint8_t identity:1;) +ED2(uint8_t spare:7;, + uint8_t identity:1;) } nas_paging_identity_t; /* 9.9.3.26 P-TMSI signature * See subclause 10.5.5.8 in 3GPP TS 24.008 * O TV 4 */ -typedef c_uint32_t nas_p_tmsi_signature_t; /* TV : 4bytes */ +typedef uint32_t nas_p_tmsi_signature_t; /* TV : 4bytes */ /* 9.9.3.26A Extended EMM cause * O TV 1 */ typedef struct _nas_extended_emm_cause_t { -ED4(c_uint8_t type:4;, - c_uint8_t spare:2;, - c_uint8_t eps_optimization_info:1;, - c_uint8_t e_utran_allowed:1;) +ED4(uint8_t type:4;, + uint8_t spare:2;, + uint8_t eps_optimization_info:1;, + uint8_t e_utran_allowed:1;) } nas_extended_emm_cause_t; /* 9.9.3.27 Service type @@ -710,19 +730,19 @@ ED4(c_uint8_t type:4;, #define NAS_SERVICE_TYPE_CS_FALLBACK_OR_1XCS_FALLBACK_TO_UE 1 #define NAS_SERVICE_TYPE_CS_FALLBACK_EMERGENCY_CALL_OR_1XCS_FALLBACK_EMERGENCY_CALL_FROM_UE 2 typedef struct _nas_service_type_t { -ED3(c_uint8_t tsc:1;, - c_uint8_t nas_key_set_identifier:3;, - c_uint8_t service_type:4;) +ED3(uint8_t tsc:1;, + uint8_t nas_key_set_identifier:3;, + uint8_t service_type:4;) } __attribute__ ((packed)) nas_service_type_t; /* 9.9.3.28 Short MAC * M V 2 */ -typedef c_uint16_t nas_short_mac_t; +typedef uint16_t nas_short_mac_t; /* 9.9.3.29 Time zone * See subclause 10.5.3.8 in 3GPP TS 24.008 [13]. * O TV 2 */ -typedef c_uint8_t nas_time_zone_t; +typedef uint8_t nas_time_zone_t; /* 9.9.3.30 Time zone and time * See subclause 10.5.3.9 in 3GPP TS 24.008 [13]. @@ -730,27 +750,27 @@ typedef c_uint8_t nas_time_zone_t; * O TV 8 */ #define NAS_TIME_TO_BCD(x) TIME_TO_BCD(x) typedef struct _nas_time_zone_and_time_t { - c_uint8_t year; - c_uint8_t mon; - c_uint8_t mday; - c_uint8_t hour; - c_uint8_t min; - c_uint8_t sec; + uint8_t year; + uint8_t mon; + uint8_t mday; + uint8_t hour; + uint8_t min; + uint8_t sec; /* The Time Zone indicates the difference, expressed in quarters of an hour, * between the local time and GMT. In the first of the two semi-octets, * the first bit (bit 3 of the seventh octet of * the TP-Service-Centre-Time-Stamp field) represents * the algebraic sign of this difference (0: positive, 1: negative). */ - c_uint8_t timezone; + uint8_t timezone; } nas_time_zone_and_time_t; /* 9.9.3.31 TMSI status * See subclause 10.5.5.4 in 3GPP TS 24.008 [13] * O TV 1 */ typedef struct _nas_tmsi_status_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t tmsi_flag:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t tmsi_flag:1;) } __attribute__ ((packed)) nas_tmsi_status_t; /* 9.9.3.32 Tracking area identity @@ -768,9 +788,9 @@ typedef struct _nas_tracking_area_identity_t { #define TAI2_TYPE 2 typedef struct _tai0_list_t { struct { - ED3(c_uint8_t spare:1;, - c_uint8_t type:2;, - c_uint8_t num:5;) + ED3(uint8_t spare:1;, + uint8_t type:2;, + uint8_t num:5;) /* * Do not change 'plmn_id_t' to 'nas_plmn_id_t'. * Use 'plmn_id_t' for easy implementation. @@ -778,14 +798,14 @@ typedef struct _tai0_list_t { * and is sent to the UE. */ plmn_id_t plmn_id; - c_uint16_t tac[MAX_NUM_OF_TAI]; + uint16_t tac[MAX_NUM_OF_TAI]; } __attribute__ ((packed)) tai[MAX_NUM_OF_TAI]; } __attribute__ ((packed)) tai0_list_t; typedef struct _tai2_list_t { -ED3(c_uint8_t spare:1;, - c_uint8_t type:2;, - c_uint8_t num:5;) +ED3(uint8_t spare:1;, + uint8_t type:2;, + uint8_t num:5;) /* * Do not change 'tai_t' to 'nas_tracking_area_identity_t'. * Use 'tai_t' for easy implementation. @@ -796,166 +816,166 @@ ED3(c_uint8_t spare:1;, } __attribute__ ((packed)) tai2_list_t; typedef struct _nas_tracking_area_identity_list_t { - c_uint8_t length; - c_uint8_t buffer[NAS_MAX_TAI_LIST_LEN]; + uint8_t length; + uint8_t buffer[NAS_MAX_TAI_LIST_LEN]; } __attribute__ ((packed)) nas_tracking_area_identity_list_t; -CORE_DECLARE(void) nas_tai_list_build( +void nas_tai_list_build( nas_tracking_area_identity_list_t *target, tai0_list_t *source0, tai2_list_t *source2); /* 9.9.3.34 UE network capability * M LV 3-14 */ typedef struct _nas_ue_network_capability_t { - c_uint8_t length; + uint8_t length; union { struct { - ED8(c_uint8_t eea0:1;, - c_uint8_t eea1:1;, - c_uint8_t eea2:1;, - c_uint8_t eea3:1;, - c_uint8_t eea4:1;, - c_uint8_t eea5:1;, - c_uint8_t eea6:1;, - c_uint8_t eea7:1;) + ED8(uint8_t eea0:1;, + uint8_t eea1:1;, + uint8_t eea2:1;, + uint8_t eea3:1;, + uint8_t eea4:1;, + uint8_t eea5:1;, + uint8_t eea6:1;, + uint8_t eea7:1;) }; - c_uint8_t eea; + uint8_t eea; }; union { struct { - ED8(c_uint8_t eia0:1;, - c_uint8_t eia1:1;, - c_uint8_t eia2:1;, - c_uint8_t eia3:1;, - c_uint8_t eia4:1;, - c_uint8_t eia5:1;, - c_uint8_t eia6:1;, - c_uint8_t eia7:1;) + ED8(uint8_t eia0:1;, + uint8_t eia1:1;, + uint8_t eia2:1;, + uint8_t eia3:1;, + uint8_t eia4:1;, + uint8_t eia5:1;, + uint8_t eia6:1;, + uint8_t eia7:1;) }; - c_uint8_t eia; + uint8_t eia; }; union { struct { - ED8(c_uint8_t uea0:1;, - c_uint8_t uea1:1;, - c_uint8_t uea2:1;, - c_uint8_t uea3:1;, - c_uint8_t uea4:1;, - c_uint8_t uea5:1;, - c_uint8_t uea6:1;, - c_uint8_t uea7:1;) + ED8(uint8_t uea0:1;, + uint8_t uea1:1;, + uint8_t uea2:1;, + uint8_t uea3:1;, + uint8_t uea4:1;, + uint8_t uea5:1;, + uint8_t uea6:1;, + uint8_t uea7:1;) }; - c_uint8_t uea; + uint8_t uea; }; union { struct { - ED8(c_uint8_t ucs2:1;, - c_uint8_t uia1:1;, - c_uint8_t uia2:1;, - c_uint8_t uia3:1;, - c_uint8_t uia4:1;, - c_uint8_t uia5:1;, - c_uint8_t uia6:1;, - c_uint8_t uia7:1;) + ED8(uint8_t ucs2:1;, + uint8_t uia1:1;, + uint8_t uia2:1;, + uint8_t uia3:1;, + uint8_t uia4:1;, + uint8_t uia5:1;, + uint8_t uia6:1;, + uint8_t uia7:1;) }; - c_uint8_t uia; + uint8_t uia; }; -ED8(c_uint8_t prose_dd:1;, - c_uint8_t prose:1;, - c_uint8_t h_245_ash:1;, - c_uint8_t acc_csfb:1;, - c_uint8_t lpp:1;, - c_uint8_t lcs:1;, - c_uint8_t srvcc:1;, - c_uint8_t nf:1;) -ED8(c_uint8_t epco:1;, - c_uint8_t hc_cp_ciot:1;, - c_uint8_t erw_opdn:1;, - c_uint8_t s1u_data:1;, - c_uint8_t up_ciot:1;, - c_uint8_t cp_ciot:1;, - c_uint8_t prose_relay:1;, - c_uint8_t prose_dc:1;) -ED2(c_uint8_t spare:7;, - c_uint8_t multiple_drb:1;) +ED8(uint8_t prose_dd:1;, + uint8_t prose:1;, + uint8_t h_245_ash:1;, + uint8_t acc_csfb:1;, + uint8_t lpp:1;, + uint8_t lcs:1;, + uint8_t srvcc:1;, + uint8_t nf:1;) +ED8(uint8_t epco:1;, + uint8_t hc_cp_ciot:1;, + uint8_t erw_opdn:1;, + uint8_t s1u_data:1;, + uint8_t up_ciot:1;, + uint8_t cp_ciot:1;, + uint8_t prose_relay:1;, + uint8_t prose_dc:1;) +ED2(uint8_t spare:7;, + uint8_t multiple_drb:1;) } __attribute__ ((packed)) nas_ue_network_capability_t; /* 9.9.3.35 UE radio capability information update needed * O TV 1 */ typedef struct _nas_ue_radio_capability_information_update_needed_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t update_needed:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t update_needed:1;) } __attribute__ ((packed)) nas_ue_radio_capability_information_update_needed_t; /* 9.9.3.36 UE security capability * M LV 3-6 */ typedef struct _nas_ue_security_capability_t { - c_uint8_t length; + uint8_t length; union { struct { - ED8(c_uint8_t eea0:1;, - c_uint8_t eea1:1;, - c_uint8_t eea2:1;, - c_uint8_t eea3:1;, - c_uint8_t eea4:1;, - c_uint8_t eea5:1;, - c_uint8_t eea6:1;, - c_uint8_t eea7:1;) + ED8(uint8_t eea0:1;, + uint8_t eea1:1;, + uint8_t eea2:1;, + uint8_t eea3:1;, + uint8_t eea4:1;, + uint8_t eea5:1;, + uint8_t eea6:1;, + uint8_t eea7:1;) }; - c_uint8_t eea; + uint8_t eea; }; union { struct { - ED8(c_uint8_t eia0:1;, - c_uint8_t eia1:1;, - c_uint8_t eia2:1;, - c_uint8_t eia3:1;, - c_uint8_t eia4:1;, - c_uint8_t eia5:1;, - c_uint8_t eia6:1;, - c_uint8_t eia7:1;) + ED8(uint8_t eia0:1;, + uint8_t eia1:1;, + uint8_t eia2:1;, + uint8_t eia3:1;, + uint8_t eia4:1;, + uint8_t eia5:1;, + uint8_t eia6:1;, + uint8_t eia7:1;) }; - c_uint8_t eia; + uint8_t eia; }; union { struct { - ED8(c_uint8_t uea0:1;, - c_uint8_t uea1:1;, - c_uint8_t uea2:1;, - c_uint8_t uea3:1;, - c_uint8_t uea4:1;, - c_uint8_t uea5:1;, - c_uint8_t uea6:1;, - c_uint8_t uea7:1;) + ED8(uint8_t uea0:1;, + uint8_t uea1:1;, + uint8_t uea2:1;, + uint8_t uea3:1;, + uint8_t uea4:1;, + uint8_t uea5:1;, + uint8_t uea6:1;, + uint8_t uea7:1;) }; - c_uint8_t uea; + uint8_t uea; }; union { struct { - ED8(c_uint8_t spare1:1;, - c_uint8_t uia1:1;, - c_uint8_t uia2:1;, - c_uint8_t uia3:1;, - c_uint8_t uia4:1;, - c_uint8_t uia5:1;, - c_uint8_t uia6:1;, - c_uint8_t uia7:1;) + ED8(uint8_t spare1:1;, + uint8_t uia1:1;, + uint8_t uia2:1;, + uint8_t uia3:1;, + uint8_t uia4:1;, + uint8_t uia5:1;, + uint8_t uia6:1;, + uint8_t uia7:1;) }; - c_uint8_t uia; + uint8_t uia; }; union { struct { - ED8(c_uint8_t spare2:1;, - c_uint8_t gea1:1;, - c_uint8_t gea2:1;, - c_uint8_t gea3:1;, - c_uint8_t gea4:1;, - c_uint8_t gea5:1;, - c_uint8_t gea6:1;, - c_uint8_t gea7:1;) + ED8(uint8_t spare2:1;, + uint8_t gea1:1;, + uint8_t gea2:1;, + uint8_t gea3:1;, + uint8_t gea4:1;, + uint8_t gea5:1;, + uint8_t gea6:1;, + uint8_t gea7:1;) }; - c_uint8_t gea; + uint8_t gea; }; } __attribute__ ((packed)) nas_ue_security_capability_t; @@ -964,8 +984,8 @@ typedef struct _nas_ue_security_capability_t { * O TLV 5-50 */ #define NAS_MAX_EMERGENCY_NUMBER_LIST_LEN 48 typedef struct _nas_emergency_number_list_t { - c_uint16_t length; - c_uint8_t buffer[NAS_MAX_EMERGENCY_NUMBER_LIST_LEN]; + uint16_t length; + uint8_t buffer[NAS_MAX_EMERGENCY_NUMBER_LIST_LEN]; } __attribute__ ((packed)) nas_emergency_number_list_t; /* 9.9.3.38 CLI @@ -975,124 +995,124 @@ typedef struct _nas_emergency_number_list_t { * defined in subclause 10.5.4.9 of 3GPP TS 24.008 [13]. */ #define NAX_MAX_CLI_LEN 12 typedef struct _nas_cli_t { - c_uint8_t length; - c_uint8_t buffer[NAX_MAX_CLI_LEN]; + uint8_t length; + uint8_t buffer[NAX_MAX_CLI_LEN]; } __attribute__ ((packed)) nas_cli_t; /* 9.9.3.39 SS Code * O TV 2 * The coding of the SS Code value is given in subclause 17.7.5 of * 3GPP TS 29.002 [15C] */ -typedef c_uint8_t nas_ss_code_t; +typedef uint8_t nas_ss_code_t; /* 9.9.3.40 LCS indicator * O TV 2 */ #define NAS_LCS_INDICATOR_MT_LR 1 -typedef c_uint8_t nas_lcs_indicator_t; +typedef uint8_t nas_lcs_indicator_t; /* 9.9.3.41 LCS client identity * O TLV 3-257 */ #define NAS_MAX_LCS_CLIENT_IDENTITY_LEN 255 typedef struct _nas_lcs_client_identity_t { - c_uint8_t length; - c_uint8_t buffer[NAS_MAX_LCS_CLIENT_IDENTITY_LEN]; + uint8_t length; + uint8_t buffer[NAS_MAX_LCS_CLIENT_IDENTITY_LEN]; } __attribute__ ((packed)) nas_lcs_client_identity_t; /* 9.9.3.42 Generic message container type * M V 1 */ #define NAS_GENERIC_MESSAGE_CONTAINER_TYPE_LTE_POSITIONING_PROTOCOL 1 #define NAS_GENERIC_MESSAGE_CONTAINER_TYPE_LTE_LOCATION_SERVICES_MESSAGE 2 -typedef c_uint8_t nas_generic_message_container_type_t; +typedef uint8_t nas_generic_message_container_type_t; /* 9.9.3.43 Generic message container * M LV-E 3-n */ typedef struct _nas_generic_message_container_t { - c_uint16_t length; - c_uint8_t *buffer; + uint16_t length; + uint8_t *buffer; } nas_generic_message_container_t; /* 9.9.3.44 Voice domain preference and UE's usage setting * See subclause 10.5.5.28 in 3GPP TS 24.008 [13]. * O TLV 3 */ typedef struct _nas_voice_domain_preference_and_ue_usage_setting_t { - c_uint8_t length; -ED3(c_uint8_t spare:5;, - c_uint8_t ue_usage_setting:1;, - c_uint8_t voice_domain_preference_for_e_utran:2;) + uint8_t length; +ED3(uint8_t spare:5;, + uint8_t ue_usage_setting:1;, + uint8_t voice_domain_preference_for_e_utran:2;) } __attribute__ ((packed)) nas_voice_domain_preference_and_ue_usage_setting_t; /* 9.9.3.45 GUTI type * O TV 1 */ typedef struct _nas_guti_type_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t guti_type:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t guti_type:1;) } __attribute__ ((packed)) nas_guti_type_t; /* 9.9.3.46 Extended DRX parameters * See subclause 10.5.5.32 in 3GPP TS 24.008 [13]. * O TLV 3 */ typedef struct _nas_extended_drx_parameters_t { - c_uint8_t length; -ED2(c_uint8_t paging_time_window:4;, - c_uint8_t e_drx_value:4;) + uint8_t length; +ED2(uint8_t paging_time_window:4;, + uint8_t e_drx_value:4;) } __attribute__ ((packed)) nas_extended_drx_parameters_t; /* 9.9.4.1 Access point name * See subclause 10.5.6.1 in 3GPP TS 24.008 [13]. * O TLV 3-102 */ typedef struct _nas_access_point_name_t { - c_uint8_t length; - c_int8_t apn[MAX_APN_LEN]; + uint8_t length; + char apn[MAX_APN_LEN]; } __attribute__ ((packed)) nas_access_point_name_t; /* 9.9.4.2 APN aggregate maximum bit rate * O TLV 4-8 */ typedef struct _nas_apn_aggregate_maximum_bit_rate_t { - c_uint8_t length; - c_uint8_t dl_apn_ambr; - c_uint8_t ul_apn_ambr; - c_uint8_t dl_apn_ambr_extended; - c_uint8_t ul_apn_ambr_extended; - c_uint8_t dl_apn_ambr_extended2; - c_uint8_t ul_apn_ambr_extended2; + uint8_t length; + uint8_t dl_apn_ambr; + uint8_t ul_apn_ambr; + uint8_t dl_apn_ambr_extended; + uint8_t ul_apn_ambr_extended; + uint8_t dl_apn_ambr_extended2; + uint8_t ul_apn_ambr_extended2; } __attribute__ ((packed)) nas_apn_aggregate_maximum_bit_rate_t; -CORE_DECLARE(void) apn_ambr_build( +void apn_ambr_build( nas_apn_aggregate_maximum_bit_rate_t * apn_aggregate_maximum_bit_rate, - c_uint32_t dl_ambr, c_uint32_t ul_ambr); + uint32_t dl_ambr, uint32_t ul_ambr); /* 9.9.4.2A Connectivity type * See subclause 10.5.6.19 in 3GPP TS 24.008 [13]. * O TV 1 */ typedef struct _nas_connectivity_type_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t considered_lipa_pdn_connection:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t considered_lipa_pdn_connection:1;) } __attribute__ ((packed)) nas_connectivity_type_t; /* 9.9.4.3 EPS quality of service * M LV 2-14 */ typedef struct _nas_eps_quality_of_service_t { - c_uint8_t length; - c_uint8_t qci; - c_uint8_t ul_mbr; - c_uint8_t dl_mbr; - c_uint8_t ul_gbr; - c_uint8_t dl_gbr; - c_uint8_t ul_mbr_extended; - c_uint8_t dl_mbr_extended; - c_uint8_t ul_gbr_extended; - c_uint8_t dl_gbr_extended; - c_uint8_t ul_mbr_extended2; - c_uint8_t dl_mbr_extended2; - c_uint8_t ul_gbr_extended2; - c_uint8_t dl_gbr_extended2; + uint8_t length; + uint8_t qci; + uint8_t ul_mbr; + uint8_t dl_mbr; + uint8_t ul_gbr; + uint8_t dl_gbr; + uint8_t ul_mbr_extended; + uint8_t dl_mbr_extended; + uint8_t ul_gbr_extended; + uint8_t dl_gbr_extended; + uint8_t ul_mbr_extended2; + uint8_t dl_mbr_extended2; + uint8_t ul_gbr_extended2; + uint8_t dl_gbr_extended2; } nas_eps_quality_of_service_t; -CORE_DECLARE(void) eps_qos_build(nas_eps_quality_of_service_t *eps_qos, - c_uint8_t qci, - c_uint64_t dl_mbr, c_uint64_t ul_mbr, c_uint64_t dl_gbr, c_uint64_t ul_gbr); +void eps_qos_build(nas_eps_quality_of_service_t *eps_qos, + uint8_t qci, + uint64_t dl_mbr, uint64_t ul_mbr, uint64_t dl_gbr, uint64_t ul_gbr); /* 9.9.4.4 ESM cause * M V 1 @@ -1145,27 +1165,27 @@ CORE_DECLARE(void) eps_qos_build(nas_eps_quality_of_service_t *eps_qos, #define ESM_CAUSE_CONDITIONAL_IE_ERROR 100 #define ESM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 101 #define ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 -typedef c_uint8_t nas_esm_cause_t; +typedef uint8_t nas_esm_cause_t; /* 9.9.4.5 ESM information transfer flag * O TV 1 */ typedef struct _nas_esm_information_transfer_flag_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t security_protected_required:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t security_protected_required:1;) } __attribute__ ((packed)) nas_esm_information_transfer_flag_t; /* 9.9.4.6 Linked EPS bearer identity * M V 1/2 */ typedef struct _nas_linked_eps_bearer_identity_t { -ED2(c_uint8_t spare:4;, - c_uint8_t eps_bearer_identity:4;) +ED2(uint8_t spare:4;, + uint8_t eps_bearer_identity:4;) } __attribute__ ((packed)) nas_linked_eps_bearer_identity_t; /* 9.9.4.7 LLC service access point identifier * See subclause 10.5.6.9 in 3GPP TS 24.008 [13]. * O TV 2 */ -typedef c_uint8_t nas_llc_service_access_point_identifier_t; +typedef uint8_t nas_llc_service_access_point_identifier_t; /* 9.9.4.8 Packet flow Identifier * See subclause 10.5.6.11 in 3GPP TS 24.008 [13]. @@ -1177,18 +1197,18 @@ typedef c_uint8_t nas_llc_service_access_point_identifier_t; #define NAS_PACKET_FLOW_IDENTIFIER_DYNAMIC_ASSIGN_MIN 8 #define NAS_PACKET_FLOW_IDENTIFIER_DYNAMIC_ASSIGN_MAX 0xef typedef struct _nas_packet_flow_identifier_t { - c_uint8_t length; -ED2(c_uint8_t spare:1;, - c_uint8_t value:7;) + uint8_t length; +ED2(uint8_t spare:1;, + uint8_t value:7;) } __attribute__ ((packed)) nas_packet_flow_identifier_t; /* 9.9.4.13 Radio priority * See subclause 10.5.7.2 in 3GPP TS 24.008 [13]. * O TV 1 */ typedef struct _nas_radio_priority_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:1;, - c_uint8_t value:3;) +ED3(uint8_t type:4;, + uint8_t spare:1;, + uint8_t value:3;) } __attribute__ ((packed)) nas_radio_priority_t; /* 9.9.4.9 PDN address @@ -1197,17 +1217,17 @@ ED3(c_uint8_t type:4;, #define NAS_PDN_ADDRESS_IPV6_LEN 9 #define NAS_PDN_ADDRESS_IPV4V6_LEN 13 typedef struct _nas_pdn_address_t { - c_uint8_t length; -ED2(c_uint8_t reserved:5;, - c_uint8_t pdn_type:3;) + uint8_t length; +ED2(uint8_t reserved:5;, + uint8_t pdn_type:3;) union { - c_uint32_t addr; + uint32_t addr; struct { - c_uint8_t addr6[IPV6_LEN>>1]; /* Interface Identifer Only */ + uint8_t addr6[IPV6_LEN>>1]; /* Interface Identifer Only */ }; struct { - c_uint8_t addr6[IPV6_LEN>>1]; /* Interface Identifer Only */ - c_uint32_t addr; + uint8_t addr6[IPV6_LEN>>1]; /* Interface Identifer Only */ + uint32_t addr; } both; }; } __attribute__ ((packed)) nas_pdn_address_t; @@ -1216,8 +1236,8 @@ ED2(c_uint8_t reserved:5;, * See subclause 10.5.6.3 in 3GPP TS 24.008 [13]. * O TLV 3-253 */ typedef struct _nas_protocol_configuration_options_t { - c_uint8_t length; - c_uint8_t buffer[MAX_PCO_LEN]; + uint8_t length; + uint8_t buffer[MAX_PCO_LEN]; } __attribute__ ((packed)) nas_protocol_configuration_options_t; /* 9.9.4.12 Quality of service @@ -1225,17 +1245,17 @@ typedef struct _nas_protocol_configuration_options_t { * O TLV 14-22 */ #define NAS_QOS_LEN 20 typedef struct _nas_quality_of_service_t { - c_uint8_t length; - c_uint8_t buffer[NAS_QOS_LEN]; + uint8_t length; + uint8_t buffer[NAS_QOS_LEN]; } __attribute__ ((packed)) nas_quality_of_service_t; /* 9.9.4.13A Re-attempt indicator * O TLV 3 */ typedef struct _nas_re_attempt_indicator_t { - c_uint8_t length; -ED3(c_uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */ - c_uint8_t eplmnc:1;, /* allowed in an equivalent PLMN */ - c_uint8_t ratc:1;) + uint8_t length; +ED3(uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */ + uint8_t eplmnc:1;, /* allowed in an equivalent PLMN */ + uint8_t ratc:1;) } __attribute__ ((packed)) nas_re_attempt_indicator_t; /* 9.9.4.14 Request type @@ -1251,10 +1271,10 @@ ED3(c_uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */ #define NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV4V6 3 #define NAS_PDN_CONNECTIVITY_PDN_TYPE_NON_IP 5 typedef struct _nas_request_type_t { -ED4(c_uint8_t spare1:1;, - c_uint8_t pdn_type:3;, - c_uint8_t spare2:1;, - c_uint8_t request_type:3;) +ED4(uint8_t spare1:1;, + uint8_t pdn_type:3;, + uint8_t spare2:1;, + uint8_t request_type:3;) } __attribute__ ((packed)) nas_request_type_t; /* 9.9.4.15 Traffic flow aggregate description @@ -1262,8 +1282,8 @@ ED4(c_uint8_t spare1:1;, * M LV 2-256 */ #define NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION 255 typedef struct _nas_traffic_flow_aggregate_description_t { - c_uint8_t length; - c_uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION]; + uint8_t length; + uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION]; } __attribute__ ((packed)) nas_traffic_flow_aggregate_description_t; /* 9.9.4.16 Traffic flow template @@ -1271,26 +1291,26 @@ typedef struct _nas_traffic_flow_aggregate_description_t { * M LV 2-256 */ #define NAS_MAX_TRAFFIC_FLOW_TEMPLATE 255 typedef struct _nas_traffic_flow_template_t { - c_uint8_t length; - c_uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_TEMPLATE]; + uint8_t length; + uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_TEMPLATE]; } __attribute__ ((packed)) nas_traffic_flow_template_t; /* 9.9.4.17 Transaction identifier * 3GPP TS 24.008 [13], subclause 10.5.6.7. * O TLV 3-4 */ typedef struct _nas_transaction_identifier_t { - c_uint8_t length; - c_uint16_t linked_ti; + uint8_t length; + uint16_t linked_ti; } __attribute__ ((packed)) nas_transaction_identifier_t; /* 9.9.4.18 WLAN offload acceptability * 3GPP TS 24.008 [13], subclause 10.5.6.20 * O TV 1 */ typedef struct _nas_wlan_offload_acceptability_t { -ED4(c_uint8_t type:4;, - c_uint8_t spare:2;, - c_uint8_t utran_via_wlan_acceptable:1;, - c_uint8_t e_utran_via_wlan_acceptable:1;) +ED4(uint8_t type:4;, + uint8_t spare:2;, + uint8_t utran_via_wlan_acceptable:1;, + uint8_t e_utran_via_wlan_acceptable:1;) } __attribute__ ((packed)) nas_wlan_offload_acceptability_t; /* 9.9.4.19 NBIFOM container @@ -1298,24 +1318,24 @@ ED4(c_uint8_t type:4;, * O TLV 3-257 */ #define MAX_NAS_NBIFOM_CONTAINER_LEN 255 typedef struct _nas_nbifom_container_t { - c_uint8_t length; - c_uint8_t buffer[MAX_NAS_NBIFOM_CONTAINER_LEN]; + uint8_t length; + uint8_t buffer[MAX_NAS_NBIFOM_CONTAINER_LEN]; } __attribute__ ((packed)) nas_nbifom_container_t; /* 9.9.4.22 Header compression configuration * O TLV 5-257 */ #define MAX_NAS_HEADER_COMPRESSION_CONTAINER_LEN 251 typedef struct _nas_header_compression_configuration_t { - c_uint8_t length; -ED8(c_uint8_t spare:1;, - c_uint8_t profile0x0104:1;, - c_uint8_t profile0x0103:1;, - c_uint8_t profile0x0102:1;, - c_uint8_t profile0x0006:1;, - c_uint8_t profile0x0004:1;, - c_uint8_t profile0x0003:1;, - c_uint8_t profile0x0002:1;) - c_uint16_t max_cid; + uint8_t length; +ED8(uint8_t spare:1;, + uint8_t profile0x0104:1;, + uint8_t profile0x0103:1;, + uint8_t profile0x0102:1;, + uint8_t profile0x0006:1;, + uint8_t profile0x0004:1;, + uint8_t profile0x0003:1;, + uint8_t profile0x0002:1;) + uint16_t max_cid; #define NAS_HEADER_COMPRESSION_NO_COMPRESSION 0 #define NAS_HEADER_COMPRESSION_PROFILE_0x0002_UDP_IP 1 #define NAS_HEADER_COMPRESSION_PROFILE_0x0003_ESP_IP 2 @@ -1324,52 +1344,52 @@ ED8(c_uint8_t spare:1;, #define NAS_HEADER_COMPRESSION_PROFILE_0x0102_UDP_IP 5 #define NAS_HEADER_COMPRESSION_PROFILE_0x0103_ESP_IP 6 #define NAS_HEADER_COMPRESSION_PROFILE_0x0104_IP 7 - c_uint8_t type; - c_uint8_t container[MAX_NAS_NBIFOM_CONTAINER_LEN]; + uint8_t type; + uint8_t container[MAX_NAS_NBIFOM_CONTAINER_LEN]; } __attribute__ ((packed)) nas_header_compression_configuration_t; /* 9.9.4.23 Control plane only indication * O TV 1 */ typedef struct _nas_control_plane_only_indication_t { -ED3(c_uint8_t type:4;, - c_uint8_t spare:3;, - c_uint8_t ciot_eps_optimization:1;) +ED3(uint8_t type:4;, + uint8_t spare:3;, + uint8_t ciot_eps_optimization:1;) } __attribute__ ((packed)) nas_control_plane_only_indication_t; /* 9.9.4.26 Extended protocol configuration options * O TLV-E 4-65538 */ typedef struct _nas_extended_protocol_configuration_options_t { - c_uint16_t length; - c_uint8_t *buffer; + uint16_t length; + uint8_t *buffer; } __attribute__ ((packed)) nas_extended_protocol_configuration_options_t; /* 9.9.4.27 Header compression configuration status * O TLV 4 */ typedef struct _nas_header_compression_configuration_status_t { - c_uint8_t length; - c_uint16_t value; + uint8_t length; + uint16_t value; } __attribute__ ((packed)) nas_header_compression_configuration_status_t; /* 9.9.4.28 Serving PLMN rate control * O TLV 4 */ typedef struct _nas_serving_plmn_rate_control_t { - c_uint8_t length; -ED8(c_uint8_t ebi7:1;, - c_uint8_t ebi6:1;, - c_uint8_t ebi5:1;, - c_uint8_t ebi4:1;, - c_uint8_t ebi3:1;, - c_uint8_t ebi2:1;, - c_uint8_t ebi1:1;, - c_uint8_t ebi0:1;) -ED8(c_uint8_t ebi15:1;, - c_uint8_t ebi14:1;, - c_uint8_t ebi13:1;, - c_uint8_t ebi12:1;, - c_uint8_t ebi11:1;, - c_uint8_t ebi10:1;, - c_uint8_t ebi9:1;, - c_uint8_t ebi8:1;) + uint8_t length; +ED8(uint8_t ebi7:1;, + uint8_t ebi6:1;, + uint8_t ebi5:1;, + uint8_t ebi4:1;, + uint8_t ebi3:1;, + uint8_t ebi2:1;, + uint8_t ebi1:1;, + uint8_t ebi0:1;) +ED8(uint8_t ebi15:1;, + uint8_t ebi14:1;, + uint8_t ebi13:1;, + uint8_t ebi12:1;, + uint8_t ebi11:1;, + uint8_t ebi10:1;, + uint8_t ebi9:1;, + uint8_t ebi8:1;) } __attribute__ ((packed)) nas_serving_plmn_rate_control_t; #ifdef __cplusplus diff --git a/lib/nas/support/nas_message.py b/lib/nas/support/nas_message.py index fcba3259e..f5b91534d 100644 --- a/lib/nas/support/nas_message.py +++ b/lib/nas/support/nas_message.py @@ -1,27 +1,20 @@ +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# Copyright (c) 2017, NextEPC Group -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + from docx import Document import re, os, sys, string import datetime @@ -61,28 +54,22 @@ def write_file(f, string): def output_header_to_file(f): now = datetime.datetime.now() f.write("""/* - * Copyright (c) 2017, NextEPC Group - * All rights reserved. + * Copyright (C) 2019 by Sukchan Lee * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ """) @@ -346,23 +333,22 @@ output_header_to_file(f) f.write("""#ifndef __NAS_IES_H__ #define __NAS_IES_H__ -#include "core_pkbuf.h" #include "nas_types.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(c_int16_t) nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type); +int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type); """) for (k, v) in sorted_type_list: - f.write("CORE_DECLARE(c_int16_t) nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf);\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_decode_%s(nas_%s_t *%s, ogs_pkbuf_t *pkbuf);\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("\n") for (k, v) in sorted_type_list: - f.write("CORE_DECLARE(c_int16_t) nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s);\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_encode_%s(ogs_pkbuf_t *pkbuf, nas_%s_t *%s);\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("\n") @@ -377,18 +363,17 @@ f.close() f = open(outdir + 'nas_ies.c', 'w') output_header_to_file(f) -f.write("""#define TRACE_MODULE _nas_ies +f.write("""#include "nas_ies.h" -#include "core_debug.h" -#include "core_lib.h" -#include "nas_ies.h" +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain -c_int16_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type) +int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type) { - c_uint16_t size = sizeof(c_uint8_t); + uint16_t size = sizeof(uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); - memcpy(pkbuf->payload - size, &type, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(pkbuf->data - size, &type, size); return size; } @@ -399,109 +384,109 @@ for (k, v) in sorted_type_list: f.write("/* %s %s\n" % (type_list[k]["reference"], k)) f.write(" * %s %s %s */\n" % (type_list[k]["presence"], type_list[k]["format"], type_list[k]["length"])) if type_list[k]["format"] == "TV" and type_list[k]["length"] == "1": - f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_decode_%s(nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") - f.write(" memcpy(%s, pkbuf->payload - 1, 1);\n\n" % v_lower(k)) - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - 1, 1);\n\n"); + f.write(" memcpy(%s, pkbuf->data - 1, 1);\n\n" % v_lower(k)) + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);\n\n"); f.write(" return 0;\n") f.write("}\n\n") - f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_encode_%s(ogs_pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") - f.write(" c_uint16_t size = sizeof(nas_%s_t);\n\n" % v_lower(k)) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" memcpy(pkbuf->payload - size, %s, size);\n\n" % v_lower(k)) - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - size, size);\n\n"); + f.write(" uint16_t size = sizeof(nas_%s_t);\n\n" % v_lower(k)) + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" memcpy(pkbuf->data - size, %s, size);\n\n" % v_lower(k)) + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return size;\n") f.write("}\n\n") elif type_list[k]["format"] == "TV" or type_list[k]["format"] == "V": - f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_decode_%s(nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") if type_list[k]["length"] == "4": - f.write(" c_uint16_t size = 3;\n\n") + f.write(" uint16_t size = 3;\n\n") else: - f.write(" c_uint16_t size = sizeof(nas_%s_t);\n\n" % v_lower(k)) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" memcpy(%s, pkbuf->payload - size, size);\n\n" % v_lower(k)) + f.write(" uint16_t size = sizeof(nas_%s_t);\n\n" % v_lower(k)) + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % v_lower(k)) if "decode" in type_list[k]: f.write("%s" % type_list[k]["decode"]) - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - size, size);\n\n"); + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return size;\n") f.write("}\n\n") - f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_encode_%s(ogs_pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") if type_list[k]["length"] == "4": - f.write(" c_uint16_t size = 3;\n") + f.write(" uint16_t size = 3;\n") else: - f.write(" c_uint16_t size = sizeof(nas_%s_t);\n" % v_lower(k)) + f.write(" uint16_t size = sizeof(nas_%s_t);\n" % v_lower(k)) f.write(" nas_%s_t target;\n\n" % v_lower(k)) f.write(" memcpy(&target, %s, size);\n" % v_lower(k)) if "encode" in type_list[k]: f.write("%s" % type_list[k]["encode"]) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" memcpy(pkbuf->payload - size, &target, size);\n\n") - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - size, size);\n\n"); + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" memcpy(pkbuf->data - size, &target, size);\n\n") + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return size;\n") f.write("}\n\n") elif type_list[k]["format"] == "LV-E" or type_list[k]["format"] == "TLV-E": - f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_decode_%s(nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") - f.write(" c_uint16_t size = 0;\n") - f.write(" nas_%s_t *source = pkbuf->payload;\n\n" % v_lower(k)) + f.write(" uint16_t size = 0;\n") + f.write(" nas_%s_t *source = pkbuf->data;\n\n" % v_lower(k)) f.write(" %s->length = ntohs(source->length);\n" % v_lower(k)) f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k))) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" %s->buffer = pkbuf->payload - size + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k))) - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, %s->buffer, %s->length);\n\n" % (v_lower(k), v_lower(k))); + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" %s->buffer = pkbuf->data - size + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k))) + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, (void*)%s->buffer, %s->length);\n\n" % (v_lower(k), v_lower(k))); f.write(" return size;\n") f.write("}\n\n") - f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_encode_%s(ogs_pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") - f.write(" c_uint16_t size = 0;\n") - f.write(" c_uint16_t target;\n\n") - f.write(" d_assert(%s, return -1, \"Null param\");\n" % v_lower(k)) - f.write(" d_assert(%s->buffer, return -1, \"Null param\");\n\n" % v_lower(k)) + f.write(" uint16_t size = 0;\n") + f.write(" uint16_t target;\n\n") + f.write(" ogs_assert(%s);\n" % v_lower(k)) + f.write(" ogs_assert(%s->buffer);\n\n" % v_lower(k)) f.write(" size = sizeof(%s->length);\n" % v_lower(k)) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") f.write(" target = htons(%s->length);\n" % v_lower(k)) - f.write(" memcpy(pkbuf->payload - size, &target, size);\n\n") + f.write(" memcpy(pkbuf->data - size, &target, size);\n\n") f.write(" size = %s->length;\n" % v_lower(k)) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" memcpy(pkbuf->payload - size, %s->buffer, size);\n\n" % v_lower(k)) - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - size, size);\n\n"); + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" memcpy(pkbuf->data - size, %s->buffer, size);\n\n" % v_lower(k)) + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return %s->length + sizeof(%s->length);\n" % (v_lower(k), v_lower(k))) f.write("}\n\n"); else: - f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_decode_%s(nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") - f.write(" c_uint16_t size = 0;\n") - f.write(" nas_%s_t *source = pkbuf->payload;\n\n" % v_lower(k)) + f.write(" uint16_t size = 0;\n") + f.write(" nas_%s_t *source = pkbuf->data;\n\n" % v_lower(k)) f.write(" %s->length = source->length;\n" % v_lower(k)) f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k))) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" memcpy(%s, pkbuf->payload - size, size);\n\n" % v_lower(k)) + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % v_lower(k)) if "decode" in type_list[k]: f.write("%s" % type_list[k]["decode"]) - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - size, size);\n\n"); + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return size;\n") f.write("}\n\n") - f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) + f.write("int nas_encode_%s(ogs_pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k))) f.write("{\n") - f.write(" c_uint16_t size = %s->length + sizeof(%s->length);\n" % (v_lower(k), v_lower(k))) + f.write(" uint16_t size = %s->length + sizeof(%s->length);\n" % (v_lower(k), v_lower(k))) f.write(" nas_%s_t target;\n\n" % v_lower(k)) f.write(" memcpy(&target, %s, sizeof(nas_%s_t));\n" % (v_lower(k), v_lower(k))) if "encode" in type_list[k]: f.write("%s" % type_list[k]["encode"]) - f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n") - f.write(" memcpy(pkbuf->payload - size, &target, size);\n\n") - f.write(" d_trace(25, \" %s - \");\n" % v_upper(k)) - f.write(" d_trace_hex(25, pkbuf->payload - size, size);\n\n"); + f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n") + f.write(" memcpy(pkbuf->data - size, &target, size);\n\n") + f.write(" ogs_trace(\" %s - \");\n" % v_upper(k)) + f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n"); f.write(" return size;\n") f.write("}\n\n"); f.close() @@ -517,7 +502,7 @@ f.write("""#ifndef __NAS_MESSAGE_H__ extern "C" { #endif /* __cplusplus */ -/* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. +/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ #define NAS_HEADROOM 16 @@ -536,23 +521,23 @@ extern "C" { #define NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0 typedef struct _nas_emm_header_t { -ED2(c_uint8_t security_header_type:4;, - c_uint8_t protocol_discriminator:4;) - c_uint8_t message_type; +ED2(uint8_t security_header_type:4;, + uint8_t protocol_discriminator:4;) + uint8_t message_type; } __attribute__ ((packed)) nas_emm_header_t; typedef struct _nas_esm_header_t { -ED2(c_uint8_t eps_bearer_identity:4;, - c_uint8_t protocol_discriminator:4;) - c_uint8_t procedure_transaction_identity; - c_uint8_t message_type; +ED2(uint8_t eps_bearer_identity:4;, + uint8_t protocol_discriminator:4;) + uint8_t procedure_transaction_identity; + uint8_t message_type; } __attribute__ ((packed)) nas_esm_header_t; typedef struct _nas_security_header_t { -ED2(c_uint8_t security_header_type:4;, - c_uint8_t protocol_discriminator:4;) - c_uint32_t message_authentication_code; - c_uint8_t sequence_number; +ED2(uint8_t security_header_type:4;, + uint8_t protocol_discriminator:4;) + uint32_t message_authentication_code; + uint8_t sequence_number; } __attribute__ ((packed)) nas_security_header_t; """) @@ -589,7 +574,7 @@ for (k, v) in sorted_msg_list: if ie["presence"] == "O" and optional_fields is False: f.write("\n /* Optional fields */\n") - f.write(" c_uint32_t presencemask;\n"); + f.write(" uint32_t presencemask;\n"); optional_fields = True; f.write(" nas_" + v_lower(ie["type"]) + "_t " + \ @@ -636,10 +621,10 @@ typedef struct _nas_message_t { }; } nas_message_t; -CORE_DECLARE(status_t) nas_emm_decode(nas_message_t *message, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) nas_esm_decode(nas_message_t *message, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) nas_plain_encode( - pkbuf_t **pkbuf, nas_message_t *message); +int nas_emm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf); +int nas_esm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf); +int nas_plain_encode( + ogs_pkbuf_t **pkbuf, nas_message_t *message); #ifdef __cplusplus } @@ -654,10 +639,10 @@ f.close() f = open(outdir + 'nas_decoder.c', 'w') output_header_to_file(f) -f.write("""#define TRACE_MODULE _nas_decoder +f.write("""#include "nas_message.h" -#include "core_debug.h" -#include "nas_message.h" +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain """) @@ -667,18 +652,18 @@ for (k, v) in sorted_msg_list: if len(msg_list[k]["ies"]) == 0: continue - f.write("c_int32_t nas_decode_%s(nas_message_t *message, pkbuf_t *pkbuf)\n{\n" % v_lower(k)) + f.write("int nas_decode_%s(nas_message_t *message, ogs_pkbuf_t *pkbuf)\n{\n" % v_lower(k)) if float(msg_list[k]["type"]) < 192: f.write(" nas_%s_t *%s = &message->emm.%s;\n" % (v_lower(k), v_lower(k), v_lower(k))) else: f.write(" nas_%s_t *%s = &message->esm.%s;\n" % (v_lower(k), v_lower(k), v_lower(k))) - f.write(" c_int32_t decoded = 0;\n") - f.write(" c_int32_t size = 0;\n\n") - f.write(" d_trace(25, \"[NAS] Decode %s\\n\");\n\n" % v_upper(k)) + f.write(" int decoded = 0;\n") + f.write(" int size = 0;\n\n") + f.write(" ogs_trace(\"[NAS] Decode %s\\n\");\n\n" % v_upper(k)) for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]: f.write(" size = nas_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), v_lower(k), v_lower(ie["value"]))) - f.write(" d_assert(size >= 0, return -1, \"decode failed\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" decoded += size;\n\n") optional_fields = False; @@ -686,12 +671,11 @@ for (k, v) in sorted_msg_list: if optional_fields is False: f.write(""" while(pkbuf->len > 0) { - c_uint8_t *buffer = pkbuf->payload; - c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); + uint8_t *buffer = pkbuf->data; + uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer); - size = sizeof(c_uint8_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, - "pkbuf_header error"); + size = sizeof(uint8_t); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); decoded += size; switch(type) @@ -701,14 +685,14 @@ for (k, v) in sorted_msg_list: f.write(" case NAS_%s_%s_TYPE:\n" % (v_upper(k), v_upper(ie["value"]))) f.write(" size = nas_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), v_lower(k), v_lower(ie["value"]))) - f.write(" d_assert(size >= 0, return -1, \"decode failed\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" %s->presencemask |= NAS_%s_%s_PRESENT;\n" % (v_lower(k), v_upper(k), v_upper(ie["value"]))) f.write(" decoded += size;\n") f.write(" break;\n") if [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]: f.write(""" default: - d_warn("Unknown type(0x%x) or not implemented\\n", type); + ogs_warn("Unknown type(0x%x) or not implemented\\n", type); break; } } @@ -719,31 +703,29 @@ for (k, v) in sorted_msg_list: """) -f.write("""status_t nas_emm_decode(nas_message_t *message, pkbuf_t *pkbuf) +f.write("""int nas_emm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf) { - status_t rv = CORE_ERROR; - c_uint16_t size = 0; - c_uint16_t decoded = 0; + uint16_t size = 0; + uint16_t decoded = 0; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); memset(message, 0, sizeof(nas_message_t)); size = sizeof(nas_emm_header_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); - memcpy(&message->emm.h, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(&message->emm.h, pkbuf->data - size, size); decoded += size; if (message->emm.h.security_header_type >= NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { - d_assert(pkbuf_header(pkbuf, 1) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(pkbuf, 1)); decoded -= 1; size = nas_decode_service_request(message, pkbuf); - d_assert(size >= CORE_OK, return CORE_ERROR, "decode error"); + ogs_assert(size >= OGS_OK); decoded += size; goto out; @@ -759,39 +741,37 @@ for (k, v) in sorted_msg_list: f.write(" case NAS_%s:\n" % v_upper(k)) if len(msg_list[k]["ies"]) != 0: f.write(" size = nas_decode_%s(message, pkbuf);\n" % v_lower(k)) - f.write(" d_assert(size >= CORE_OK, return CORE_ERROR, \"decode error\");\n") + f.write(" ogs_assert(size >= OGS_OK);\n") f.write(" decoded += size;\n") f.write(" break;\n") f.write(""" default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->emm.h.message_type); break; } out: - rv = pkbuf_header(pkbuf, decoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(pkbuf, decoded)); - return CORE_OK; + return OGS_OK; } """) -f.write("""status_t nas_esm_decode(nas_message_t *message, pkbuf_t *pkbuf) +f.write("""int nas_esm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf) { - status_t rv = CORE_ERROR; - c_uint16_t size = 0; - c_uint16_t decoded = 0; + uint16_t size = 0; + uint16_t decoded = 0; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); memset(message, 0, sizeof(nas_message_t)); size = sizeof(nas_esm_header_t); - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); - memcpy(&message->esm.h, pkbuf->payload - size, size); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); + memcpy(&message->esm.h, pkbuf->data - size, size); decoded += size; switch(message->esm.h.message_type) @@ -804,37 +784,36 @@ for (k, v) in sorted_msg_list: f.write(" case NAS_%s:\n" % v_upper(k)) if len(msg_list[k]["ies"]) != 0: f.write(" size = nas_decode_%s(message, pkbuf);\n" % v_lower(k)) - f.write(" d_assert(size >= CORE_OK, return CORE_ERROR, \"decode error\");\n") + f.write(" ogs_assert(size >= OGS_OK);\n") f.write(" decoded += size;\n") f.write(" break;\n") f.write(""" default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->esm.h.message_type); break; } - rv = pkbuf_header(pkbuf, decoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(pkbuf, decoded)); - return CORE_OK; + return OGS_OK; } #if 0 /* deprecated */ -status_t nas_plain_decode(nas_message_t *message, pkbuf_t *pkbuf) +int nas_plain_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf) { nas_security_header_t *h = NULL; - d_assert(pkbuf, return CORE_ERROR, "Null param"); - h = pkbuf->payload; - d_assert(h, return CORE_ERROR, "Null param"); + ogs_assert(pkbuf); + h = pkbuf->data; + ogs_assert(h); if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM) return nas_emm_decode(message, pkbuf); else if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_ESM) return nas_esm_decode(message, pkbuf); - d_assert(0, return CORE_ERROR, + ogs_assert_if_reached(); "Invalid Protocol : %d", h->protocol_discriminator); } #endif @@ -844,11 +823,11 @@ f.close() f = open(outdir + 'nas_encoder.c', 'w') output_header_to_file(f) -f.write("""#define TRACE_MODULE _nas_encoder - -#include "core_debug.h" -#include "nas_message.h" +f.write("""#include "nas_message.h" +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __base_nas_domain + """) for (k, v) in sorted_msg_list: @@ -857,18 +836,18 @@ for (k, v) in sorted_msg_list: if len(msg_list[k]["ies"]) == 0: continue - f.write("c_int32_t nas_encode_%s(pkbuf_t *pkbuf, nas_message_t *message)\n{\n" % v_lower(k)) + f.write("int nas_encode_%s(ogs_pkbuf_t *pkbuf, nas_message_t *message)\n{\n" % v_lower(k)) if float(msg_list[k]["type"]) < 192: f.write(" nas_%s_t *%s = &message->emm.%s;\n" % (v_lower(k), v_lower(k), v_lower(k))) else: f.write(" nas_%s_t *%s = &message->esm.%s;\n" % (v_lower(k), v_lower(k), v_lower(k))) - f.write(" c_int32_t encoded = 0;\n") - f.write(" c_int32_t size = 0;\n\n") - f.write(" d_trace(25, \"[NAS] Encode %s\\n\");\n\n" % v_upper(k)) + f.write(" int encoded = 0;\n") + f.write(" int size = 0;\n\n") + f.write(" ogs_trace(\"[NAS] Encode %s\");\n\n" % v_upper(k)) for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]: f.write(" size = nas_encode_%s(pkbuf, &%s->%s);\n" % (v_lower(ie["type"]), v_lower(k), v_lower(ie["value"]))) - f.write(" d_assert(size >= 0, return -1, \"encode failed\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" encoded += size;\n\n") for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]: @@ -878,10 +857,10 @@ for (k, v) in sorted_msg_list: f.write(" %s->%s.type = (NAS_%s_%s_TYPE >> 4);\n\n" % (v_lower(k), v_lower(ie["value"]), v_upper(k), v_upper(ie["value"]))) else: f.write(" size = nas_encode_optional_type(pkbuf, NAS_%s_%s_TYPE);\n" % (v_upper(k), v_upper(ie["value"]))) - f.write(" d_assert(size >= 0, return encoded, \"decode failed\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" encoded += size;\n\n") f.write(" size = nas_encode_%s(pkbuf, &%s->%s);\n" % (v_lower(ie["type"]), v_lower(k), v_lower(ie["value"]))) - f.write(" d_assert(size >= 0, return encoded, \"decode failed\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" encoded += size;\n") f.write(" }\n\n") @@ -891,34 +870,33 @@ for (k, v) in sorted_msg_list: """) -f.write("""status_t nas_emm_encode(pkbuf_t **pkbuf, nas_message_t *message) +f.write("""int nas_emm_encode(ogs_pkbuf_t **pkbuf, nas_message_t *message) { - status_t rv = CORE_ERROR; - c_int32_t size = 0; - c_int32_t encoded = 0; + int size = 0; + int encoded = 0; - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(message); - /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. + /* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ - *pkbuf = pkbuf_alloc(NAS_HEADROOM, MAX_SDU_LEN); - d_assert(*pkbuf, return -1, "Null Param"); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(*pkbuf); + ogs_pkbuf_reserve(*pkbuf, NAS_HEADROOM); + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN-NAS_HEADROOM); size = sizeof(nas_emm_header_t); - rv = pkbuf_header(*pkbuf, -size); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(*pkbuf, size)); - memcpy((*pkbuf)->payload - size, &message->emm.h, size); + memcpy((*pkbuf)->data - size, &message->emm.h, size); encoded += size; if (message->emm.h.security_header_type >= NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { - d_assert(pkbuf_header(*pkbuf, 1) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(*pkbuf, 1)); encoded -= 1; size = nas_encode_service_request(*pkbuf, message); - d_assert(size >= 0, return CORE_ERROR, "decode error"); + ogs_assert(size >= 0); encoded += size; goto out; @@ -935,46 +913,44 @@ for (k, v) in sorted_msg_list: f.write(" case NAS_%s:\n" % v_upper(k)) if len(msg_list[k]["ies"]) != 0: f.write(" size = nas_encode_%s(*pkbuf, message);\n" % v_lower(k)) - f.write(" d_assert(size >= 0, return CORE_ERROR, \"decode error\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" encoded += size;\n") f.write(" break;\n") f.write(""" default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->emm.h.message_type); - pkbuf_free((*pkbuf)); - return CORE_ERROR; + ogs_pkbuf_free((*pkbuf)); + return OGS_ERROR; } out: - rv = pkbuf_header(*pkbuf, encoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_push(*pkbuf, encoded)); (*pkbuf)->len = encoded; - return CORE_OK; + return OGS_OK; } """) -f.write("""status_t nas_esm_encode(pkbuf_t **pkbuf, nas_message_t *message) +f.write("""int nas_esm_encode(ogs_pkbuf_t **pkbuf, nas_message_t *message) { - status_t rv = CORE_ERROR; - c_int32_t size = 0; - c_int32_t encoded = 0; + int size = 0; + int encoded = 0; - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(message); - /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. + /* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ - *pkbuf = pkbuf_alloc(NAS_HEADROOM, MAX_SDU_LEN); - d_assert(*pkbuf, return -1, "Null Param"); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(*pkbuf); + ogs_pkbuf_reserve(*pkbuf, NAS_HEADROOM); + ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN-NAS_HEADROOM); size = sizeof(nas_esm_header_t); - rv = pkbuf_header(*pkbuf, -size); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); - - memcpy((*pkbuf)->payload - size, &message->esm.h, size); + ogs_assert(ogs_pkbuf_pull(*pkbuf, size)); + memcpy((*pkbuf)->data - size, &message->esm.h, size); encoded += size; switch(message->esm.h.message_type) @@ -988,32 +964,29 @@ for (k, v) in sorted_msg_list: f.write(" case NAS_%s:\n" % v_upper(k)) if len(msg_list[k]["ies"]) != 0: f.write(" size = nas_encode_%s(*pkbuf, message);\n" % v_lower(k)) - f.write(" d_assert(size >= 0, return CORE_ERROR, \"decode error\");\n") + f.write(" ogs_assert(size >= 0);\n") f.write(" encoded += size;\n") f.write(" break;\n") f.write(""" default: - d_error("Unknown message type (0x%x) or not implemented", + ogs_error("Unknown message type (0x%x) or not implemented", message->esm.h.message_type); - pkbuf_free((*pkbuf)); - return CORE_ERROR; + ogs_pkbuf_free((*pkbuf)); + return OGS_ERROR; } - rv = pkbuf_header(*pkbuf, encoded); - d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error"); - + ogs_assert(ogs_pkbuf_push(*pkbuf, encoded)); (*pkbuf)->len = encoded; - return CORE_OK; + return OGS_OK; } -status_t nas_plain_encode(pkbuf_t **pkbuf, nas_message_t *message) +int nas_plain_encode(ogs_pkbuf_t **pkbuf, nas_message_t *message) { - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(message); - d_assert(message->emm.h.protocol_discriminator == - message->esm.h.protocol_discriminator, - return CORE_ERROR, "check UNION for protocol"); + ogs_assert(message->emm.h.protocol_discriminator == + message->esm.h.protocol_discriminator); if (message->emm.h.protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM) @@ -1022,8 +995,9 @@ status_t nas_plain_encode(pkbuf_t **pkbuf, nas_message_t *message) NAS_PROTOCOL_DISCRIMINATOR_ESM) return nas_esm_encode(pkbuf, message); - d_assert(0, return CORE_ERROR, - "Invalid Protocol : %d", message->emm.h.protocol_discriminator); + ogs_assert_if_reached(); + + return OGS_OK; } """) diff --git a/lib/nas/support/type_list.py b/lib/nas/support/type_list.py index a9d821fef..396d1fc02 100644 --- a/lib/nas/support/type_list.py +++ b/lib/nas/support/type_list.py @@ -1,3 +1,21 @@ + +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + type_list["P-TMSI signature"]["decode"] = \ " *p_tmsi_signature = htonl(*p_tmsi_signature);\n\n" type_list["P-TMSI signature"]["encode"] = \ @@ -17,7 +35,7 @@ type_list["Mobile identity"]["decode"] = \ " if (mobile_identity->tmsi.type == NAS_MOBILE_IDENTITY_TMSI)\n" \ " {\n" \ " if (mobile_identity->tmsi.spare != 0xf)\n" \ -" d_warn(\"Spec warning : mobile_identity->tmsi.spare = 0x%x\", mobile_identity->tmsi.spare);\n" \ +" ogs_warn(\"Spec warning : mobile_identity->tmsi.spare = 0x%x\", mobile_identity->tmsi.spare);\n" \ " mobile_identity->tmsi.tmsi = ntohl(mobile_identity->tmsi.tmsi);\n" \ " }\n\n" type_list["Mobile identity"]["encode"] = \ @@ -31,7 +49,7 @@ type_list["EPS mobile identity"]["decode"] = \ " if (eps_mobile_identity->guti.type == NAS_EPS_MOBILE_IDENTITY_GUTI)\n" \ " {\n" \ " if (eps_mobile_identity->guti.spare != 0xf)\n" \ -" d_warn(\"Spec warning : eps_mobile_identy->spare = 0x%x\", eps_mobile_identity->guti.spare);\n" \ +" ogs_warn(\"Spec warning : eps_mobile_identy->spare = 0x%x\", eps_mobile_identity->guti.spare);\n" \ " eps_mobile_identity->guti.mme_gid = ntohs(eps_mobile_identity->guti.mme_gid);\n" \ " eps_mobile_identity->guti.m_tmsi = ntohl(eps_mobile_identity->guti.m_tmsi);\n" \ " }\n\n" @@ -60,9 +78,9 @@ type_list["Short MAC"]["encode"] = \ type_list["Access point name"]["decode"] = \ " {\n" \ -" c_int8_t apn[MAX_APN_LEN];\n" \ +" char apn[MAX_APN_LEN];\n" \ " access_point_name->length = apn_parse(apn, access_point_name->apn, access_point_name->length);\n" \ -" core_cpystrn(access_point_name->apn, apn, c_min(access_point_name->length, MAX_APN_LEN) + 1);\n" \ +" ogs_cpystrn(access_point_name->apn, apn, ogs_min(access_point_name->length, MAX_APN_LEN) + 1);\n" \ " }\n\n" type_list["Access point name"]["encode"] = \ diff --git a/lib/s1ap/Makefile.am b/lib/s1ap/Makefile.am deleted file mode 100644 index 5200058d1..000000000 --- a/lib/s1ap/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = asn1c - -pkglib_LTLIBRARIES = libs1ap.la - -libs1ap_la_SOURCES = \ - s1ap_decoder.c s1ap_encoder.c s1ap_free.c \ - $(NULL) - -libs1ap_la_DEPENDENCIES = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(top_srcdir)/lib/s1ap/asn1c/libs1apasn1c.la \ - $(NULL) - -libs1ap_la_LIBADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(top_srcdir)/lib/s1ap/asn1c/libs1apasn1c.la \ - $(NULL) - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ - -AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ - -I$(top_srcdir)/lib/s1ap/asn1c \ - $(NULL) - -AM_CFLAGS = \ - -Wall -Werror \ - $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/lib/s1ap/asn1c/Makefile.am b/lib/s1ap/asn1c/Makefile.am deleted file mode 100644 index 59e217c13..000000000 --- a/lib/s1ap/asn1c/Makefile.am +++ /dev/null @@ -1,1159 +0,0 @@ -ASN_MODULE_SRCS= \ - S1AP_S1AP-PDU.c \ - S1AP_InitiatingMessage.c \ - S1AP_SuccessfulOutcome.c \ - S1AP_UnsuccessfulOutcome.c \ - S1AP_E-RAB-IE-ContainerList.c \ - S1AP_HandoverRequired.c \ - S1AP_HandoverCommand.c \ - S1AP_E-RABSubjecttoDataForwardingList.c \ - S1AP_E-RABDataForwardingItem.c \ - S1AP_HandoverPreparationFailure.c \ - S1AP_HandoverRequest.c \ - S1AP_E-RABToBeSetupListHOReq.c \ - S1AP_E-RABToBeSetupItemHOReq.c \ - S1AP_HandoverRequestAcknowledge.c \ - S1AP_E-RABAdmittedList.c \ - S1AP_E-RABAdmittedItem.c \ - S1AP_E-RABFailedtoSetupListHOReqAck.c \ - S1AP_E-RABFailedToSetupItemHOReqAck.c \ - S1AP_HandoverFailure.c \ - S1AP_HandoverNotify.c \ - S1AP_PathSwitchRequest.c \ - S1AP_E-RABToBeSwitchedDLList.c \ - S1AP_E-RABToBeSwitchedDLItem.c \ - S1AP_PathSwitchRequestAcknowledge.c \ - S1AP_E-RABToBeSwitchedULList.c \ - S1AP_E-RABToBeSwitchedULItem.c \ - S1AP_PathSwitchRequestFailure.c \ - S1AP_HandoverCancel.c \ - S1AP_HandoverCancelAcknowledge.c \ - S1AP_E-RABSetupRequest.c \ - S1AP_E-RABToBeSetupListBearerSUReq.c \ - S1AP_E-RABToBeSetupItemBearerSUReq.c \ - S1AP_E-RABSetupResponse.c \ - S1AP_E-RABSetupListBearerSURes.c \ - S1AP_E-RABSetupItemBearerSURes.c \ - S1AP_E-RABModifyRequest.c \ - S1AP_E-RABToBeModifiedListBearerModReq.c \ - S1AP_E-RABToBeModifiedItemBearerModReq.c \ - S1AP_E-RABModifyResponse.c \ - S1AP_E-RABModifyListBearerModRes.c \ - S1AP_E-RABModifyItemBearerModRes.c \ - S1AP_E-RABReleaseCommand.c \ - S1AP_E-RABReleaseResponse.c \ - S1AP_E-RABReleaseListBearerRelComp.c \ - S1AP_E-RABReleaseItemBearerRelComp.c \ - S1AP_E-RABReleaseIndication.c \ - S1AP_InitialContextSetupRequest.c \ - S1AP_E-RABToBeSetupListCtxtSUReq.c \ - S1AP_E-RABToBeSetupItemCtxtSUReq.c \ - S1AP_InitialContextSetupResponse.c \ - S1AP_E-RABSetupListCtxtSURes.c \ - S1AP_E-RABSetupItemCtxtSURes.c \ - S1AP_InitialContextSetupFailure.c \ - S1AP_Paging.c \ - S1AP_TAIList.c \ - S1AP_TAIItem.c \ - S1AP_UEContextReleaseRequest.c \ - S1AP_UEContextReleaseCommand.c \ - S1AP_UEContextReleaseComplete.c \ - S1AP_UEContextModificationRequest.c \ - S1AP_UEContextModificationResponse.c \ - S1AP_UEContextModificationFailure.c \ - S1AP_UERadioCapabilityMatchRequest.c \ - S1AP_UERadioCapabilityMatchResponse.c \ - S1AP_DownlinkNASTransport.c \ - S1AP_InitialUEMessage.c \ - S1AP_UplinkNASTransport.c \ - S1AP_NASNonDeliveryIndication.c \ - S1AP_RerouteNASRequest.c \ - S1AP_NASDeliveryIndication.c \ - S1AP_Reset.c \ - S1AP_ResetType.c \ - S1AP_ResetAll.c \ - S1AP_UE-associatedLogicalS1-ConnectionListRes.c \ - S1AP_ResetAcknowledge.c \ - S1AP_UE-associatedLogicalS1-ConnectionListResAck.c \ - S1AP_ErrorIndication.c \ - S1AP_S1SetupRequest.c \ - S1AP_S1SetupResponse.c \ - S1AP_S1SetupFailure.c \ - S1AP_ENBConfigurationUpdate.c \ - S1AP_ENBConfigurationUpdateAcknowledge.c \ - S1AP_ENBConfigurationUpdateFailure.c \ - S1AP_MMEConfigurationUpdate.c \ - S1AP_MMEConfigurationUpdateAcknowledge.c \ - S1AP_MMEConfigurationUpdateFailure.c \ - S1AP_DownlinkS1cdma2000tunnelling.c \ - S1AP_UplinkS1cdma2000tunnelling.c \ - S1AP_UECapabilityInfoIndication.c \ - S1AP_ENBStatusTransfer.c \ - S1AP_MMEStatusTransfer.c \ - S1AP_TraceStart.c \ - S1AP_TraceFailureIndication.c \ - S1AP_DeactivateTrace.c \ - S1AP_CellTrafficTrace.c \ - S1AP_LocationReportingControl.c \ - S1AP_LocationReportingFailureIndication.c \ - S1AP_LocationReport.c \ - S1AP_OverloadStart.c \ - S1AP_OverloadStop.c \ - S1AP_WriteReplaceWarningRequest.c \ - S1AP_WriteReplaceWarningResponse.c \ - S1AP_ENBDirectInformationTransfer.c \ - S1AP_Inter-SystemInformationTransferType.c \ - S1AP_MMEDirectInformationTransfer.c \ - S1AP_ENBConfigurationTransfer.c \ - S1AP_MMEConfigurationTransfer.c \ - S1AP_PrivateMessage.c \ - S1AP_KillRequest.c \ - S1AP_KillResponse.c \ - S1AP_PWSRestartIndication.c \ - S1AP_PWSFailureIndication.c \ - S1AP_DownlinkUEAssociatedLPPaTransport.c \ - S1AP_UplinkUEAssociatedLPPaTransport.c \ - S1AP_DownlinkNonUEAssociatedLPPaTransport.c \ - S1AP_UplinkNonUEAssociatedLPPaTransport.c \ - S1AP_E-RABModificationIndication.c \ - S1AP_E-RABToBeModifiedListBearerModInd.c \ - S1AP_E-RABToBeModifiedItemBearerModInd.c \ - S1AP_E-RABNotToBeModifiedListBearerModInd.c \ - S1AP_E-RABNotToBeModifiedItemBearerModInd.c \ - S1AP_CSGMembershipInfo.c \ - S1AP_E-RABModificationConfirm.c \ - S1AP_E-RABModifyListBearerModConf.c \ - S1AP_E-RABModifyItemBearerModConf.c \ - S1AP_UEContextModificationIndication.c \ - S1AP_UEContextModificationConfirm.c \ - S1AP_UEContextSuspendRequest.c \ - S1AP_UEContextSuspendResponse.c \ - S1AP_UEContextResumeRequest.c \ - S1AP_E-RABFailedToResumeListResumeReq.c \ - S1AP_E-RABFailedToResumeItemResumeReq.c \ - S1AP_UEContextResumeResponse.c \ - S1AP_E-RABFailedToResumeListResumeRes.c \ - S1AP_E-RABFailedToResumeItemResumeRes.c \ - S1AP_UEContextResumeFailure.c \ - S1AP_ConnectionEstablishmentIndication.c \ - S1AP_RetrieveUEInformation.c \ - S1AP_UEInformationTransfer.c \ - S1AP_ENBCPRelocationIndication.c \ - S1AP_MMECPRelocationIndication.c \ - S1AP_Additional-GUTI.c \ - S1AP_AreaScopeOfMDT.c \ - S1AP_AllocationAndRetentionPriority.c \ - S1AP_AssistanceDataForCECapableUEs.c \ - S1AP_AssistanceDataForPaging.c \ - S1AP_AssistanceDataForRecommendedCells.c \ - S1AP_Bearers-SubjectToStatusTransferList.c \ - S1AP_Bearers-SubjectToStatusTransfer-Item.c \ - S1AP_BearerType.c \ - S1AP_BitRate.c \ - S1AP_BPLMNs.c \ - S1AP_BroadcastCancelledAreaList.c \ - S1AP_BroadcastCompletedAreaList.c \ - S1AP_CancelledCellinEAI.c \ - S1AP_CancelledCellinEAI-Item.c \ - S1AP_CancelledCellinTAI.c \ - S1AP_CancelledCellinTAI-Item.c \ - S1AP_Cause.c \ - S1AP_CauseMisc.c \ - S1AP_CauseProtocol.c \ - S1AP_CauseRadioNetwork.c \ - S1AP_CauseTransport.c \ - S1AP_CauseNas.c \ - S1AP_CellAccessMode.c \ - S1AP_CellIdentifierAndCELevelForCECapableUEs.c \ - S1AP_CELevel.c \ - S1AP_CE-mode-B-SupportIndicator.c \ - S1AP_CellIdentity.c \ - S1AP_CellID-Broadcast.c \ - S1AP_CellID-Broadcast-Item.c \ - S1AP_CellID-Cancelled.c \ - S1AP_CellID-Cancelled-Item.c \ - S1AP_CellBasedMDT.c \ - S1AP_CellIdListforMDT.c \ - S1AP_Cdma2000PDU.c \ - S1AP_Cdma2000RATType.c \ - S1AP_Cdma2000SectorID.c \ - S1AP_Cdma2000HOStatus.c \ - S1AP_Cdma2000HORequiredIndication.c \ - S1AP_Cdma2000OneXSRVCCInfo.c \ - S1AP_Cdma2000OneXMEID.c \ - S1AP_Cdma2000OneXMSI.c \ - S1AP_Cdma2000OneXPilot.c \ - S1AP_Cdma2000OneXRAND.c \ - S1AP_Cell-Size.c \ - S1AP_CellType.c \ - S1AP_CGI.c \ - S1AP_CI.c \ - S1AP_CNDomain.c \ - S1AP_ConcurrentWarningMessageIndicator.c \ - S1AP_Correlation-ID.c \ - S1AP_CSFallbackIndicator.c \ - S1AP_AdditionalCSFallbackIndicator.c \ - S1AP_CSG-Id.c \ - S1AP_CSG-IdList.c \ - S1AP_CSG-IdList-Item.c \ - S1AP_CSGMembershipStatus.c \ - S1AP_COUNTvalue.c \ - S1AP_COUNTValueExtended.c \ - S1AP_COUNTvaluePDCP-SNlength18.c \ - S1AP_Coverage-Level.c \ - S1AP_CriticalityDiagnostics.c \ - S1AP_CriticalityDiagnostics-IE-List.c \ - S1AP_CriticalityDiagnostics-IE-Item.c \ - S1AP_DataCodingScheme.c \ - S1AP_DCN-ID.c \ - S1AP_ServedDCNs.c \ - S1AP_ServedDCNsItem.c \ - S1AP_DL-CP-SecurityInformation.c \ - S1AP_DL-Forwarding.c \ - S1AP_DL-NAS-MAC.c \ - S1AP_Direct-Forwarding-Path-Availability.c \ - S1AP_Data-Forwarding-Not-Possible.c \ - S1AP_DLNASPDUDeliveryAckRequest.c \ - S1AP_EARFCN.c \ - S1AP_ECGIList.c \ - S1AP_PWSfailedECGIList.c \ - S1AP_EmergencyAreaIDList.c \ - S1AP_EmergencyAreaID.c \ - S1AP_EmergencyAreaID-Broadcast.c \ - S1AP_EmergencyAreaID-Broadcast-Item.c \ - S1AP_EmergencyAreaID-Cancelled.c \ - S1AP_EmergencyAreaID-Cancelled-Item.c \ - S1AP_CompletedCellinEAI.c \ - S1AP_CompletedCellinEAI-Item.c \ - S1AP_ECGI-List.c \ - S1AP_EmergencyAreaIDListForRestart.c \ - S1AP_ENB-ID.c \ - S1AP_GERAN-Cell-ID.c \ - S1AP_Global-ENB-ID.c \ - S1AP_GUMMEIList.c \ - S1AP_ENB-StatusTransfer-TransparentContainer.c \ - S1AP_ENB-UE-S1AP-ID.c \ - S1AP_ENBname.c \ - S1AP_ENBX2TLAs.c \ - S1AP_EncryptionAlgorithms.c \ - S1AP_EnhancedCoverageRestricted.c \ - S1AP_EPLMNs.c \ - S1AP_EventType.c \ - S1AP_E-RAB-ID.c \ - S1AP_E-RABInformationList.c \ - S1AP_E-RABInformationListItem.c \ - S1AP_E-RABList.c \ - S1AP_E-RABItem.c \ - S1AP_E-RABLevelQoSParameters.c \ - S1AP_EUTRAN-CGI.c \ - S1AP_EUTRANRoundTripDelayEstimationInfo.c \ - S1AP_ExpectedUEBehaviour.c \ - S1AP_ExpectedUEActivityBehaviour.c \ - S1AP_ExpectedActivityPeriod.c \ - S1AP_ExpectedIdlePeriod.c \ - S1AP_SourceOfUEActivityBehaviourInformation.c \ - S1AP_ExpectedHOInterval.c \ - S1AP_ExtendedRNC-ID.c \ - S1AP_ExtendedRepetitionPeriod.c \ - S1AP_Extended-UEIdentityIndexValue.c \ - S1AP_ForbiddenInterRATs.c \ - S1AP_ForbiddenTAs.c \ - S1AP_ForbiddenTAs-Item.c \ - S1AP_ForbiddenTACs.c \ - S1AP_ForbiddenLAs.c \ - S1AP_ForbiddenLAs-Item.c \ - S1AP_ForbiddenLACs.c \ - S1AP_GBR-QosInformation.c \ - S1AP_GTP-TEID.c \ - S1AP_GUMMEI.c \ - S1AP_GUMMEIType.c \ - S1AP_GWContextReleaseIndication.c \ - S1AP_HandoverRestrictionList.c \ - S1AP_HandoverType.c \ - S1AP_HFN.c \ - S1AP_HFNModified.c \ - S1AP_HFNforPDCP-SNlength18.c \ - S1AP_Masked-IMEISV.c \ - S1AP_ImmediateMDT.c \ - S1AP_IMSI.c \ - S1AP_InformationOnRecommendedCellsAndENBsForPaging.c \ - S1AP_IntegrityProtectionAlgorithms.c \ - S1AP_IntendedNumberOfPagingAttempts.c \ - S1AP_InterfacesToTrace.c \ - S1AP_KillAllWarningMessages.c \ - S1AP_LAC.c \ - S1AP_LAI.c \ - S1AP_LastVisitedCell-Item.c \ - S1AP_LastVisitedEUTRANCellInformation.c \ - S1AP_LastVisitedUTRANCellInformation.c \ - S1AP_LastVisitedGERANCellInformation.c \ - S1AP_L3-Information.c \ - S1AP_LPPa-PDU.c \ - S1AP_LHN-ID.c \ - S1AP_Links-to-log.c \ - S1AP_ListeningSubframePattern.c \ - S1AP_LoggedMDT.c \ - S1AP_LoggingInterval.c \ - S1AP_LoggingDuration.c \ - S1AP_LoggedMBSFNMDT.c \ - S1AP_M3Configuration.c \ - S1AP_M3period.c \ - S1AP_M4Configuration.c \ - S1AP_M4period.c \ - S1AP_M5Configuration.c \ - S1AP_M5period.c \ - S1AP_M6Configuration.c \ - S1AP_M6report-Interval.c \ - S1AP_M6delay-threshold.c \ - S1AP_M7Configuration.c \ - S1AP_M7period.c \ - S1AP_MDT-Activation.c \ - S1AP_MDT-Location-Info.c \ - S1AP_MDT-Configuration.c \ - S1AP_ManagementBasedMDTAllowed.c \ - S1AP_MBSFN-ResultToLog.c \ - S1AP_MBSFN-ResultToLogInfo.c \ - S1AP_MDTPLMNList.c \ - S1AP_PrivacyIndicator.c \ - S1AP_MDTMode.c \ - S1AP_MDTMode-Extension.c \ - S1AP_MeasurementsToActivate.c \ - S1AP_MeasurementThresholdA2.c \ - S1AP_MessageIdentifier.c \ - S1AP_MobilityInformation.c \ - S1AP_MMEname.c \ - S1AP_MMEPagingTarget.c \ - S1AP_MMERelaySupportIndicator.c \ - S1AP_MME-Group-ID.c \ - S1AP_MME-Code.c \ - S1AP_MME-UE-S1AP-ID.c \ - S1AP_M-TMSI.c \ - S1AP_MSClassmark2.c \ - S1AP_MSClassmark3.c \ - S1AP_MutingAvailabilityIndication.c \ - S1AP_MutingPatternInformation.c \ - S1AP_NAS-PDU.c \ - S1AP_NASSecurityParametersfromE-UTRAN.c \ - S1AP_NASSecurityParameterstoE-UTRAN.c \ - S1AP_NB-IoT-DefaultPagingDRX.c \ - S1AP_NB-IoT-Paging-eDRXInformation.c \ - S1AP_NB-IoT-Paging-eDRX-Cycle.c \ - S1AP_NB-IoT-PagingTimeWindow.c \ - S1AP_NB-IoT-UEIdentityIndexValue.c \ - S1AP_NextPagingAreaScope.c \ - S1AP_NumberofBroadcastRequest.c \ - S1AP_NumberOfBroadcasts.c \ - S1AP_OldBSS-ToNewBSS-Information.c \ - S1AP_OverloadAction.c \ - S1AP_OverloadResponse.c \ - S1AP_PagingAttemptInformation.c \ - S1AP_PagingAttemptCount.c \ - S1AP_Paging-eDRXInformation.c \ - S1AP_Paging-eDRX-Cycle.c \ - S1AP_PagingTimeWindow.c \ - S1AP_PagingDRX.c \ - S1AP_PagingPriority.c \ - S1AP_PDCP-SN.c \ - S1AP_PDCP-SNExtended.c \ - S1AP_PDCP-SNlength18.c \ - S1AP_M1PeriodicReporting.c \ - S1AP_PLMNidentity.c \ - S1AP_Port-Number.c \ - S1AP_Pre-emptionCapability.c \ - S1AP_Pre-emptionVulnerability.c \ - S1AP_PriorityLevel.c \ - S1AP_ProSeAuthorized.c \ - S1AP_ProSeDirectDiscovery.c \ - S1AP_ProSeUEtoNetworkRelaying.c \ - S1AP_ProSeDirectCommunication.c \ - S1AP_PS-ServiceNotAvailable.c \ - S1AP_QCI.c \ - S1AP_ReceiveStatusofULPDCPSDUs.c \ - S1AP_ReceiveStatusOfULPDCPSDUsExtended.c \ - S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.c \ - S1AP_RecommendedCellsForPaging.c \ - S1AP_RecommendedCellList.c \ - S1AP_RecommendedCellItem.c \ - S1AP_RecommendedENBsForPaging.c \ - S1AP_RecommendedENBList.c \ - S1AP_RecommendedENBItem.c \ - S1AP_RelativeMMECapacity.c \ - S1AP_RelayNode-Indicator.c \ - S1AP_RAC.c \ - S1AP_RAT-Type.c \ - S1AP_ReportAmountMDT.c \ - S1AP_ReportIntervalMDT.c \ - S1AP_M1ReportingTrigger.c \ - S1AP_RequestType.c \ - S1AP_RIMTransfer.c \ - S1AP_RIMInformation.c \ - S1AP_RIMRoutingAddress.c \ - S1AP_ReportArea.c \ - S1AP_RepetitionPeriod.c \ - S1AP_RLFReportInformation.c \ - S1AP_RNC-ID.c \ - S1AP_RRC-Container.c \ - S1AP_RRC-Establishment-Cause.c \ - S1AP_ECGIListForRestart.c \ - S1AP_Routing-ID.c \ - S1AP_SecurityKey.c \ - S1AP_SecurityContext.c \ - S1AP_SerialNumber.c \ - S1AP_SONInformation.c \ - S1AP_SONInformation-Extension.c \ - S1AP_SONInformationRequest.c \ - S1AP_SONInformationReply.c \ - S1AP_SONInformationReport.c \ - S1AP_SONConfigurationTransfer.c \ - S1AP_SynchronisationInformation.c \ - S1AP_Source-ToTarget-TransparentContainer.c \ - S1AP_SourceBSS-ToTargetBSS-TransparentContainer.c \ - S1AP_SourceeNB-ID.c \ - S1AP_SRVCCOperationNotPossible.c \ - S1AP_SRVCCOperationPossible.c \ - S1AP_SRVCCHOIndication.c \ - S1AP_SourceeNB-ToTargeteNB-TransparentContainer.c \ - S1AP_SourceRNC-ToTargetRNC-TransparentContainer.c \ - S1AP_ServedGUMMEIs.c \ - S1AP_ServedGUMMEIsItem.c \ - S1AP_ServedGroupIDs.c \ - S1AP_ServedMMECs.c \ - S1AP_ServedPLMNs.c \ - S1AP_SubscriberProfileIDforRFP.c \ - S1AP_SupportedTAs.c \ - S1AP_SupportedTAs-Item.c \ - S1AP_StratumLevel.c \ - S1AP_SynchronisationStatus.c \ - S1AP_TimeSynchronisationInfo.c \ - S1AP_S-TMSI.c \ - S1AP_TAC.c \ - S1AP_TAIBasedMDT.c \ - S1AP_TAIListforMDT.c \ - S1AP_TAIListforWarning.c \ - S1AP_TAI.c \ - S1AP_TAI-Broadcast.c \ - S1AP_TAI-Broadcast-Item.c \ - S1AP_TAI-Cancelled.c \ - S1AP_TAI-Cancelled-Item.c \ - S1AP_TABasedMDT.c \ - S1AP_TAListforMDT.c \ - S1AP_CompletedCellinTAI.c \ - S1AP_CompletedCellinTAI-Item.c \ - S1AP_TBCD-STRING.c \ - S1AP_TargetID.c \ - S1AP_TargeteNB-ID.c \ - S1AP_TargetRNC-ID.c \ - S1AP_TargeteNB-ToSourceeNB-TransparentContainer.c \ - S1AP_Target-ToSource-TransparentContainer.c \ - S1AP_TargetRNC-ToSourceRNC-TransparentContainer.c \ - S1AP_TargetBSS-ToSourceBSS-TransparentContainer.c \ - S1AP_M1ThresholdEventA2.c \ - S1AP_Threshold-RSRP.c \ - S1AP_Threshold-RSRQ.c \ - S1AP_TimeToWait.c \ - S1AP_Time-UE-StayedInCell.c \ - S1AP_Time-UE-StayedInCell-EnhancedGranularity.c \ - S1AP_TransportInformation.c \ - S1AP_TransportLayerAddress.c \ - S1AP_TraceActivation.c \ - S1AP_TraceDepth.c \ - S1AP_E-UTRAN-Trace-ID.c \ - S1AP_TrafficLoadReductionIndication.c \ - S1AP_TunnelInformation.c \ - S1AP_TypeOfError.c \ - S1AP_TAIListForRestart.c \ - S1AP_UEAggregateMaximumBitrate.c \ - S1AP_UE-RetentionInformation.c \ - S1AP_UE-S1AP-IDs.c \ - S1AP_UE-S1AP-ID-pair.c \ - S1AP_UE-associatedLogicalS1-ConnectionItem.c \ - S1AP_UEIdentityIndexValue.c \ - S1AP_UE-HistoryInformation.c \ - S1AP_UE-HistoryInformationFromTheUE.c \ - S1AP_UEPagingID.c \ - S1AP_UERadioCapability.c \ - S1AP_UERadioCapabilityForPaging.c \ - S1AP_UE-RLF-Report-Container.c \ - S1AP_UE-RLF-Report-Container-for-extended-bands.c \ - S1AP_UESecurityCapabilities.c \ - S1AP_UESidelinkAggregateMaximumBitrate.c \ - S1AP_UE-Usage-Type.c \ - S1AP_UL-CP-SecurityInformation.c \ - S1AP_UL-NAS-MAC.c \ - S1AP_UL-NAS-Count.c \ - S1AP_UserLocationInformation.c \ - S1AP_UEUserPlaneCIoTSupportIndicator.c \ - S1AP_VoiceSupportMatchIndicator.c \ - S1AP_V2XServicesAuthorized.c \ - S1AP_VehicleUE.c \ - S1AP_PedestrianUE.c \ - S1AP_WarningAreaList.c \ - S1AP_WarningType.c \ - S1AP_WarningSecurityInfo.c \ - S1AP_WarningMessageContents.c \ - S1AP_X2TNLConfigurationInfo.c \ - S1AP_ENBX2ExtTLAs.c \ - S1AP_ENBX2ExtTLA.c \ - S1AP_ENBX2GTPTLAs.c \ - S1AP_ENBIndirectX2TransportLayerAddresses.c \ - S1AP_Criticality.c \ - S1AP_Presence.c \ - S1AP_PrivateIE-ID.c \ - S1AP_ProcedureCode.c \ - S1AP_ProtocolExtensionID.c \ - S1AP_ProtocolIE-ID.c \ - S1AP_TriggeringMessage.c \ - S1AP_ProtocolIE-Container.c \ - S1AP_ProtocolIE-SingleContainer.c \ - S1AP_ProtocolIE-Field.c \ - S1AP_ProtocolIE-ContainerList.c \ - S1AP_ProtocolExtensionContainer.c \ - S1AP_ProtocolExtensionField.c \ - S1AP_PrivateIE-Container.c \ - S1AP_PrivateIE-Field.c - -ASN_MODULE_HDRS= \ - S1AP_S1AP-PDU.h \ - S1AP_InitiatingMessage.h \ - S1AP_SuccessfulOutcome.h \ - S1AP_UnsuccessfulOutcome.h \ - S1AP_E-RAB-IE-ContainerList.h \ - S1AP_E-RAB-IE-ContainerPairList.h \ - S1AP_ProtocolError-IE-ContainerList.h \ - S1AP_HandoverRequired.h \ - S1AP_HandoverCommand.h \ - S1AP_E-RABSubjecttoDataForwardingList.h \ - S1AP_E-RABDataForwardingItem.h \ - S1AP_HandoverPreparationFailure.h \ - S1AP_HandoverRequest.h \ - S1AP_E-RABToBeSetupListHOReq.h \ - S1AP_E-RABToBeSetupItemHOReq.h \ - S1AP_HandoverRequestAcknowledge.h \ - S1AP_E-RABAdmittedList.h \ - S1AP_E-RABAdmittedItem.h \ - S1AP_E-RABFailedtoSetupListHOReqAck.h \ - S1AP_E-RABFailedToSetupItemHOReqAck.h \ - S1AP_HandoverFailure.h \ - S1AP_HandoverNotify.h \ - S1AP_PathSwitchRequest.h \ - S1AP_E-RABToBeSwitchedDLList.h \ - S1AP_E-RABToBeSwitchedDLItem.h \ - S1AP_PathSwitchRequestAcknowledge.h \ - S1AP_E-RABToBeSwitchedULList.h \ - S1AP_E-RABToBeSwitchedULItem.h \ - S1AP_PathSwitchRequestFailure.h \ - S1AP_HandoverCancel.h \ - S1AP_HandoverCancelAcknowledge.h \ - S1AP_E-RABSetupRequest.h \ - S1AP_E-RABToBeSetupListBearerSUReq.h \ - S1AP_E-RABToBeSetupItemBearerSUReq.h \ - S1AP_E-RABSetupResponse.h \ - S1AP_E-RABSetupListBearerSURes.h \ - S1AP_E-RABSetupItemBearerSURes.h \ - S1AP_E-RABModifyRequest.h \ - S1AP_E-RABToBeModifiedListBearerModReq.h \ - S1AP_E-RABToBeModifiedItemBearerModReq.h \ - S1AP_E-RABModifyResponse.h \ - S1AP_E-RABModifyListBearerModRes.h \ - S1AP_E-RABModifyItemBearerModRes.h \ - S1AP_E-RABReleaseCommand.h \ - S1AP_E-RABReleaseResponse.h \ - S1AP_E-RABReleaseListBearerRelComp.h \ - S1AP_E-RABReleaseItemBearerRelComp.h \ - S1AP_E-RABReleaseIndication.h \ - S1AP_InitialContextSetupRequest.h \ - S1AP_E-RABToBeSetupListCtxtSUReq.h \ - S1AP_E-RABToBeSetupItemCtxtSUReq.h \ - S1AP_InitialContextSetupResponse.h \ - S1AP_E-RABSetupListCtxtSURes.h \ - S1AP_E-RABSetupItemCtxtSURes.h \ - S1AP_InitialContextSetupFailure.h \ - S1AP_Paging.h \ - S1AP_TAIList.h \ - S1AP_TAIItem.h \ - S1AP_UEContextReleaseRequest.h \ - S1AP_UEContextReleaseCommand.h \ - S1AP_UEContextReleaseComplete.h \ - S1AP_UEContextModificationRequest.h \ - S1AP_UEContextModificationResponse.h \ - S1AP_UEContextModificationFailure.h \ - S1AP_UERadioCapabilityMatchRequest.h \ - S1AP_UERadioCapabilityMatchResponse.h \ - S1AP_DownlinkNASTransport.h \ - S1AP_InitialUEMessage.h \ - S1AP_UplinkNASTransport.h \ - S1AP_NASNonDeliveryIndication.h \ - S1AP_RerouteNASRequest.h \ - S1AP_NASDeliveryIndication.h \ - S1AP_Reset.h \ - S1AP_ResetType.h \ - S1AP_ResetAll.h \ - S1AP_UE-associatedLogicalS1-ConnectionListRes.h \ - S1AP_ResetAcknowledge.h \ - S1AP_UE-associatedLogicalS1-ConnectionListResAck.h \ - S1AP_ErrorIndication.h \ - S1AP_S1SetupRequest.h \ - S1AP_S1SetupResponse.h \ - S1AP_S1SetupFailure.h \ - S1AP_ENBConfigurationUpdate.h \ - S1AP_ENBConfigurationUpdateAcknowledge.h \ - S1AP_ENBConfigurationUpdateFailure.h \ - S1AP_MMEConfigurationUpdate.h \ - S1AP_MMEConfigurationUpdateAcknowledge.h \ - S1AP_MMEConfigurationUpdateFailure.h \ - S1AP_DownlinkS1cdma2000tunnelling.h \ - S1AP_UplinkS1cdma2000tunnelling.h \ - S1AP_UECapabilityInfoIndication.h \ - S1AP_ENBStatusTransfer.h \ - S1AP_MMEStatusTransfer.h \ - S1AP_TraceStart.h \ - S1AP_TraceFailureIndication.h \ - S1AP_DeactivateTrace.h \ - S1AP_CellTrafficTrace.h \ - S1AP_LocationReportingControl.h \ - S1AP_LocationReportingFailureIndication.h \ - S1AP_LocationReport.h \ - S1AP_OverloadStart.h \ - S1AP_OverloadStop.h \ - S1AP_WriteReplaceWarningRequest.h \ - S1AP_WriteReplaceWarningResponse.h \ - S1AP_ENBDirectInformationTransfer.h \ - S1AP_Inter-SystemInformationTransferType.h \ - S1AP_MMEDirectInformationTransfer.h \ - S1AP_ENBConfigurationTransfer.h \ - S1AP_MMEConfigurationTransfer.h \ - S1AP_PrivateMessage.h \ - S1AP_KillRequest.h \ - S1AP_KillResponse.h \ - S1AP_PWSRestartIndication.h \ - S1AP_PWSFailureIndication.h \ - S1AP_DownlinkUEAssociatedLPPaTransport.h \ - S1AP_UplinkUEAssociatedLPPaTransport.h \ - S1AP_DownlinkNonUEAssociatedLPPaTransport.h \ - S1AP_UplinkNonUEAssociatedLPPaTransport.h \ - S1AP_E-RABModificationIndication.h \ - S1AP_E-RABToBeModifiedListBearerModInd.h \ - S1AP_E-RABToBeModifiedItemBearerModInd.h \ - S1AP_E-RABNotToBeModifiedListBearerModInd.h \ - S1AP_E-RABNotToBeModifiedItemBearerModInd.h \ - S1AP_CSGMembershipInfo.h \ - S1AP_E-RABModificationConfirm.h \ - S1AP_E-RABModifyListBearerModConf.h \ - S1AP_E-RABModifyItemBearerModConf.h \ - S1AP_UEContextModificationIndication.h \ - S1AP_UEContextModificationConfirm.h \ - S1AP_UEContextSuspendRequest.h \ - S1AP_UEContextSuspendResponse.h \ - S1AP_UEContextResumeRequest.h \ - S1AP_E-RABFailedToResumeListResumeReq.h \ - S1AP_E-RABFailedToResumeItemResumeReq.h \ - S1AP_UEContextResumeResponse.h \ - S1AP_E-RABFailedToResumeListResumeRes.h \ - S1AP_E-RABFailedToResumeItemResumeRes.h \ - S1AP_UEContextResumeFailure.h \ - S1AP_ConnectionEstablishmentIndication.h \ - S1AP_RetrieveUEInformation.h \ - S1AP_UEInformationTransfer.h \ - S1AP_ENBCPRelocationIndication.h \ - S1AP_MMECPRelocationIndication.h \ - S1AP_Additional-GUTI.h \ - S1AP_AreaScopeOfMDT.h \ - S1AP_AllocationAndRetentionPriority.h \ - S1AP_AssistanceDataForCECapableUEs.h \ - S1AP_AssistanceDataForPaging.h \ - S1AP_AssistanceDataForRecommendedCells.h \ - S1AP_Bearers-SubjectToStatusTransferList.h \ - S1AP_Bearers-SubjectToStatusTransfer-Item.h \ - S1AP_BearerType.h \ - S1AP_BitRate.h \ - S1AP_BPLMNs.h \ - S1AP_BroadcastCancelledAreaList.h \ - S1AP_BroadcastCompletedAreaList.h \ - S1AP_CancelledCellinEAI.h \ - S1AP_CancelledCellinEAI-Item.h \ - S1AP_CancelledCellinTAI.h \ - S1AP_CancelledCellinTAI-Item.h \ - S1AP_Cause.h \ - S1AP_CauseMisc.h \ - S1AP_CauseProtocol.h \ - S1AP_CauseRadioNetwork.h \ - S1AP_CauseTransport.h \ - S1AP_CauseNas.h \ - S1AP_CellAccessMode.h \ - S1AP_CellIdentifierAndCELevelForCECapableUEs.h \ - S1AP_CELevel.h \ - S1AP_CE-mode-B-SupportIndicator.h \ - S1AP_CellIdentity.h \ - S1AP_CellID-Broadcast.h \ - S1AP_CellID-Broadcast-Item.h \ - S1AP_CellID-Cancelled.h \ - S1AP_CellID-Cancelled-Item.h \ - S1AP_CellBasedMDT.h \ - S1AP_CellIdListforMDT.h \ - S1AP_Cdma2000PDU.h \ - S1AP_Cdma2000RATType.h \ - S1AP_Cdma2000SectorID.h \ - S1AP_Cdma2000HOStatus.h \ - S1AP_Cdma2000HORequiredIndication.h \ - S1AP_Cdma2000OneXSRVCCInfo.h \ - S1AP_Cdma2000OneXMEID.h \ - S1AP_Cdma2000OneXMSI.h \ - S1AP_Cdma2000OneXPilot.h \ - S1AP_Cdma2000OneXRAND.h \ - S1AP_Cell-Size.h \ - S1AP_CellType.h \ - S1AP_CGI.h \ - S1AP_CI.h \ - S1AP_CNDomain.h \ - S1AP_ConcurrentWarningMessageIndicator.h \ - S1AP_Correlation-ID.h \ - S1AP_CSFallbackIndicator.h \ - S1AP_AdditionalCSFallbackIndicator.h \ - S1AP_CSG-Id.h \ - S1AP_CSG-IdList.h \ - S1AP_CSG-IdList-Item.h \ - S1AP_CSGMembershipStatus.h \ - S1AP_COUNTvalue.h \ - S1AP_COUNTValueExtended.h \ - S1AP_COUNTvaluePDCP-SNlength18.h \ - S1AP_Coverage-Level.h \ - S1AP_CriticalityDiagnostics.h \ - S1AP_CriticalityDiagnostics-IE-List.h \ - S1AP_CriticalityDiagnostics-IE-Item.h \ - S1AP_DataCodingScheme.h \ - S1AP_DCN-ID.h \ - S1AP_ServedDCNs.h \ - S1AP_ServedDCNsItem.h \ - S1AP_DL-CP-SecurityInformation.h \ - S1AP_DL-Forwarding.h \ - S1AP_DL-NAS-MAC.h \ - S1AP_Direct-Forwarding-Path-Availability.h \ - S1AP_Data-Forwarding-Not-Possible.h \ - S1AP_DLNASPDUDeliveryAckRequest.h \ - S1AP_EARFCN.h \ - S1AP_ECGIList.h \ - S1AP_PWSfailedECGIList.h \ - S1AP_EmergencyAreaIDList.h \ - S1AP_EmergencyAreaID.h \ - S1AP_EmergencyAreaID-Broadcast.h \ - S1AP_EmergencyAreaID-Broadcast-Item.h \ - S1AP_EmergencyAreaID-Cancelled.h \ - S1AP_EmergencyAreaID-Cancelled-Item.h \ - S1AP_CompletedCellinEAI.h \ - S1AP_CompletedCellinEAI-Item.h \ - S1AP_ECGI-List.h \ - S1AP_EmergencyAreaIDListForRestart.h \ - S1AP_ENB-ID.h \ - S1AP_GERAN-Cell-ID.h \ - S1AP_Global-ENB-ID.h \ - S1AP_GUMMEIList.h \ - S1AP_ENB-StatusTransfer-TransparentContainer.h \ - S1AP_ENB-UE-S1AP-ID.h \ - S1AP_ENBname.h \ - S1AP_ENBX2TLAs.h \ - S1AP_EncryptionAlgorithms.h \ - S1AP_EnhancedCoverageRestricted.h \ - S1AP_EPLMNs.h \ - S1AP_EventType.h \ - S1AP_E-RAB-ID.h \ - S1AP_E-RABInformationList.h \ - S1AP_E-RABInformationListItem.h \ - S1AP_E-RABList.h \ - S1AP_E-RABItem.h \ - S1AP_E-RABLevelQoSParameters.h \ - S1AP_EUTRAN-CGI.h \ - S1AP_EUTRANRoundTripDelayEstimationInfo.h \ - S1AP_ExpectedUEBehaviour.h \ - S1AP_ExpectedUEActivityBehaviour.h \ - S1AP_ExpectedActivityPeriod.h \ - S1AP_ExpectedIdlePeriod.h \ - S1AP_SourceOfUEActivityBehaviourInformation.h \ - S1AP_ExpectedHOInterval.h \ - S1AP_ExtendedRNC-ID.h \ - S1AP_ExtendedRepetitionPeriod.h \ - S1AP_Extended-UEIdentityIndexValue.h \ - S1AP_ForbiddenInterRATs.h \ - S1AP_ForbiddenTAs.h \ - S1AP_ForbiddenTAs-Item.h \ - S1AP_ForbiddenTACs.h \ - S1AP_ForbiddenLAs.h \ - S1AP_ForbiddenLAs-Item.h \ - S1AP_ForbiddenLACs.h \ - S1AP_GBR-QosInformation.h \ - S1AP_GTP-TEID.h \ - S1AP_GUMMEI.h \ - S1AP_GUMMEIType.h \ - S1AP_GWContextReleaseIndication.h \ - S1AP_HandoverRestrictionList.h \ - S1AP_HandoverType.h \ - S1AP_HFN.h \ - S1AP_HFNModified.h \ - S1AP_HFNforPDCP-SNlength18.h \ - S1AP_Masked-IMEISV.h \ - S1AP_ImmediateMDT.h \ - S1AP_IMSI.h \ - S1AP_InformationOnRecommendedCellsAndENBsForPaging.h \ - S1AP_IntegrityProtectionAlgorithms.h \ - S1AP_IntendedNumberOfPagingAttempts.h \ - S1AP_InterfacesToTrace.h \ - S1AP_KillAllWarningMessages.h \ - S1AP_LAC.h \ - S1AP_LAI.h \ - S1AP_LastVisitedCell-Item.h \ - S1AP_LastVisitedEUTRANCellInformation.h \ - S1AP_LastVisitedUTRANCellInformation.h \ - S1AP_LastVisitedGERANCellInformation.h \ - S1AP_L3-Information.h \ - S1AP_LPPa-PDU.h \ - S1AP_LHN-ID.h \ - S1AP_Links-to-log.h \ - S1AP_ListeningSubframePattern.h \ - S1AP_LoggedMDT.h \ - S1AP_LoggingInterval.h \ - S1AP_LoggingDuration.h \ - S1AP_LoggedMBSFNMDT.h \ - S1AP_M3Configuration.h \ - S1AP_M3period.h \ - S1AP_M4Configuration.h \ - S1AP_M4period.h \ - S1AP_M5Configuration.h \ - S1AP_M5period.h \ - S1AP_M6Configuration.h \ - S1AP_M6report-Interval.h \ - S1AP_M6delay-threshold.h \ - S1AP_M7Configuration.h \ - S1AP_M7period.h \ - S1AP_MDT-Activation.h \ - S1AP_MDT-Location-Info.h \ - S1AP_MDT-Configuration.h \ - S1AP_ManagementBasedMDTAllowed.h \ - S1AP_MBSFN-ResultToLog.h \ - S1AP_MBSFN-ResultToLogInfo.h \ - S1AP_MDTPLMNList.h \ - S1AP_PrivacyIndicator.h \ - S1AP_MDTMode.h \ - S1AP_MDTMode-Extension.h \ - S1AP_MeasurementsToActivate.h \ - S1AP_MeasurementThresholdA2.h \ - S1AP_MessageIdentifier.h \ - S1AP_MobilityInformation.h \ - S1AP_MMEname.h \ - S1AP_MMEPagingTarget.h \ - S1AP_MMERelaySupportIndicator.h \ - S1AP_MME-Group-ID.h \ - S1AP_MME-Code.h \ - S1AP_MME-UE-S1AP-ID.h \ - S1AP_M-TMSI.h \ - S1AP_MSClassmark2.h \ - S1AP_MSClassmark3.h \ - S1AP_MutingAvailabilityIndication.h \ - S1AP_MutingPatternInformation.h \ - S1AP_NAS-PDU.h \ - S1AP_NASSecurityParametersfromE-UTRAN.h \ - S1AP_NASSecurityParameterstoE-UTRAN.h \ - S1AP_NB-IoT-DefaultPagingDRX.h \ - S1AP_NB-IoT-Paging-eDRXInformation.h \ - S1AP_NB-IoT-Paging-eDRX-Cycle.h \ - S1AP_NB-IoT-PagingTimeWindow.h \ - S1AP_NB-IoT-UEIdentityIndexValue.h \ - S1AP_NextPagingAreaScope.h \ - S1AP_NumberofBroadcastRequest.h \ - S1AP_NumberOfBroadcasts.h \ - S1AP_OldBSS-ToNewBSS-Information.h \ - S1AP_OverloadAction.h \ - S1AP_OverloadResponse.h \ - S1AP_PagingAttemptInformation.h \ - S1AP_PagingAttemptCount.h \ - S1AP_Paging-eDRXInformation.h \ - S1AP_Paging-eDRX-Cycle.h \ - S1AP_PagingTimeWindow.h \ - S1AP_PagingDRX.h \ - S1AP_PagingPriority.h \ - S1AP_PDCP-SN.h \ - S1AP_PDCP-SNExtended.h \ - S1AP_PDCP-SNlength18.h \ - S1AP_M1PeriodicReporting.h \ - S1AP_PLMNidentity.h \ - S1AP_Port-Number.h \ - S1AP_Pre-emptionCapability.h \ - S1AP_Pre-emptionVulnerability.h \ - S1AP_PriorityLevel.h \ - S1AP_ProSeAuthorized.h \ - S1AP_ProSeDirectDiscovery.h \ - S1AP_ProSeUEtoNetworkRelaying.h \ - S1AP_ProSeDirectCommunication.h \ - S1AP_PS-ServiceNotAvailable.h \ - S1AP_QCI.h \ - S1AP_ReceiveStatusofULPDCPSDUs.h \ - S1AP_ReceiveStatusOfULPDCPSDUsExtended.h \ - S1AP_ReceiveStatusOfULPDCPSDUsPDCP-SNlength18.h \ - S1AP_RecommendedCellsForPaging.h \ - S1AP_RecommendedCellList.h \ - S1AP_RecommendedCellItem.h \ - S1AP_RecommendedENBsForPaging.h \ - S1AP_RecommendedENBList.h \ - S1AP_RecommendedENBItem.h \ - S1AP_RelativeMMECapacity.h \ - S1AP_RelayNode-Indicator.h \ - S1AP_RAC.h \ - S1AP_RAT-Type.h \ - S1AP_ReportAmountMDT.h \ - S1AP_ReportIntervalMDT.h \ - S1AP_M1ReportingTrigger.h \ - S1AP_RequestType.h \ - S1AP_RIMTransfer.h \ - S1AP_RIMInformation.h \ - S1AP_RIMRoutingAddress.h \ - S1AP_ReportArea.h \ - S1AP_RepetitionPeriod.h \ - S1AP_RLFReportInformation.h \ - S1AP_RNC-ID.h \ - S1AP_RRC-Container.h \ - S1AP_RRC-Establishment-Cause.h \ - S1AP_ECGIListForRestart.h \ - S1AP_Routing-ID.h \ - S1AP_SecurityKey.h \ - S1AP_SecurityContext.h \ - S1AP_SerialNumber.h \ - S1AP_SONInformation.h \ - S1AP_SONInformation-Extension.h \ - S1AP_SONInformationRequest.h \ - S1AP_SONInformationReply.h \ - S1AP_SONInformationReport.h \ - S1AP_SONConfigurationTransfer.h \ - S1AP_SynchronisationInformation.h \ - S1AP_Source-ToTarget-TransparentContainer.h \ - S1AP_SourceBSS-ToTargetBSS-TransparentContainer.h \ - S1AP_SourceeNB-ID.h \ - S1AP_SRVCCOperationNotPossible.h \ - S1AP_SRVCCOperationPossible.h \ - S1AP_SRVCCHOIndication.h \ - S1AP_SourceeNB-ToTargeteNB-TransparentContainer.h \ - S1AP_SourceRNC-ToTargetRNC-TransparentContainer.h \ - S1AP_ServedGUMMEIs.h \ - S1AP_ServedGUMMEIsItem.h \ - S1AP_ServedGroupIDs.h \ - S1AP_ServedMMECs.h \ - S1AP_ServedPLMNs.h \ - S1AP_SubscriberProfileIDforRFP.h \ - S1AP_SupportedTAs.h \ - S1AP_SupportedTAs-Item.h \ - S1AP_StratumLevel.h \ - S1AP_SynchronisationStatus.h \ - S1AP_TimeSynchronisationInfo.h \ - S1AP_S-TMSI.h \ - S1AP_TAC.h \ - S1AP_TAIBasedMDT.h \ - S1AP_TAIListforMDT.h \ - S1AP_TAIListforWarning.h \ - S1AP_TAI.h \ - S1AP_TAI-Broadcast.h \ - S1AP_TAI-Broadcast-Item.h \ - S1AP_TAI-Cancelled.h \ - S1AP_TAI-Cancelled-Item.h \ - S1AP_TABasedMDT.h \ - S1AP_TAListforMDT.h \ - S1AP_CompletedCellinTAI.h \ - S1AP_CompletedCellinTAI-Item.h \ - S1AP_TBCD-STRING.h \ - S1AP_TargetID.h \ - S1AP_TargeteNB-ID.h \ - S1AP_TargetRNC-ID.h \ - S1AP_TargeteNB-ToSourceeNB-TransparentContainer.h \ - S1AP_Target-ToSource-TransparentContainer.h \ - S1AP_TargetRNC-ToSourceRNC-TransparentContainer.h \ - S1AP_TargetBSS-ToSourceBSS-TransparentContainer.h \ - S1AP_M1ThresholdEventA2.h \ - S1AP_Threshold-RSRP.h \ - S1AP_Threshold-RSRQ.h \ - S1AP_TimeToWait.h \ - S1AP_Time-UE-StayedInCell.h \ - S1AP_Time-UE-StayedInCell-EnhancedGranularity.h \ - S1AP_TransportInformation.h \ - S1AP_TransportLayerAddress.h \ - S1AP_TraceActivation.h \ - S1AP_TraceDepth.h \ - S1AP_E-UTRAN-Trace-ID.h \ - S1AP_TrafficLoadReductionIndication.h \ - S1AP_TunnelInformation.h \ - S1AP_TypeOfError.h \ - S1AP_TAIListForRestart.h \ - S1AP_UEAggregateMaximumBitrate.h \ - S1AP_UE-RetentionInformation.h \ - S1AP_UE-S1AP-IDs.h \ - S1AP_UE-S1AP-ID-pair.h \ - S1AP_UE-associatedLogicalS1-ConnectionItem.h \ - S1AP_UEIdentityIndexValue.h \ - S1AP_UE-HistoryInformation.h \ - S1AP_UE-HistoryInformationFromTheUE.h \ - S1AP_UEPagingID.h \ - S1AP_UERadioCapability.h \ - S1AP_UERadioCapabilityForPaging.h \ - S1AP_UE-RLF-Report-Container.h \ - S1AP_UE-RLF-Report-Container-for-extended-bands.h \ - S1AP_UESecurityCapabilities.h \ - S1AP_UESidelinkAggregateMaximumBitrate.h \ - S1AP_UE-Usage-Type.h \ - S1AP_UL-CP-SecurityInformation.h \ - S1AP_UL-NAS-MAC.h \ - S1AP_UL-NAS-Count.h \ - S1AP_UserLocationInformation.h \ - S1AP_UEUserPlaneCIoTSupportIndicator.h \ - S1AP_VoiceSupportMatchIndicator.h \ - S1AP_V2XServicesAuthorized.h \ - S1AP_VehicleUE.h \ - S1AP_PedestrianUE.h \ - S1AP_WarningAreaList.h \ - S1AP_WarningType.h \ - S1AP_WarningSecurityInfo.h \ - S1AP_WarningMessageContents.h \ - S1AP_X2TNLConfigurationInfo.h \ - S1AP_ENBX2ExtTLAs.h \ - S1AP_ENBX2ExtTLA.h \ - S1AP_ENBX2GTPTLAs.h \ - S1AP_ENBIndirectX2TransportLayerAddresses.h \ - S1AP_Criticality.h \ - S1AP_Presence.h \ - S1AP_PrivateIE-ID.h \ - S1AP_ProcedureCode.h \ - S1AP_ProtocolExtensionID.h \ - S1AP_ProtocolIE-ID.h \ - S1AP_TriggeringMessage.h \ - S1AP_ProtocolIE-Container.h \ - S1AP_ProtocolIE-SingleContainer.h \ - S1AP_ProtocolIE-Field.h \ - S1AP_ProtocolIE-ContainerPair.h \ - S1AP_ProtocolIE-FieldPair.h \ - S1AP_ProtocolIE-ContainerList.h \ - S1AP_ProtocolIE-ContainerPairList.h \ - S1AP_ProtocolExtensionContainer.h \ - S1AP_ProtocolExtensionField.h \ - S1AP_PrivateIE-Container.h \ - S1AP_PrivateIE-Field.h - -ASN_MODULE_HDRS+=ANY.h -ASN_MODULE_SRCS+=ANY.c -ASN_MODULE_HDRS+=OCTET_STRING.h -ASN_MODULE_HDRS+=OPEN_TYPE.h -ASN_MODULE_SRCS+=OPEN_TYPE.c -ASN_MODULE_HDRS+=constr_CHOICE.h -ASN_MODULE_HDRS+=BOOLEAN.h -ASN_MODULE_SRCS+=BOOLEAN.c -ASN_MODULE_HDRS+=INTEGER.h -ASN_MODULE_SRCS+=INTEGER.c -ASN_MODULE_HDRS+=NULL.h -ASN_MODULE_SRCS+=NULL.c -ASN_MODULE_HDRS+=NativeEnumerated.h -ASN_MODULE_SRCS+=NativeEnumerated.c -ASN_MODULE_HDRS+=NativeInteger.h -ASN_MODULE_SRCS+=NativeInteger.c -ASN_MODULE_HDRS+=OBJECT_IDENTIFIER.h -ASN_MODULE_SRCS+=OBJECT_IDENTIFIER.c -ASN_MODULE_HDRS+=PrintableString.h -ASN_MODULE_SRCS+=PrintableString.c -ASN_MODULE_HDRS+=asn_SEQUENCE_OF.h -ASN_MODULE_SRCS+=asn_SEQUENCE_OF.c -ASN_MODULE_HDRS+=asn_SET_OF.h -ASN_MODULE_SRCS+=asn_SET_OF.c -ASN_MODULE_SRCS+=constr_CHOICE.c -ASN_MODULE_HDRS+=constr_SEQUENCE.h -ASN_MODULE_SRCS+=constr_SEQUENCE.c -ASN_MODULE_HDRS+=constr_SEQUENCE_OF.h -ASN_MODULE_SRCS+=constr_SEQUENCE_OF.c -ASN_MODULE_HDRS+=constr_SET_OF.h -ASN_MODULE_SRCS+=constr_SET_OF.c -ASN_MODULE_HDRS+=asn_application.h -ASN_MODULE_SRCS+=asn_application.c -ASN_MODULE_HDRS+=asn_ioc.h -ASN_MODULE_HDRS+=asn_system.h -ASN_MODULE_HDRS+=asn_codecs.h -ASN_MODULE_HDRS+=asn_internal.h -ASN_MODULE_SRCS+=asn_internal.c -ASN_MODULE_HDRS+=asn_random_fill.h -ASN_MODULE_SRCS+=asn_random_fill.c -ASN_MODULE_HDRS+=asn_bit_data.h -ASN_MODULE_SRCS+=asn_bit_data.c -ASN_MODULE_SRCS+=OCTET_STRING.c -ASN_MODULE_HDRS+=BIT_STRING.h -ASN_MODULE_SRCS+=BIT_STRING.c -ASN_MODULE_SRCS+=asn_codecs_prim.c -ASN_MODULE_HDRS+=asn_codecs_prim.h -ASN_MODULE_HDRS+=ber_tlv_length.h -ASN_MODULE_SRCS+=ber_tlv_length.c -ASN_MODULE_HDRS+=ber_tlv_tag.h -ASN_MODULE_SRCS+=ber_tlv_tag.c -ASN_MODULE_HDRS+=ber_decoder.h -ASN_MODULE_SRCS+=ber_decoder.c -ASN_MODULE_HDRS+=der_encoder.h -ASN_MODULE_SRCS+=der_encoder.c -ASN_MODULE_HDRS+=constr_TYPE.h -ASN_MODULE_SRCS+=constr_TYPE.c -ASN_MODULE_HDRS+=constraints.h -ASN_MODULE_SRCS+=constraints.c -ASN_MODULE_HDRS+=xer_support.h -ASN_MODULE_SRCS+=xer_support.c -ASN_MODULE_HDRS+=xer_decoder.h -ASN_MODULE_SRCS+=xer_decoder.c -ASN_MODULE_HDRS+=xer_encoder.h -ASN_MODULE_SRCS+=xer_encoder.c -ASN_MODULE_HDRS+=per_support.h -ASN_MODULE_SRCS+=per_support.c -ASN_MODULE_HDRS+=per_decoder.h -ASN_MODULE_SRCS+=per_decoder.c -ASN_MODULE_HDRS+=per_encoder.h -ASN_MODULE_SRCS+=per_encoder.c -ASN_MODULE_HDRS+=per_opentype.h -ASN_MODULE_SRCS+=per_opentype.c -ASN_MODULE_HDRS+=oer_decoder.h -ASN_MODULE_HDRS+=oer_encoder.h -ASN_MODULE_HDRS+=oer_support.h -ASN_MODULE_SRCS+=oer_decoder.c -ASN_MODULE_SRCS+=oer_encoder.c -ASN_MODULE_SRCS+=oer_support.c -ASN_MODULE_SRCS+=OPEN_TYPE_oer.c -ASN_MODULE_SRCS+=INTEGER_oer.c -ASN_MODULE_SRCS+=BIT_STRING_oer.c -ASN_MODULE_SRCS+=OCTET_STRING_oer.c -ASN_MODULE_SRCS+=NativeInteger_oer.c -ASN_MODULE_SRCS+=NativeEnumerated_oer.c -ASN_MODULE_SRCS+=constr_CHOICE_oer.c -ASN_MODULE_SRCS+=constr_SEQUENCE_oer.c -ASN_MODULE_SRCS+=constr_SET_OF_oer.c - -ASN_MODULE_CFLAGS= - -pkglib_LTLIBRARIES=libs1apasn1c.la -libs1apasn1c_la_SOURCES=$(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS) - -libs1apasn1c_la_DEPENDENCIES = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(NULL) - -libs1apasn1c_la_LIBADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(NULL) - -AM_LDFLAGS = \ - -version-info @LIBVERSION@ \ - $(NULL) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ - $(NULL) - -AM_CFLAGS = \ - ${ASN_MODULE_CFLAGS} \ - -Wno-parentheses-equality -Wno-overflow -Wno-format \ - $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump - -regen: regenerate-from-asn1-source - -regenerate-from-asn1-source: - ASN1C_PREFIX=S1AP_ ../../../../asn1c.velichkov/asn1c/asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps ../support/r14.4.0/36413-e40.asn - rm -f S1AP_E-RAB-IE-ContainerPairList.c S1AP_ProtocolError-IE-ContainerList.c S1AP_ProtocolIE-ContainerPair.c S1AP_ProtocolIE-FieldPair.c S1AP_ProtocolIE-ContainerPairList.c - rm -f converter-example.mk converter-example.c pdu_collection.c - rm -f Makefile.am.asn1convert Makefile.am.libasncodec - diff --git a/lib/s1ap/s1ap_decoder.c b/lib/s1ap/s1ap_decoder.c deleted file mode 100644 index d73395245..000000000 --- a/lib/s1ap/s1ap_decoder.c +++ /dev/null @@ -1,27 +0,0 @@ -#define TRACE_MODULE _s1ap_decoder - -#include "s1ap_message.h" - -status_t s1ap_decode_pdu(s1ap_message_t *message, pkbuf_t *pkbuf) -{ - asn_dec_rval_t dec_ret = {0}; - - d_assert(message, return CORE_ERROR,); - d_assert(pkbuf, return CORE_ERROR,); - d_assert(pkbuf->payload, return CORE_ERROR,); - - memset((void *)message, 0, sizeof(s1ap_message_t)); - dec_ret = aper_decode(NULL, &asn_DEF_S1AP_S1AP_PDU, (void **)&message, - pkbuf->payload, pkbuf->len, 0, 0); - - if (dec_ret.code != RC_OK) - { - d_error("Failed to decode S1AP-PDU[%d]", dec_ret.code); - return CORE_ERROR; - } - - if (g_trace_mask && TRACE_MODULE >= 25) - asn_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, message); - - return CORE_OK; -} diff --git a/lib/s1ap/s1ap_encoder.c b/lib/s1ap/s1ap_encoder.c deleted file mode 100644 index b97b74246..000000000 --- a/lib/s1ap/s1ap_encoder.c +++ /dev/null @@ -1,31 +0,0 @@ -#define TRACE_MODULE _s1ap_encoder - -#include "3gpp_types.h" - -#include "s1ap_message.h" - -status_t s1ap_encode_pdu(pkbuf_t **pkbuf, s1ap_message_t *message) -{ - asn_enc_rval_t enc_ret = {0}; - - d_assert(message, return CORE_ERROR,); - - if (g_trace_mask && TRACE_MODULE >= 25) - asn_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, message); - - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - d_assert(*pkbuf, return CORE_ERROR,); - - enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_S1AP_PDU, NULL, - message, (*pkbuf)->payload, MAX_SDU_LEN); - if (enc_ret.encoded < 0) - { - d_error("Failed to decode S1AP-PDU[%d]", enc_ret.encoded); - pkbuf_free(*pkbuf); - return CORE_ERROR; - } - - (*pkbuf)->len = (enc_ret.encoded >> 3); - - return CORE_OK; -} diff --git a/lib/s1ap/s1ap_free.c b/lib/s1ap/s1ap_free.c deleted file mode 100644 index d669fc689..000000000 --- a/lib/s1ap/s1ap_free.c +++ /dev/null @@ -1,12 +0,0 @@ -#define TRACE_MODULE _s1ap_free - -#include "s1ap_message.h" - -status_t s1ap_free_pdu(s1ap_message_t *message) -{ - d_assert(message, return CORE_ERROR,); - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, message); - - return CORE_OK; -} diff --git a/lib/s1ap/s1ap_message.h b/lib/s1ap/s1ap_message.h deleted file mode 100644 index 1ed334f9a..000000000 --- a/lib/s1ap/s1ap_message.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _S1AP_MESSAGE_H__ -#define _S1AP_MESSAGE_H__ - -#include "core_pkbuf.h" -#include "s1ap_asn1c.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Octets */ -#define S1AP_CLEAR_DATA(__dATA) \ - do { \ - d_assert((__dATA), , "Null param"); \ - if ((__dATA)->buf) \ - { \ - CORE_FREE((__dATA)->buf); \ - (__dATA)->buf = NULL; \ - (__dATA)->size = 0; \ - } \ - } while(0) -#define S1AP_STORE_DATA(__dST, __sRC) \ - do { \ - d_assert((__sRC),, "Null param") \ - d_assert((__sRC)->buf,, "Null param") \ - d_assert((__dST),, "Null param") \ - S1AP_CLEAR_DATA(__dST); \ - (__dST)->size = (__sRC)->size; \ - (__dST)->buf = core_calloc((__dST)->size, sizeof(c_uint8_t)); \ - memcpy((__dST)->buf, (__sRC)->buf, (__dST)->size); \ - } while(0) - -typedef struct S1AP_S1AP_PDU s1ap_message_t; - -CORE_DECLARE(int) s1ap_decode_pdu(s1ap_message_t *message, pkbuf_t *pkbuf); -CORE_DECLARE(int) s1ap_encode_pdu(pkbuf_t **pkbuf, s1ap_message_t *message); -CORE_DECLARE(int) s1ap_free_pdu(s1ap_message_t *message); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 000000000..bd753b34d --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_recursive_eval.m4 b/m4/ax_recursive_eval.m4 new file mode 100644 index 000000000..0625aca22 --- /dev/null +++ b/m4/ax_recursive_eval.m4 @@ -0,0 +1,56 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_recursive_eval.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_RECURSIVE_EVAL(VALUE, RESULT) +# +# DESCRIPTION +# +# Interpolate the VALUE in loop until it doesn't change, and set the +# result to $RESULT. WARNING: It's easy to get an infinite loop with some +# unsane input. +# +# LICENSE +# +# Copyright (c) 2008 Alexandre Duret-Lutz +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 1 + +AC_DEFUN([AX_RECURSIVE_EVAL], +[_lcl_receval="$1" +$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + _lcl_receval_old='' + while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do + _lcl_receval_old="[$]_lcl_receval" + eval _lcl_receval="\"[$]_lcl_receval\"" + done + echo "[$]_lcl_receval")`]) diff --git a/main.c b/main.c index d26d23b61..b6f2c6552 100644 --- a/main.c +++ b/main.c @@ -2,30 +2,27 @@ * @file main.c */ -/* Core library */ -#define TRACE_MODULE _main_ -#include "core_general.h" -#include "core_debug.h" -#include "core_signal.h" +#include "ogs-core.h" +#include "base/context.h" /* Server */ -#include "common/application.h" +#include "app/application.h" #include "app_init.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdate-time" -static char *compile_time = __DATE__ " " __TIME__; +static char *version = "NextEPC daemon v" \ + PACKAGE_VERSION " - "__DATE__ " " __TIME__; #pragma GCC diagnostic pop static void show_version() { - printf("NextEPC daemon v%s - %s\n", - PACKAGE_VERSION, compile_time); + printf("%s", version); } static void show_help(const char *name) { - show_version(); + printf("%s", version); printf("\n" "Usage: %s [arguments]\n" @@ -33,10 +30,12 @@ static void show_help(const char *name) "Arguments:\n" " -v Show version\n" " -h Show help\n" - " -d Start as daemon\n" + " -D Start as daemon\n" " -f Set configuration file name\n" " -l log_file Log file path to be logged to\n" " -p pid_file PID file path\n" + " -d core:gtp:event Enable debugging\n" + " -t sock:mem: Enable trace\n" "\n", name); } @@ -47,24 +46,21 @@ static int check_signal(int signum) case SIGTERM: case SIGINT: { - d_info("%s received", + ogs_info("%s received", signum == SIGTERM ? "SIGTERM" : "SIGINT"); return 1; } case SIGHUP: { - d_info("SIGHUP received"); + ogs_info("SIGHUP received"); app_logger_restart(); break; } - case SIGUSR1: - { - break; - } default: { - d_error("Unknown signal number = %d\n", signum); + ogs_error("Signal-%d received (%s)", + signum, ogs_signal_description_get(signum)); break; } @@ -75,7 +71,8 @@ static int check_signal(int signum) void terminate() { app_terminate(); - core_terminate(); + base_finalize(); + ogs_core_finalize(); } int main(int argc, char *argv[]) @@ -85,79 +82,98 @@ int main(int argc, char *argv[]) * * Keep the order of starting-up */ - status_t rv; - char *config_path = NULL; - char *log_path = NULL; - char *pid_path = NULL; + int rv; + int i; + app_param_t param; + const char *debug_mask = NULL; + const char *trace_mask = NULL; - while (1) + memset(¶m, 0, sizeof(param)); + for (i = 1; i < argc; i++) { - int opt = getopt (argc, argv, "vhdf:l:p:"); - if (opt == -1) - break; - - switch (opt) + if (!strcmp(argv[i], "-v")) { - case 'v': - show_version(); - return EXIT_SUCCESS; - case 'h': - show_help(argv[0]); - return EXIT_SUCCESS; - case 'd': + show_version(); + return EXIT_SUCCESS; + } + if (!strcmp(argv[i], "-h")) + { + show_help(argv[0]); + return EXIT_SUCCESS; + } + if (!strcmp(argv[i], "-D")) + { + pid_t pid; + pid = fork(); + + ogs_assert(pid >= 0); + + if (pid != 0) { - pid_t pid; - pid = fork(); - - d_assert(pid >= 0, return EXIT_FAILURE, "fork() failed"); - - if (pid != 0) - { - /* Parent */ - return EXIT_SUCCESS; - } - /* Child */ - - setsid(); - umask(027); - break; + /* Parent */ + return EXIT_SUCCESS; } - case 'f': - config_path = optarg; - break; - case 'l': - log_path = optarg; - break; - case 'p': - pid_path = optarg; - break; - default: - show_help(argv[0]); - return EXIT_FAILURE; + /* Child */ + + setsid(); + umask(027); + continue; + } + if (!strcmp(argv[i], "-f")) + { + param.config_path = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-l")) + { + param.log_path = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-p")) + { + param.pid_path = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-d")) + { + param.log_level = OGS_LOG_DEBUG; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-t")) + { + param.log_level = OGS_LOG_TRACE; + param.log_domain = argv[++i]; + continue; + } + if (argv[i][0] == '-') { + show_help(argv[0]); + return EXIT_FAILURE; } } - show_version(); - d_print("\n"); - atexit(terminate); + ogs_core_initialize(); + ogs_setup_signal_thread(); + base_initialize(); - core_initialize(); - rv = app_initialize(config_path, log_path, pid_path); - if (rv != CORE_OK) + ogs_info("NextEPC daemon start"); + ogs_log_print(OGS_LOG_INFO, "\n"); + + rv = app_initialize(¶m); + if (rv != OGS_OK) { - if (rv == CORE_EAGAIN) + if (rv == OGS_RETRY) return EXIT_SUCCESS; - d_fatal("NextEPC initialization failed. Aborted"); + ogs_fatal("NextEPC initialization failed. Aborted"); return EXIT_FAILURE; } - d_print("\n\n"); - d_info("NextEPC daemon start"); - signal_thread(check_signal); + ogs_log_print(OGS_LOG_INFO, "\n\n%s\n\n", version); + ogs_signal_thread(check_signal); - d_info("NextEPC daemon terminating..."); + ogs_info("NextEPC daemon terminating..."); return EXIT_SUCCESS; } diff --git a/src/Makefile.am b/src/Makefile.am index 6a71d6b37..7bbeaa6c7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,36 +1,61 @@ ## Process this file with automake to produce Makefile.in. -SUBDIRS = common mme hss sgw pgw pcrf +SUBDIRS = app mme hss sgw pgw pcrf noinst_LTLIBRARIES = libmme.la libhss.la libsgw.la libpgw.la libpcrf.la libepc.la libmme_la_SOURCES = mme.c -libmme_la_DEPENDENCIES = $(top_srcdir)/src/mme/libmme.la -libmme_la_LIBADD = $(top_srcdir)/src/mme/libmme.la +libmme_la_DEPENDENCIES = \ + $(top_srcdir)/src/mme/libmme.la \ + @OGSCRYPT_LIBS@ \ + $(NULL) +libmme_la_LIBADD = \ + $(top_srcdir)/src/mme/libmme.la \ + @OGSCRYPT_LIBS@ \ + $(NULL) libhss_la_SOURCES = hss.c -libhss_la_DEPENDENCIES = $(top_srcdir)/src/hss/libhss.la -libhss_la_LIBADD = $(top_srcdir)/src/hss/libhss.la +libhss_la_DEPENDENCIES = \ + $(top_srcdir)/src/hss/libhss.la \ + @OGSCRYPT_LIBS@ \ + $(NULL) +libhss_la_LIBADD = \ + $(top_srcdir)/src/hss/libhss.la \ + @OGSCRYPT_LIBS@ \ + $(NULL) libsgw_la_SOURCES = sgw.c -libsgw_la_DEPENDENCIES = $(top_srcdir)/src/sgw/libsgw.la -libsgw_la_LIBADD = $(top_srcdir)/src/sgw/libsgw.la +libsgw_la_DEPENDENCIES = \ + $(top_srcdir)/src/sgw/libsgw.la \ + $(NULL) +libsgw_la_LIBADD = \ + $(top_srcdir)/src/sgw/libsgw.la \ + $(NULL) libpgw_la_SOURCES = pgw.c -libpgw_la_DEPENDENCIES = $(top_srcdir)/src/pgw/libpgw.la -libpgw_la_LIBADD = $(top_srcdir)/src/pgw/libpgw.la +libpgw_la_DEPENDENCIES = \ + $(top_srcdir)/src/pgw/libpgw.la \ + $(NULL) +libpgw_la_LIBADD = \ + $(top_srcdir)/src/pgw/libpgw.la \ + $(NULL) libpcrf_la_SOURCES = pcrf.c -libpcrf_la_DEPENDENCIES = $(top_srcdir)/src/pcrf/libpcrf.la -libpcrf_la_LIBADD = $(top_srcdir)/src/pcrf/libpcrf.la +libpcrf_la_DEPENDENCIES = \ + $(top_srcdir)/src/pcrf/libpcrf.la \ + $(NULL) +libpcrf_la_LIBADD = \ + $(top_srcdir)/src/pcrf/libpcrf.la \ + $(NULL) -libepc_la_SOURCES = epc.c +libepc_la_SOURCES = app_init.h epc.c libepc_la_DEPENDENCIES = \ $(top_srcdir)/src/mme/libmme.la \ $(top_srcdir)/src/hss/libhss.la \ $(top_srcdir)/src/sgw/libsgw.la \ $(top_srcdir)/src/pgw/libpgw.la \ $(top_srcdir)/src/pcrf/libpcrf.la \ + @OGSCRYPT_LIBS@ \ $(NULL) libepc_la_LIBADD = \ $(top_srcdir)/src/mme/libmme.la \ @@ -38,16 +63,14 @@ libepc_la_LIBADD = \ $(top_srcdir)/src/sgw/libsgw.la \ $(top_srcdir)/src/pgw/libpgw.la \ $(top_srcdir)/src/pcrf/libpcrf.la \ + @OGSCRYPT_LIBS@ \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/src \ $(NULL) AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/src/common/Makefile.am b/src/app/Makefile.am similarity index 55% rename from src/common/Makefile.am rename to src/app/Makefile.am index 2852a92bf..7301e2790 100644 --- a/src/common/Makefile.am +++ b/src/app/Makefile.am @@ -1,25 +1,27 @@ ## Process this file with automake to produce Makefile.in. -noinst_LTLIBRARIES = libcommon.la +noinst_LTLIBRARIES = libapp.la -libcommon_la_SOURCES = \ - context.h application.h yaml_helper.h \ - context.c application.c yaml_helper.c \ +libapp_la_SOURCES = \ + ogs-yaml.h ogs-yaml.c \ + context.h application.h context.c application.c \ $(NULL) -libcommon_la_DEPENDENCIES = \ - $(top_srcdir)/lib/core/src/libcore.la \ - $(NULL) - -libcommon_la_LIBADD = \ - $(top_srcdir)/lib/core/src/libcore.la \ +libapp_la_LIBADD = \ + @OGSCORE_LIBS@ \ @YAML_LIBS@ \ @MONGOC_LIBS@ \ $(NULL) + +libapp_la_DEPENDENCIES = \ + @OGSCORE_LIBS@ \ + $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ + @YAML_CFLAGS@ \ @MONGOC_CFLAGS@ \ + -I$(top_srcdir)/lib \ $(NULL) AM_CFLAGS = \ diff --git a/src/app/application.c b/src/app/application.c new file mode 100644 index 000000000..85cf93c47 --- /dev/null +++ b/src/app/application.c @@ -0,0 +1,164 @@ +#include "base/types.h" + +#include "context.h" +#include "application.h" + +#define DEFAULT_CONFIG_FILE_PATH SYSCONF_DIR "nextepc/nextepc.conf" +#define DEFAULT_RUNTIME_DIR_PATH LOCALSTATE_DIR "run/" + +static int log_pid(const char *app_name, const char *pid_path); + +int app_will_initialize(app_param_t *param) +{ + int rv; + ogs_assert(param); + + context_init(); + + if (param->name) + { + rv = log_pid(param->name, param->pid_path); + if (rv != OGS_OK) return rv; + } + + context_self()->config.path = param->config_path; + if (context_self()->config.path == NULL) + context_self()->config.path = DEFAULT_CONFIG_FILE_PATH; + + rv = context_read_file(); + if (rv != OGS_OK) return rv; + + rv = context_parse_config(); + if (rv != OGS_OK) return rv; + + context_self()->log.path = param->log_path; + + if (param->logfile_disabled == false && + context_self()->config.logger.file) + { + if (context_self()->log.path) + context_self()->config.logger.file = context_self()->log.path; + + if (ogs_log_add_file(context_self()->config.logger.file) == NULL) + { + ogs_fatal("cannot open log file : %s", + context_self()->config.logger.file); + ogs_assert_if_reached(); + } + + ogs_log_print(OGS_LOG_INFO, + "File Logging: '%s'\n", context_self()->config.logger.file); + } + if (context_self()->config.logger.level) + { + if (!strcasecmp(context_self()->config.logger.level, "none")) + context_self()->log.level = OGS_LOG_NONE; + else if (!strcasecmp(context_self()->config.logger.level, "fatal")) + context_self()->log.level = OGS_LOG_FATAL; + else if (!strcasecmp(context_self()->config.logger.level, "error")) + context_self()->log.level = OGS_LOG_ERROR; + else if (!strcasecmp(context_self()->config.logger.level, "warn")) + context_self()->log.level = OGS_LOG_WARN; + else if (!strcasecmp(context_self()->config.logger.level, "info")) + context_self()->log.level = OGS_LOG_INFO; + else if (!strcasecmp(context_self()->config.logger.level, "debug")) + context_self()->log.level = OGS_LOG_DEBUG; + else if (!strcasecmp(context_self()->config.logger.level, "trace")) + context_self()->log.level = OGS_LOG_TRACE; + else { + ogs_error("Invalid LOG-LEVEL : %s\n", + context_self()->config.logger.level); + return OGS_ERROR; + } + ogs_log_print(OGS_LOG_INFO, + "LOG-LEVEL: '%s'\n", context_self()->config.logger.level); + } + if (context_self()->config.logger.domain) + { + context_self()->log.domain = context_self()->config.logger.domain; + ogs_log_print(OGS_LOG_INFO, + "LOG-DOMAIN: '%s'\n", context_self()->config.logger.domain); + } + + if (param->log_level) + { + context_self()->log.level = param->log_level; + context_self()->log.domain = param->log_domain; + } + + rv = context_setup_log_module(); + if (rv != OGS_OK) return rv; + + if (param->db_disabled == false && + context_self()->config.db_uri) + { + /* Override configuration if DB_URI environment variable is existed */ + if (ogs_env_get("DB_URI")) + context_self()->config.db_uri = ogs_env_get("DB_URI"); + + rv = context_db_init(context_self()->config.db_uri); + if (rv != OGS_OK) return rv; + ogs_log_print(OGS_LOG_INFO, "MongoDB URI: '%s'\n", + context_self()->config.db_uri); + } + ogs_log_print(OGS_LOG_INFO, "Configuration: '%s'\n", + context_self()->config.path); + + return rv; +} + +int app_did_initialize(void) +{ + return OGS_OK; +} + +void app_will_terminate(void) +{ + if (context_self()->config.db_uri) + { + ogs_info("DB-Client try to terminate"); + context_db_final(); + ogs_info("DB-Client terminate...done"); + } +} + +void app_did_terminate(void) +{ + context_final(); +} + +static int log_pid(const char *app_name, const char *pid_path) +{ + FILE *pid_file = NULL; + pid_t mypid; + char default_pid_path[MAX_FILEPATH_LEN]; + + if (pid_path == NULL) + { + ogs_snprintf(default_pid_path, sizeof(default_pid_path), + "%snextepc-%sd/pid", DEFAULT_RUNTIME_DIR_PATH, app_name); + pid_path = default_pid_path; + } + + mypid = getpid(); + pid_file = fopen(pid_path, "w"); + if (!pid_file) + { + ogs_error("CHECK PERMISSION of Installation Directory..."); + ogs_error("Cannot create PID file:`%s`", pid_path); + ogs_assert_if_reached(); + } + fprintf(pid_file, "%d\n", (int)mypid); + fclose(pid_file); + + ogs_log_print(OGS_LOG_INFO, "PID[%d]: '%s'\n", (int)mypid, pid_path); + + return OGS_OK; +} + +int app_logger_restart() +{ + ogs_log_cycle(); + + return OGS_OK; +} diff --git a/src/app/application.h b/src/app/application.h new file mode 100644 index 000000000..08bedd658 --- /dev/null +++ b/src/app/application.h @@ -0,0 +1,36 @@ +#ifndef __APPLICATION_H__ +#define __APPLICATION_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct app_param_s { + const char *name; + + const char *config_path; + const char *log_path; + const char *pid_path; + + bool logfile_disabled; + bool db_disabled; + + ogs_log_level_e log_level; + const char *log_domain; +} app_param_t; + +int app_will_initialize(app_param_t *param); +int app_did_initialize(void); +void app_will_terminate(void); +void app_did_terminate(void); + +int config_initialize(const char *config_path); +void config_terminate(void); + +int app_logger_restart(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __APPLICATION_H__ */ diff --git a/src/app/context.c b/src/app/context.c new file mode 100644 index 000000000..63680e099 --- /dev/null +++ b/src/app/context.c @@ -0,0 +1,352 @@ +#include +#include + +#include "context.h" + +#define DEFAULT_SCTP_STREAMS 30 + +static context_t self; + +static int context_initialized = 0; + +int context_init() +{ + ogs_assert(context_initialized == 0); + + memset(&self, 0, sizeof(context_t)); + + context_initialized = 1; + + return OGS_OK; +} + +int context_final() +{ + ogs_assert(context_initialized == 1); + + if (self.config.document) + { + yaml_document_delete(self.config.document); + ogs_free(self.config.document); + } + + context_initialized = 0; + + return OGS_OK; +} + +context_t* context_self() +{ + return &self; +} + +int context_read_file() +{ + config_t *config = &self.config; + FILE *file; + yaml_parser_t parser; + yaml_document_t *document = NULL; + + ogs_assert(config->path); + + file = fopen(config->path, "rb"); + if (!file) + { + ogs_fatal("cannot open file `%s`", config->path); + ogs_assert_if_reached(); + } + + ogs_assert(yaml_parser_initialize(&parser)); + yaml_parser_set_input_file(&parser, file); + + document = ogs_calloc(1, sizeof(yaml_document_t)); + if (!yaml_parser_load(&parser, document)) + { + ogs_fatal("Failed to parse configuration file '%s'", config->path); + switch (parser.error) + { + case YAML_MEMORY_ERROR: + ogs_error("Memory error: Not enough memory for parsing"); + break; + case YAML_READER_ERROR: + if (parser.problem_value != -1) + ogs_error("Reader error - %s: #%X at %zd", parser.problem, + parser.problem_value, parser.problem_offset); + else + ogs_error("Reader error - %s at %zd", parser.problem, + parser.problem_offset); + break; + case YAML_SCANNER_ERROR: + if (parser.context) + ogs_error("Scanner error - %s at line %zu, column %zu" + "%s at line %zu, column %zu", parser.context, + parser.context_mark.line+1, + parser.context_mark.column+1, + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); + else + ogs_error("Scanner error - %s at line %zu, column %zu", + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); + break; + case YAML_PARSER_ERROR: + if (parser.context) + ogs_error("Parser error - %s at line %zu, column %zu" + "%s at line %zu, column %zu", parser.context, + parser.context_mark.line+1, + parser.context_mark.column+1, + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); + else + ogs_error("Parser error - %s at line %zu, column %zu", + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); + break; + default: + /* Couldn't happen. */ + ogs_assert_if_reached(); + break; + } + + ogs_free(document); + yaml_parser_delete(&parser); + ogs_assert(!fclose(file)); + return OGS_ERROR; + } + + config->document = document; + + yaml_parser_delete(&parser); + ogs_assert(!fclose(file)); + + return OGS_OK; +} + +int context_setup_log_module() +{ + if (context_self()->log.level || context_self()->log.domain) + ogs_log_set_mask_level(context_self()->log.domain, + context_self()->log.level); + + return OGS_OK; +} + +static int context_prepare() +{ + self.config.parameter.sctp_streams = DEFAULT_SCTP_STREAMS; + + return OGS_OK; +} + +static int context_validation() +{ + if (self.config.parameter.no_ipv4 == 1 && + self.config.parameter.no_ipv6 == 1) + { + ogs_error("Both `no_ipv4` and `no_ipv6` set to `true` in `%s`", + context_self()->config.path); + return OGS_ERROR; + } + + return OGS_OK; +} +int context_parse_config() +{ + int rv; + config_t *config = &self.config; + yaml_document_t *document = NULL; + ogs_yaml_iter_t root_iter; + + ogs_assert(config); + document = config->document; + ogs_assert(document); + + rv = context_prepare(); + if (rv != OGS_OK) return rv; + + ogs_yaml_iter_init(&root_iter, document); + while(ogs_yaml_iter_next(&root_iter)) + { + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); + if (!strcmp(root_key, "db_uri")) + { + self.config.db_uri = ogs_yaml_iter_value(&root_iter); + } + else if (!strcmp(root_key, "logger")) + { + ogs_yaml_iter_t logger_iter; + ogs_yaml_iter_recurse(&root_iter, &logger_iter); + while(ogs_yaml_iter_next(&logger_iter)) + { + const char *logger_key = ogs_yaml_iter_key(&logger_iter); + ogs_assert(logger_key); + if (!strcmp(logger_key, "file")) + { + self.config.logger.file = ogs_yaml_iter_value(&logger_iter); + } + else if (!strcmp(logger_key, "level")) + { + self.config.logger.level = + ogs_yaml_iter_value(&logger_iter); + } + else if (!strcmp(logger_key, "domain")) + { + self.config.logger.domain = + ogs_yaml_iter_value(&logger_iter); + } + } + } + else if (!strcmp(root_key, "parameter")) + { + ogs_yaml_iter_t parameter_iter; + ogs_yaml_iter_recurse(&root_iter, ¶meter_iter); + while(ogs_yaml_iter_next(¶meter_iter)) + { + const char *parameter_key = ogs_yaml_iter_key(¶meter_iter); + ogs_assert(parameter_key); + if (!strcmp(parameter_key, "no_hss")) + { + self.config.parameter.no_hss = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "no_sgw")) + { + self.config.parameter.no_sgw = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "no_pgw")) + { + self.config.parameter.no_pgw = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "no_pcrf")) + { + self.config.parameter.no_pcrf = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "sctp_streams")) + { + const char *v = ogs_yaml_iter_value(¶meter_iter); + if (v) self.config.parameter.sctp_streams = atoi(v); + } + else if (!strcmp(parameter_key, "no_ipv4")) + { + self.config.parameter.no_ipv4 = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "no_ipv6")) + { + self.config.parameter.no_ipv6 = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "prefer_ipv4")) + { + self.config.parameter.prefer_ipv4 = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "multicast")) + { + self.config.parameter.multicast = + ogs_yaml_iter_bool(¶meter_iter); + } + else if (!strcmp(parameter_key, "no_slaac")) + { + self.config.parameter.no_slaac = + ogs_yaml_iter_bool(¶meter_iter); + } + else + ogs_warn("unknown key `%s`", parameter_key); + } + } + } + + rv = context_validation(); + if (rv != OGS_OK) return rv; + + return OGS_OK; +} + +/* + * We've added it + * Because the following function is deprecated in the mongo-c-driver + */ +static bool +context_mongoc_client_get_server_status (mongoc_client_t *client, /* IN */ + mongoc_read_prefs_t *read_prefs, /* IN */ + bson_t *reply, /* OUT */ + bson_error_t *error) /* OUT */ +{ + bson_t cmd = BSON_INITIALIZER; + bool ret = false; + + BSON_ASSERT (client); + + BSON_APPEND_INT32 (&cmd, "serverStatus", 1); + ret = mongoc_client_command_simple ( + client, "admin", &cmd, read_prefs, reply, error); + bson_destroy (&cmd); + + return ret; +} + +int context_db_init(const char *db_uri) +{ + bson_t reply; + bson_error_t error; + bson_iter_t iter; + + const mongoc_uri_t *uri; + + mongoc_init(); + + self.db.client = mongoc_client_new(db_uri); + if (!self.db.client) + { + ogs_error("Failed to parse DB URI [%s]", db_uri); + return OGS_ERROR; + } + +#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 4 + mongoc_client_set_error_api(self.db.client, 2); +#endif + + uri = mongoc_client_get_uri(self.db.client); + ogs_assert(uri); + + self.db.name = mongoc_uri_get_database(uri); + ogs_assert(self.db.name); + + self.db.database = mongoc_client_get_database(self.db.client, self.db.name); + ogs_assert(self.db.database); + + if (!context_mongoc_client_get_server_status( + self.db.client, NULL, &reply, &error)) + { + ogs_error("Failed to connect to server [%s]", db_uri); + return OGS_RETRY; + } + + ogs_assert(bson_iter_init_find(&iter, &reply, "ok")); + + bson_destroy(&reply); + return OGS_OK; +} + +int context_db_final() +{ + if (self.db.database) + { + mongoc_database_destroy(self.db.database); + self.db.database = NULL; + } + if (self.db.client) + { + mongoc_client_destroy(self.db.client); + self.db.client = NULL; + } + + mongoc_cleanup(); + + return OGS_OK; +} diff --git a/src/app/context.h b/src/app/context.h new file mode 100644 index 000000000..cb799b4f7 --- /dev/null +++ b/src/app/context.h @@ -0,0 +1,78 @@ +#ifndef __CONTEXT_H__ +#define __CONTEXT_H__ + +#include "ogs-core.h" +#include "ogs-yaml.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define MAX_CONFIG_FILE_SIZE 2048 +#define MAX_NUM_OF_CONFIG_TOKEN 256 + +typedef struct _config_t { + const char *path; + void *document; + + const char *db_uri; + struct { + const char *file; + const char *level; + const char *domain; + } logger; + + struct { + /* Element */ + int no_hss; + int no_sgw; + int no_pgw; + int no_pcrf; + + /* Network */ + int sctp_streams; + int no_ipv4; + int no_ipv6; + int prefer_ipv4; + int multicast; + int no_slaac; + } parameter; + +} config_t; + +#define MAX_DB_URI_LEN 256 + +typedef struct _context_t { + config_t config; + + struct { + const char *name; + void *uri; + void *client; + void *database; + } db; + + struct { + const char *path; + ogs_log_level_e level; + const char *domain; + } log; + +} context_t; + +int context_init(void); +int context_final(void); +context_t *context_self(void); + +int context_read_file(void); +int context_parse_config(void); +int context_setup_log_module(void); + +int context_db_init(const char *db_uri); +int context_db_final(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CONTEXT_H__ */ diff --git a/src/common/yaml_helper.c b/src/app/ogs-yaml.c similarity index 52% rename from src/common/yaml_helper.c rename to src/app/ogs-yaml.c index 82f586ebe..360d0d45f 100644 --- a/src/common/yaml_helper.c +++ b/src/app/ogs-yaml.c @@ -1,29 +1,48 @@ -#define TRACE_MODULE _yaml_helper +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "yaml_helper.h" +#include "ogs-yaml.h" -void yaml_iter_init(yaml_iter_t *iter, yaml_document_t *document) +#include + +void ogs_yaml_iter_init(ogs_yaml_iter_t *iter, yaml_document_t *document) { - d_assert(iter, return,); - d_assert(document, return,); + ogs_assert(iter); + ogs_assert(document); - memset(iter, 0, sizeof(yaml_iter_t)); + memset(iter, 0, sizeof(ogs_yaml_iter_t)); iter->document = document; iter->node = yaml_document_get_root_node(document); - d_assert(iter->node, return,); + ogs_assert(iter->node); if (iter->node->type == YAML_MAPPING_NODE) iter->pair = iter->node->data.mapping.pairs.start - 1; else if (iter->node->type == YAML_SEQUENCE_NODE) iter->item = iter->node->data.sequence.items.start - 1; } -int yaml_iter_next(yaml_iter_t *iter) +int ogs_yaml_iter_next(ogs_yaml_iter_t *iter) { - d_assert(iter, return 0,); - d_assert(iter->document, return 0,); - d_assert(iter->node, return 0,); + ogs_assert(iter); + ogs_assert(iter->document); + ogs_assert(iter->node); if (iter->node->type == YAML_MAPPING_NODE) { @@ -48,23 +67,23 @@ int yaml_iter_next(yaml_iter_t *iter) return 0; } -void yaml_iter_recurse(yaml_iter_t *parent, yaml_iter_t *iter) +void ogs_yaml_iter_recurse(ogs_yaml_iter_t *parent, ogs_yaml_iter_t *iter) { - d_assert(parent, return,); - d_assert(parent->document, return,); - d_assert(parent->node, return,); - d_assert(iter, return,); + ogs_assert(parent); + ogs_assert(parent->document); + ogs_assert(parent->node); + ogs_assert(iter); - memset(iter, 0, sizeof(yaml_iter_t)); + memset(iter, 0, sizeof(ogs_yaml_iter_t)); iter->document = parent->document; if (parent->node->type == YAML_MAPPING_NODE) { - d_assert(parent->pair, return,); + ogs_assert(parent->pair); iter->node = yaml_document_get_node( parent->document, parent->pair->value); - d_assert(iter->node, return,); + ogs_assert(iter->node); if (iter->node->type == YAML_MAPPING_NODE) iter->pair = iter->node->data.mapping.pairs.start - 1; else if (iter->node->type == YAML_SEQUENCE_NODE) @@ -72,62 +91,63 @@ void yaml_iter_recurse(yaml_iter_t *parent, yaml_iter_t *iter) } else if (parent->node->type == YAML_SEQUENCE_NODE) { - d_assert(parent->item, return,); + ogs_assert(parent->item); iter->node = yaml_document_get_node(parent->document, *parent->item); - d_assert(iter->node, return,); + ogs_assert(iter->node); if (iter->node->type == YAML_MAPPING_NODE) iter->pair = iter->node->data.mapping.pairs.start - 1; else if (iter->node->type == YAML_SEQUENCE_NODE) iter->item = iter->node->data.sequence.items.start - 1; } else - d_assert(0, return,); + ogs_assert_if_reached(); } -int yaml_iter_type(yaml_iter_t *iter) +int ogs_yaml_iter_type(ogs_yaml_iter_t *iter) { - d_assert(iter, return 0,); - d_assert(iter->node, return 0,); + ogs_assert(iter); + ogs_assert(iter->node); return iter->node->type; } -const char *yaml_iter_key(yaml_iter_t *iter) +const char *ogs_yaml_iter_key(ogs_yaml_iter_t *iter) { yaml_node_t *node = NULL; - d_assert(iter, return NULL,); - d_assert(iter->document, return NULL,); - d_assert(iter->node, return NULL,); + ogs_assert(iter); + ogs_assert(iter->document); + ogs_assert(iter->node); if (iter->node->type == YAML_MAPPING_NODE) { - d_assert(iter->pair, return NULL,); + ogs_assert(iter->pair); node = yaml_document_get_node(iter->document, iter->pair->key); - d_assert(node, return NULL,); - d_assert(node->type == YAML_SCALAR_NODE, return NULL,); + ogs_assert(node); + ogs_assert(node->type == YAML_SCALAR_NODE); return (const char *)node->data.scalar.value; } else if (iter->node->type == YAML_SEQUENCE_NODE) { - d_assert(iter->item, return NULL,); + ogs_assert(iter->item); node = yaml_document_get_node(iter->document, *iter->item); - d_assert(node, return NULL,); - d_assert(node->type == YAML_SCALAR_NODE, return NULL,); + ogs_assert(node); + ogs_assert(node->type == YAML_SCALAR_NODE); return (const char *)node->data.scalar.value; } - else - d_assert(0, return 0,); + + ogs_assert_if_reached(); + return NULL; } -const char *yaml_iter_value(yaml_iter_t *iter) +const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter) { - d_assert(iter, return NULL,); - d_assert(iter->document, return NULL,); - d_assert(iter->node, return NULL,); + ogs_assert(iter); + ogs_assert(iter->document); + ogs_assert(iter->node); if (iter->node->type == YAML_SCALAR_NODE) { @@ -137,10 +157,10 @@ const char *yaml_iter_value(yaml_iter_t *iter) { yaml_node_t *node = NULL; - d_assert(iter->pair, return NULL,); + ogs_assert(iter->pair); node = yaml_document_get_node(iter->document, iter->pair->value); - d_assert(node, return NULL,); - d_assert(node->type == YAML_SCALAR_NODE, return NULL,); + ogs_assert(node); + ogs_assert(node->type == YAML_SCALAR_NODE); return (const char *)node->data.scalar.value; } @@ -148,20 +168,21 @@ const char *yaml_iter_value(yaml_iter_t *iter) { yaml_node_t *node = NULL; - d_assert(iter->item, return NULL,); + ogs_assert(iter->item); node = yaml_document_get_node(iter->document, *iter->item); - d_assert(node, return NULL,); - d_assert(node->type == YAML_SCALAR_NODE, return NULL,); + ogs_assert(node); + ogs_assert(node->type == YAML_SCALAR_NODE); return (const char *)node->data.scalar.value; } - else - d_assert(0, return NULL,); + + ogs_assert_if_reached(); + return NULL; } -int yaml_iter_bool(yaml_iter_t *iter) +int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter) { - const char *v = yaml_iter_value(iter); + const char *v = ogs_yaml_iter_value(iter); if (v) { if (!strcasecmp(v, "true") || !strcasecmp(v, "yes")) return 1; diff --git a/src/app/ogs-yaml.h b/src/app/ogs-yaml.h new file mode 100644 index 000000000..033757349 --- /dev/null +++ b/src/app/ogs-yaml.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef OGS_YAML_H +#define OGS_YAML_H + +#include "ogs-core.h" + +typedef struct yaml_document_s yaml_document_t; +typedef struct yaml_node_s yaml_node_t; +typedef struct yaml_node_pair_s yaml_node_pair_t; +typedef int yaml_node_item_t; + +typedef struct { + yaml_document_t *document; + yaml_node_t *node; + yaml_node_pair_t *pair; + yaml_node_item_t *item; +} ogs_yaml_iter_t; + +void ogs_yaml_iter_init(ogs_yaml_iter_t *iter, yaml_document_t *document); +int ogs_yaml_iter_next(ogs_yaml_iter_t *iter); +void ogs_yaml_iter_recurse(ogs_yaml_iter_t *parent, ogs_yaml_iter_t *iter); + +int ogs_yaml_iter_type(ogs_yaml_iter_t *iter); +const char *ogs_yaml_iter_key(ogs_yaml_iter_t *iter); +const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter); +int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_OGS_YAML_H */ diff --git a/src/app_init.h b/src/app_init.h index cbd7fb254..107248055 100644 --- a/src/app_init.h +++ b/src/app_init.h @@ -1,31 +1,30 @@ #ifndef __APP_INIT_H__ #define __APP_INIT_H__ -#include "core.h" -#include "core_errno.h" - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) app_initialize( - const char *config_path, const char *log_path, const char *pid_path); -CORE_DECLARE(void) app_terminate(void); +int app_initialize(app_param_t *param); +#define app_terminate epc_terminate -CORE_DECLARE(status_t) mme_initialize(); -CORE_DECLARE(void) mme_terminate(void); +int epc_initialize(); +void epc_terminate(void); -CORE_DECLARE(status_t) hss_initialize(); -CORE_DECLARE(void) hss_terminate(void); +int mme_initialize(); +void mme_terminate(void); -CORE_DECLARE(status_t) sgw_initialize(); -CORE_DECLARE(void) sgw_terminate(void); +int hss_initialize(); +void hss_terminate(void); -CORE_DECLARE(status_t) pgw_initialize(); -CORE_DECLARE(void) pgw_terminate(void); +int sgw_initialize(); +void sgw_terminate(void); -CORE_DECLARE(status_t) pcrf_initialize(); -CORE_DECLARE(void) pcrf_terminate(void); +int pgw_initialize(); +void pgw_terminate(void); + +int pcrf_initialize(); +void pcrf_terminate(void); #ifdef __cplusplus } diff --git a/src/common/application.c b/src/common/application.c deleted file mode 100644 index f04a0c76c..000000000 --- a/src/common/application.c +++ /dev/null @@ -1,255 +0,0 @@ -#define TRACE_MODULE _app_init - -#include "core_debug.h" -#include "core_thread.h" -#include "core_file.h" -#include "core_lib.h" - -#include "context.h" -#include "application.h" - -#define DEFAULT_CONFIG_FILE_PATH SYSCONF_DIR PACKAGE "/nextepc.conf" -#define DEFAULT_RUNTIME_DIR_PATH LOCALSTATE_DIR "run/" - -static status_t app_logger_init(); -static status_t app_logger_final(); -static status_t app_logger_start(); -static status_t app_logger_stop(); - -status_t app_will_initialize(const char *config_path, const char *log_path) -{ - status_t rv; - int app = 0; - - context_init(); - - context_self()->config.path = config_path; - if (context_self()->config.path == NULL) - context_self()->config.path = DEFAULT_CONFIG_FILE_PATH; - - rv = context_read_file(); - if (rv != CORE_OK) return rv; - - rv = context_parse_config(); - if (rv != CORE_OK) return rv; - - rv = context_setup_trace_module(); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_app_init, app); - } - - context_self()->logger.path = log_path; - rv = app_logger_init(); - if (rv != CORE_OK) return rv; - - if (context_self()->db_uri) - { - /* Override configuration if DB_URI environment variable is existed */ - if (core_env_get("DB_URI")) - context_self()->db_uri = core_env_get("DB_URI"); - - rv = context_db_init(context_self()->db_uri); - if (rv != CORE_OK) return rv; - d_print(" MongoDB URI : '%s'\n", context_self()->db_uri); - } - d_print(" Configuration : '%s'\n", context_self()->config.path); - - return rv; -} - -status_t app_did_initialize(void) -{ - status_t rv = app_logger_start(); - if (rv != CORE_OK) return rv; - - return rv; -} - -void app_will_terminate(void) -{ - app_logger_stop(); - - if (context_self()->db_uri) - { - d_trace(1, "DB-Client try to terminate\n"); - context_db_final(); - d_trace(1, "DB-Client terminate...done\n"); - } -} - -void app_did_terminate(void) -{ - app_logger_final(); - - context_final(); -} - -status_t app_log_pid(const char *pid_path, const char *app_name) -{ - file_t *pid_file = NULL; - file_info_t finfo; - static pid_t saved_pid = -1; - pid_t mypid; - status_t rv; - char default_pid_path[MAX_FILEPATH_LEN]; - char buf[128]; - - if (pid_path == NULL) - { - snprintf(default_pid_path, sizeof(default_pid_path), - "%snextepc-%sd/pid", DEFAULT_RUNTIME_DIR_PATH, app_name); - pid_path = default_pid_path; - } - - mypid = getpid(); - if (mypid != saved_pid - && file_stat(&finfo, pid_path, FILE_INFO_MTIME) == CORE_OK) - { - d_warn("pid file %s overwritten -- Unclean " - "shutdown of previous NextEPC run?", pid_path); - } - - if ((rv = file_open(&pid_file, pid_path, - FILE_WRITE | FILE_CREATE | FILE_TRUNCATE, - FILE_UREAD | FILE_UWRITE | FILE_GREAD | FILE_WREAD)) != CORE_OK) - { - d_error("CHECK PERMISSION of Installation Directory..."); - d_error("Cannot create PID file:`%s`", pid_path); - return CORE_ERROR; - } - snprintf(buf, sizeof(buf), "%" C_PID_T_FMT "\r\n", mypid); - file_puts(buf, pid_file); - file_close(pid_file); - saved_pid = mypid; - - d_print(" PID[%" C_PID_T_FMT "] : '%s'\n", saved_pid, pid_path); - - return CORE_OK; -} - -status_t app_logger_restart() -{ - app_logger_stop(); - app_logger_final(); - - app_logger_init(); - app_logger_start(); - - return CORE_OK; -} - -static status_t app_logger_init() -{ - status_t rv; - - if (context_self()->logger.console >= 0) - { - rv = d_msg_console_init(context_self()->logger.console); - if (rv != CORE_OK) - { - d_error("console logger init failed : (file:%d)", - context_self()->logger.console); - return rv; - } - d_print(" Console Logging : '%d'\n", context_self()->logger.console); - } - if (context_self()->logger.syslog) - { - d_msg_syslog_init(context_self()->logger.syslog); - d_print(" Syslog Logging : '%s'\n", context_self()->logger.syslog); - } - if (context_self()->logger.network.file && - context_self()->logger.network.unix_domain) - { - if (context_self()->logger.path) - context_self()->logger.network.file = context_self()->logger.path; - - rv = d_msg_network_init(context_self()->logger.network.unix_domain); - if (rv != CORE_OK) - { - d_error("Network logger init failed : (unix_domain:%s, file:%s)", - context_self()->logger.network.unix_domain, - context_self()->logger.network.file); - return rv; - } - d_print(" Network Logging : '%s' on %s\n", - context_self()->logger.network.file, - context_self()->logger.network.unix_domain); - } - if (context_self()->logger.file) - { - if (context_self()->logger.path) - context_self()->logger.file = context_self()->logger.path; - - rv = d_msg_file_init(context_self()->logger.file); - if (rv != CORE_OK) - { - d_error("file logger init failed : (file:%s)", - context_self()->logger.file); - return rv; - } - d_print(" File Logging : '%s'\n", context_self()->logger.file); - } - - return CORE_OK; -} - - -static status_t app_logger_start() -{ - status_t rv; - - if (context_self()->logger.network.file && - context_self()->logger.network.unix_domain) - { - rv = d_msg_network_start(context_self()->logger.network.file); - if (rv != CORE_OK) - { - d_error("Network logger start failed : (unix_domain:%s, file:%s)", - context_self()->logger.network.unix_domain, - context_self()->logger.network.file); - return rv; - } - } - - return CORE_OK; -} - -static status_t app_logger_stop() -{ - if (context_self()->logger.network.file && - context_self()->logger.network.unix_domain) - { - d_msg_network_stop(); - } - - return CORE_OK; -} - -static status_t app_logger_final() -{ - if (context_self()->logger.console >= 0) - { - d_msg_console_final(); - } - if (context_self()->logger.syslog) - { - d_msg_syslog_final(); - } - if (context_self()->logger.network.file && - context_self()->logger.network.unix_domain) - { - d_msg_network_final(); - } - if (context_self()->logger.file) - { - d_msg_file_final(); - } - - return CORE_OK; -} - diff --git a/src/common/application.h b/src/common/application.h deleted file mode 100644 index e5e6970f0..000000000 --- a/src/common/application.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __APPLICATION_H__ -#define __APPLICATION_H__ - -#include "core.h" -#include "core_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -CORE_DECLARE(status_t) app_will_initialize( - const char *config_path, const char *log_path); -CORE_DECLARE(status_t) app_did_initialize(void); -CORE_DECLARE(void) app_will_terminate(void); -CORE_DECLARE(void) app_did_terminate(void); - -CORE_DECLARE(status_t) config_initialize(const char *config_path); -CORE_DECLARE(void) config_terminate(void); - -CORE_DECLARE(status_t) app_logger_restart(void); -CORE_DECLARE(status_t) app_log_pid(const char *pid_path, const char *app_name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __APPLICATION_H__ */ diff --git a/src/common/context.c b/src/common/context.c deleted file mode 100644 index f4f614400..000000000 --- a/src/common/context.c +++ /dev/null @@ -1,438 +0,0 @@ -#define TRACE_MODULE _context - -#include "core_file.h" -#include "core_debug.h" -#include "core_lib.h" -#include "core_pkbuf.h" - -#include -#include -#include "yaml_helper.h" - -#include "context.h" - -#define DEFAULT_SCTP_STREAMS 30 - -static context_t self; - -static int context_initialized = 0; - -status_t context_init() -{ - d_assert(context_initialized == 0, return CORE_ERROR, - "Context already has been context_initialized"); - - memset(&self, 0, sizeof(context_t)); - - context_initialized = 1; - - return CORE_OK; -} - -status_t context_final() -{ - d_assert(context_initialized == 1, return CORE_ERROR, - "Context already has been finalized"); - - if (self.config.document) - { - yaml_document_delete(self.config.document); - CORE_FREE(self.config.document); - } - - context_initialized = 0; - - return CORE_OK; -} - -context_t* context_self() -{ - return &self; -} - -status_t context_read_file() -{ - config_t *config = &self.config; - FILE *file; - yaml_parser_t parser; - yaml_document_t *document = NULL; - - d_assert(config->path, return CORE_ERROR,); - - file = fopen(config->path, "rb"); - d_assert(file, return CORE_ERROR, - "Failed to read configuration file `%s`", config->path); - - d_assert(yaml_parser_initialize(&parser), return CORE_ERROR,); - yaml_parser_set_input_file(&parser, file); - - document = core_calloc(1, sizeof(yaml_document_t)); - if (!yaml_parser_load(&parser, document)) - { - d_fatal("Failed to parse configuration file '%s'", config->path); - switch (parser.error) - { - case YAML_MEMORY_ERROR: - d_error("Memory error: Not enough memory for parsing"); - break; - case YAML_READER_ERROR: - if (parser.problem_value != -1) - d_error("Reader error - %s: #%X at %zd", parser.problem, - parser.problem_value, parser.problem_offset); - else - d_error("Reader error - %s at %zd", parser.problem, - parser.problem_offset); - break; - case YAML_SCANNER_ERROR: - if (parser.context) - d_error("Scanner error - %s at line %lu, column %lu\n" - "%s at line %lu, column %lu", parser.context, - parser.context_mark.line+1, - parser.context_mark.column+1, - parser.problem, parser.problem_mark.line+1, - parser.problem_mark.column+1); - else - d_error("Scanner error - %s at line %lu, column %lu", - parser.problem, parser.problem_mark.line+1, - parser.problem_mark.column+1); - break; - case YAML_PARSER_ERROR: - if (parser.context) - d_error("Parser error - %s at line %lu, column %lu\n" - "%s at line %lu, column %lu", parser.context, - parser.context_mark.line+1, - parser.context_mark.column+1, - parser.problem, parser.problem_mark.line+1, - parser.problem_mark.column+1); - else - d_error("Parser error - %s at line %lu, column %lu", - parser.problem, parser.problem_mark.line+1, - parser.problem_mark.column+1); - break; - default: - /* Couldn't happen. */ - d_assert(0,, "Internal error"); - break; - } - - CORE_FREE(document); - yaml_parser_delete(&parser); - d_assert(!fclose(file),,); - return CORE_ERROR; - } - - config->document = document; - - yaml_parser_delete(&parser); - d_assert(!fclose(file),,); - - return CORE_OK; -} - -status_t context_setup_trace_module() -{ - int app = context_self()->logger.trace.app; - - if (app) - { - extern int _mutex; - d_trace_level(&_mutex, app); - extern int _pkbuf; - d_trace_level(&_pkbuf, app); - extern int _timer; - d_trace_level(&_timer, app); - - extern int _context; - d_trace_level(&_context, app); - } - - return CORE_OK; -} - -static status_t context_prepare() -{ - self.logger.console = -1; - self.parameter.sctp_streams = DEFAULT_SCTP_STREAMS; - - return CORE_OK; -} - -static status_t context_validation() -{ - if (self.parameter.no_ipv4 == 1 && self.parameter.no_ipv6 == 1) - { - d_error("Both `no_ipv4` and `no_ipv6` set to `true` in `%s`", - context_self()->config.path); - return CORE_ERROR; - } - - return CORE_OK; -} -status_t context_parse_config() -{ - status_t rv; - config_t *config = &self.config; - yaml_document_t *document = NULL; - yaml_iter_t root_iter; - - d_assert(config, return CORE_ERROR,); - document = config->document; - d_assert(document, return CORE_ERROR,); - - rv = context_prepare(); - if (rv != CORE_OK) return rv; - - yaml_iter_init(&root_iter, document); - while(yaml_iter_next(&root_iter)) - { - const char *root_key = yaml_iter_key(&root_iter); - d_assert(root_key, return CORE_ERROR,); - if (!strcmp(root_key, "db_uri")) - { - self.db_uri = yaml_iter_value(&root_iter); - } - else if (!strcmp(root_key, "logger")) - { - yaml_iter_t logger_iter; - yaml_iter_recurse(&root_iter, &logger_iter); - while(yaml_iter_next(&logger_iter)) - { - const char *logger_key = yaml_iter_key(&logger_iter); - d_assert(logger_key, return CORE_ERROR,); - if (!strcmp(logger_key, "file")) - { - self.logger.file = yaml_iter_value(&logger_iter); - } - else if (!strcmp(logger_key, "console")) - { - const char *v = yaml_iter_value(&logger_iter); - if (v) self.logger.console = atoi(v); - } - else if (!strcmp(logger_key, "syslog")) - { - self.logger.syslog = yaml_iter_value(&logger_iter); - } - else if (!strcmp(logger_key, "network")) - { - yaml_iter_t network_iter; - yaml_iter_recurse(&logger_iter, &network_iter); - while(yaml_iter_next(&network_iter)) - { - const char *network_key = yaml_iter_key(&network_iter); - d_assert(network_key, return CORE_ERROR,); - if (!strcmp(network_key, "file")) - { - self.logger.network.file = - yaml_iter_value(&network_iter); - } - else if (!strcmp(network_key, "unixDomain")) - { - self.logger.network.unix_domain = - yaml_iter_value(&network_iter); - } - else - d_warn("unknown key `%s`", network_key); - } - } - else if (!strcmp(logger_key, "trace")) - { - yaml_iter_t trace_iter; - yaml_iter_recurse(&logger_iter, &trace_iter); - while(yaml_iter_next(&trace_iter)) - { - const char *trace_key = yaml_iter_key(&trace_iter); - d_assert(trace_key, return CORE_ERROR,); - if (!strcmp(trace_key, "app")) - { - const char *v = yaml_iter_value(&trace_iter); - if (v) self.logger.trace.app = atoi(v); - } - else if (!strcmp(trace_key, "s1ap")) - { - const char *v = yaml_iter_value(&trace_iter); - if (v) self.logger.trace.s1ap = atoi(v); - } - else if (!strcmp(trace_key, "nas")) - { - const char *v = yaml_iter_value(&trace_iter); - if (v) self.logger.trace.nas = atoi(v); - } - else if (!strcmp(trace_key, "diameter")) - { - const char *v = yaml_iter_value(&trace_iter); - if (v) self.logger.trace.diameter = atoi(v); - } - else if (!strcmp(trace_key, "gtpv2")) - { - const char *v = yaml_iter_value(&trace_iter); - if (v) self.logger.trace.gtpv2 = atoi(v); - } - else if (!strcmp(trace_key, "gtp")) - { - const char *v = yaml_iter_value(&trace_iter); - if (v) self.logger.trace.gtp = atoi(v); - } - else - d_warn("unknown key `%s`", trace_key); - } - } - } - } - else if (!strcmp(root_key, "parameter")) - { - yaml_iter_t parameter_iter; - yaml_iter_recurse(&root_iter, ¶meter_iter); - while(yaml_iter_next(¶meter_iter)) - { - const char *parameter_key = yaml_iter_key(¶meter_iter); - d_assert(parameter_key, return CORE_ERROR,); - if (!strcmp(parameter_key, "no_hss")) - { - self.parameter.no_hss = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "no_sgw")) - { - self.parameter.no_sgw = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "no_pgw")) - { - self.parameter.no_pgw = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "no_pcrf")) - { - self.parameter.no_pcrf = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "sctp_streams")) - { - const char *v = yaml_iter_value(¶meter_iter); - if (v) self.parameter.sctp_streams = atoi(v); - } - else if (!strcmp(parameter_key, "no_ipv4")) - { - self.parameter.no_ipv4 = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "no_ipv6")) - { - self.parameter.no_ipv6 = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "prefer_ipv4")) - { - self.parameter.prefer_ipv4 = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "multicast")) - { - self.parameter.multicast = - yaml_iter_bool(¶meter_iter); - } - else if (!strcmp(parameter_key, "no_slaac")) - { - self.parameter.no_slaac = - yaml_iter_bool(¶meter_iter); - } - else - d_warn("unknown key `%s`", parameter_key); - } - } - } - - rv = context_validation(); - if (rv != CORE_OK) return rv; - - return CORE_OK; -} - -/* - * We've added it - * Because the following function is deprecated in the mongo-c-driver - */ -static bool -context_mongoc_client_get_server_status (mongoc_client_t *client, /* IN */ - mongoc_read_prefs_t *read_prefs, /* IN */ - bson_t *reply, /* OUT */ - bson_error_t *error) /* OUT */ -{ - bson_t cmd = BSON_INITIALIZER; - bool ret = false; - - BSON_ASSERT (client); - - BSON_APPEND_INT32 (&cmd, "serverStatus", 1); - ret = mongoc_client_command_simple ( - client, "admin", &cmd, read_prefs, reply, error); - bson_destroy (&cmd); - - return ret; -} - -status_t context_db_init(const char *db_uri) -{ - bson_t reply; - bson_error_t error; - bson_iter_t iter; - - const mongoc_uri_t *uri; - - mongoc_init(); - - self.db_client = mongoc_client_new(db_uri); - if (!self.db_client) - { - d_error("Failed to parse DB URI [%s]", db_uri); - return CORE_ERROR; - } - -#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 4 - mongoc_client_set_error_api(self.db_client, 2); -#endif - - uri = mongoc_client_get_uri(self.db_client); - d_assert(uri, context_db_final(); return CORE_ERROR, - "Database is not defined in DB_URI [%s]", db_uri); - - self.db_name = (char *)mongoc_uri_get_database(uri); - d_assert(self.db_name, context_db_final(); return CORE_ERROR, - "Database is not defined in DB_URI [%s]", db_uri); - - self.database = mongoc_client_get_database(self.db_client, self.db_name); - d_assert(self.database, context_db_final(); return CORE_ERROR, - "Database is not defined in DB_URI [%s]", db_uri); - - if (!context_mongoc_client_get_server_status( - self.db_client, NULL, &reply, &error)) - { - d_error("Failed to conect to server [%s]", db_uri); - return CORE_EAGAIN; - } - - d_assert(bson_iter_init_find(&iter, &reply, "ok"), - bson_destroy(&reply); context_db_final(); return CORE_ERROR, - "Invalid reply for server status [%s]", db_uri); - - bson_destroy(&reply); - return CORE_OK; -} - -status_t context_db_final() -{ - if (self.database) - { - mongoc_database_destroy(self.database); - self.database = NULL; - } - if (self.db_client) - { - mongoc_client_destroy(self.db_client); - self.db_client = NULL; - } - - mongoc_cleanup(); - - return CORE_OK; -} diff --git a/src/common/context.h b/src/common/context.h deleted file mode 100644 index 7be610663..000000000 --- a/src/common/context.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __CONTEXT_H__ -#define __CONTEXT_H__ - -#include "core_debug.h" -#include "core_param.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define MAX_CONFIG_FILE_SIZE 2048 -#define MAX_NUM_OF_CONFIG_TOKEN 256 - -typedef struct _config_t { - const char *path; - void *document; -} config_t; - -#define MAX_DB_URI_LEN 256 - -typedef struct _context_t { - config_t config; - - const char *db_uri; - void *db_client; - char *db_name; - void *database; - - struct { - const char *path; - int console; - const char *syslog; - struct { - const char *unix_domain; - const char *file; - } network; - const char *file; - - struct { - int app; - int s1ap; - int nas; - int gtpv2; - int gtp; - int diameter; - } trace; - } logger; - - struct { - /* Element */ - int no_hss; - int no_sgw; - int no_pgw; - int no_pcrf; - - /* Network */ - int sctp_streams; - int no_ipv4; - int no_ipv6; - int prefer_ipv4; - int multicast; - int no_slaac; - } parameter; - -} context_t; - -CORE_DECLARE(status_t) context_init(void); -CORE_DECLARE(status_t) context_final(void); -CORE_DECLARE(context_t*) context_self(void); - -CORE_DECLARE(status_t) context_read_file(void); -CORE_DECLARE(status_t) context_parse_config(void); -CORE_DECLARE(status_t) context_setup_trace_module(void); - -CORE_DECLARE(status_t) context_db_init(const char *db_uri); -CORE_DECLARE(status_t) context_db_final(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __CONTEXT_H__ */ diff --git a/src/common/yaml_helper.h b/src/common/yaml_helper.h deleted file mode 100644 index ceee20040..000000000 --- a/src/common/yaml_helper.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __YAML_HELPER_H__ -#define __YAML_HELPER_H__ - -#include "core_debug.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - yaml_document_t *document; - yaml_node_t *node; - yaml_node_pair_t *pair; - yaml_node_item_t *item; -} yaml_iter_t; - -CORE_DECLARE(void) yaml_iter_init(yaml_iter_t *iter, yaml_document_t *document); -CORE_DECLARE(int) yaml_iter_next(yaml_iter_t *iter); -CORE_DECLARE(void) yaml_iter_recurse(yaml_iter_t *parent, yaml_iter_t *iter); - -CORE_DECLARE(int) yaml_iter_type(yaml_iter_t *iter); -CORE_DECLARE(const char *) yaml_iter_key(yaml_iter_t *iter); -CORE_DECLARE(const char *) yaml_iter_value(yaml_iter_t *iter); -CORE_DECLARE(int) yaml_iter_bool(yaml_iter_t *iter); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __YAML_HELPER_H__ */ diff --git a/src/epc.c b/src/epc.c index e0d02ceb1..cdac4c2b8 100644 --- a/src/epc.c +++ b/src/epc.c @@ -1,287 +1,272 @@ -#define TRACE_MODULE _epc_main - -#include "core_general.h" -#include "core_debug.h" -#include "core_semaphore.h" - -#include "common/context.h" -#include "common/application.h" +#include "app/context.h" +#include "app/application.h" #include "app_init.h" -static semaphore_id pcrf_sem1 = 0; -static semaphore_id pcrf_sem2 = 0; +static ogs_proc_mutex_t *pcrf_sem1 = NULL; +static ogs_proc_mutex_t *pcrf_sem2 = NULL; -static semaphore_id pgw_sem1 = 0; -static semaphore_id pgw_sem2 = 0; +static ogs_proc_mutex_t *pgw_sem1 = NULL; +static ogs_proc_mutex_t *pgw_sem2 = NULL; -static semaphore_id sgw_sem1 = 0; -static semaphore_id sgw_sem2 = 0; +static ogs_proc_mutex_t *sgw_sem1 = NULL; +static ogs_proc_mutex_t *sgw_sem2 = NULL; -static semaphore_id hss_sem1 = 0; -static semaphore_id hss_sem2 = 0; +static ogs_proc_mutex_t *hss_sem1 = NULL; +static ogs_proc_mutex_t *hss_sem2 = NULL; -status_t app_initialize( - const char *config_path, const char *log_path, const char *pid_path) +int app_initialize(app_param_t *param) +{ + param->name = "epc"; + return epc_initialize(param); +} + +int epc_initialize(app_param_t *param) { pid_t pid; - status_t rv; - int app = 0; - - rv = app_log_pid(pid_path, "epc"); - if (rv != CORE_OK) return rv; - - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_epc_main, app); - } + int rv; + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; /************************* PCRF Process **********************/ - semaphore_create(&pcrf_sem1, 0); /* copied to PCRF/PGW/SGW/HSS process */ - semaphore_create(&pcrf_sem2, 0); /* copied to PCRF/PGW/SGW/HSS process */ + pcrf_sem1 = ogs_proc_mutex_create(0); /* copied to PCRF/PGW/SGW/HSS process */ + pcrf_sem2 = ogs_proc_mutex_create(0); /* copied to PCRF/PGW/SGW/HSS process */ - if (context_self()->parameter.no_pcrf == 0) + if (context_self()->config.parameter.no_pcrf == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { - d_trace(1, "PCRF try to initialize\n"); + ogs_info("PCRF try to initialize"); rv = pcrf_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize PCRF"); - d_trace(1, "PCRF initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("PCRF initialize...done"); - if (pcrf_sem1) semaphore_post(pcrf_sem1); - if (pcrf_sem2) semaphore_wait(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_post(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_wait(pcrf_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "PCRF try to terminate\n"); + ogs_info("PCRF try to terminate"); pcrf_terminate(); - d_trace(1, "PCRF terminate...done\n"); + ogs_info("PCRF terminate...done"); } - if (pcrf_sem1) semaphore_post(pcrf_sem1); + if (pcrf_sem1) ogs_proc_mutex_post(pcrf_sem1); /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); app_did_terminate(); - core_terminate(); + ogs_core_finalize(); _exit(EXIT_SUCCESS); } - if (pcrf_sem1) semaphore_wait(pcrf_sem1); + if (pcrf_sem1) ogs_proc_mutex_wait(pcrf_sem1); } /************************* PGW Process **********************/ + pgw_sem1 = ogs_proc_mutex_create(0); /* copied to PGW/SGW/HSS process */ + pgw_sem2 = ogs_proc_mutex_create(0); /* copied to PGW/SGW/HSS process */ - semaphore_create(&pgw_sem1, 0); /* copied to PGW/SGW/HSS process */ - semaphore_create(&pgw_sem2, 0); /* copied to PGW/SGW/HSS process */ - - if (context_self()->parameter.no_pgw == 0) + if (context_self()->config.parameter.no_pgw == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); - d_trace(1, "PGW try to initialize\n"); + ogs_info("PGW try to initialize"); rv = pgw_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize PGW"); - d_trace(1, "PGW initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("PGW initialize...done"); - if (pgw_sem1) semaphore_post(pgw_sem1); - if (pgw_sem2) semaphore_wait(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_post(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_wait(pgw_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "PGW try to terminate\n"); + ogs_info("PGW try to terminate"); pgw_terminate(); - d_trace(1, "PGW terminate...done\n"); + ogs_info("PGW terminate...done"); } - if (pgw_sem1) semaphore_post(pgw_sem1); + if (pgw_sem1) ogs_proc_mutex_post(pgw_sem1); /* allocated from parent process */ - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); app_did_terminate(); - core_terminate(); + ogs_core_finalize(); _exit(EXIT_SUCCESS); } - if (pgw_sem1) semaphore_wait(pgw_sem1); + if (pgw_sem1) ogs_proc_mutex_wait(pgw_sem1); } /************************* SGW Process **********************/ + sgw_sem1 = ogs_proc_mutex_create(0); /* copied to SGW/HSS process */ + sgw_sem2 = ogs_proc_mutex_create(0); /* copied to SGW/HSS process */ - semaphore_create(&sgw_sem1, 0); /* copied to SGW/HSS process */ - semaphore_create(&sgw_sem2, 0); /* copied to SGW/HSS process */ - - if (context_self()->parameter.no_sgw == 0) + if (context_self()->config.parameter.no_sgw == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); - d_trace(1, "SGW try to initialize\n"); + ogs_info("SGW try to initialize"); rv = sgw_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize SGW"); - d_trace(1, "SGW initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("SGW initialize...done"); - if (sgw_sem1) semaphore_post(sgw_sem1); - if (sgw_sem2) semaphore_wait(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_post(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_wait(sgw_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "SGW try to terminate\n"); + ogs_info("SGW try to terminate"); sgw_terminate(); - d_trace(1, "SGW terminate...done\n"); + ogs_info("SGW terminate...done"); } - if (sgw_sem1) semaphore_post(sgw_sem1); + if (sgw_sem1) ogs_proc_mutex_post(sgw_sem1); /* allocated from parent process */ - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); app_did_terminate(); - core_terminate(); + ogs_core_finalize(); _exit(EXIT_SUCCESS); } - if (sgw_sem1) semaphore_wait(sgw_sem1); + if (sgw_sem1) ogs_proc_mutex_wait(sgw_sem1); } /************************* HSS Process **********************/ + hss_sem1 = ogs_proc_mutex_create(0); /* copied to HSS process */ + hss_sem2 = ogs_proc_mutex_create(0); /* copied to HSS process */ - semaphore_create(&hss_sem1, 0); /* copied to HSS process */ - semaphore_create(&hss_sem2, 0); /* copied to HSS process */ - - if (context_self()->parameter.no_hss == 0) + if (context_self()->config.parameter.no_hss == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); - d_trace(1, "HSS try to initialize\n"); + ogs_info("HSS try to initialize"); rv = hss_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize HSS"); - d_trace(1, "HSS initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("HSS initialize...done"); - if (hss_sem1) semaphore_post(hss_sem1); - if (hss_sem2) semaphore_wait(hss_sem2); + if (hss_sem1) ogs_proc_mutex_post(hss_sem1); + if (hss_sem2) ogs_proc_mutex_wait(hss_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "HSS try to terminate\n"); + ogs_info("HSS try to terminate"); hss_terminate(); - d_trace(1, "HSS terminate...done\n"); + ogs_info("HSS terminate...done"); } - if (hss_sem1) semaphore_post(hss_sem1); + if (hss_sem1) ogs_proc_mutex_post(hss_sem1); - if (hss_sem1) semaphore_delete(hss_sem1); - if (hss_sem2) semaphore_delete(hss_sem2); + if (hss_sem1) ogs_proc_mutex_delete(hss_sem1); + if (hss_sem2) ogs_proc_mutex_delete(hss_sem2); app_did_terminate(); - core_terminate(); + ogs_core_finalize(); _exit(EXIT_SUCCESS); } - if (hss_sem1) semaphore_wait(hss_sem1); + if (hss_sem1) ogs_proc_mutex_wait(hss_sem1); } rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - d_trace(1, "MME try to initialize\n"); + ogs_info("MME try to initialize"); rv = mme_initialize(); - d_assert(rv == CORE_OK, return rv, "Failed to intialize MME"); - d_trace(1, "MME initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("MME initialize...done"); - return CORE_OK;; + return OGS_OK;; } -void app_terminate(void) +void epc_terminate(void) { app_will_terminate(); - d_trace(1, "MME try to terminate\n"); + ogs_info("MME try to terminate"); mme_terminate(); - d_trace(1, "MME terminate...done\n"); + ogs_info("MME terminate...done"); - if (context_self()->parameter.no_hss == 0) + if (context_self()->config.parameter.no_hss == 0) { - if (hss_sem2) semaphore_post(hss_sem2); - if (hss_sem1) semaphore_wait(hss_sem1); + if (hss_sem2) ogs_proc_mutex_post(hss_sem2); + if (hss_sem1) ogs_proc_mutex_wait(hss_sem1); } - if (hss_sem1) semaphore_delete(hss_sem1); - if (hss_sem2) semaphore_delete(hss_sem2); + if (hss_sem1) ogs_proc_mutex_delete(hss_sem1); + if (hss_sem2) ogs_proc_mutex_delete(hss_sem2); - if (context_self()->parameter.no_sgw == 0) + if (context_self()->config.parameter.no_sgw == 0) { - if (sgw_sem2) semaphore_post(sgw_sem2); - if (sgw_sem1) semaphore_wait(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_post(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_wait(sgw_sem1); } - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); - if (context_self()->parameter.no_pgw == 0) + if (context_self()->config.parameter.no_pgw == 0) { - if (pgw_sem2) semaphore_post(pgw_sem2); - if (pgw_sem1) semaphore_wait(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_post(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_wait(pgw_sem1); } - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); - if (context_self()->parameter.no_pcrf == 0) + if (context_self()->config.parameter.no_pcrf == 0) { - if (pcrf_sem2) semaphore_post(pcrf_sem2); - if (pcrf_sem1) semaphore_wait(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_post(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_wait(pcrf_sem1); } - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); app_did_terminate(); } diff --git a/src/hss.c b/src/hss.c index f11793e84..dfb5a66f2 100644 --- a/src/hss.c +++ b/src/hss.c @@ -1,54 +1,42 @@ -#define TRACE_MODULE _hss_main - -#include "core_debug.h" -#include "core_signal.h" -#include "core_semaphore.h" - -#include "common/context.h" -#include "common/application.h" +#include "app/context.h" +#include "app/application.h" #include "app_init.h" -status_t app_initialize( - const char *config_path, const char *log_path, const char *pid_path) +extern int __hss_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __hss_log_domain + +int app_initialize(app_param_t *param) { - status_t rv; - int app = 0; + int rv; - rv = app_log_pid(pid_path, "hss"); - if (rv != CORE_OK) return rv; + param->name = "hss"; + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_hss_main, app); - } - - d_trace(1, "HSS try to initialize\n"); rv = hss_initialize(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Failed to intialize HSS"); + ogs_error("Failed to intialize HSS"); return rv; } - d_trace(1, "HSS initialize...done\n"); + ogs_info("HSS initialize...done"); rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } void app_terminate(void) { app_will_terminate(); - d_trace(1, "HSS try to terminate\n"); + ogs_info("HSS try to terminate"); hss_terminate(); - d_trace(1, "HSS terminate...done\n"); + ogs_info("HSS terminate...done"); app_did_terminate(); } diff --git a/src/hss/Makefile.am b/src/hss/Makefile.am index e74021e03..f16f725ec 100644 --- a/src/hss/Makefile.am +++ b/src/hss/Makefile.am @@ -9,16 +9,16 @@ libhss_la_SOURCES = \ libhss_la_DEPENDENCIES = \ $(top_srcdir)/lib/fd/libfd.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) libhss_la_LIBADD = \ $(top_srcdir)/lib/fd/libfd.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ -I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \ @@ -28,6 +28,3 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/src/hss/hss_auc.c b/src/hss/hss_auc.c index 88e87b355..1ac30e91d 100644 --- a/src/hss/hss_auc.c +++ b/src/hss/hss_auc.c @@ -1,20 +1,17 @@ -#define TRACE_MODULE _hss_kdf - -#include "core_debug.h" -#include "core_sha2_hmac.h" -#include "3gpp_types.h" +#include "ogs-crypt.h" +#include "base/types.h" #include "hss_auc.h" #include "milenage.h" #define FC_VALUE 0x10 -void hss_auc_kasme(const c_uint8_t *ck, const c_uint8_t *ik, - const c_uint8_t plmn_id[3], const c_uint8_t *sqn, const c_uint8_t *ak, - c_uint8_t *kasme) +void hss_auc_kasme(const uint8_t *ck, const uint8_t *ik, + const uint8_t plmn_id[3], const uint8_t *sqn, const uint8_t *ak, + uint8_t *kasme) { - c_uint8_t s[14]; - c_uint8_t k[32]; + uint8_t s[14]; + uint8_t k[32]; int i; memcpy(&k[0], ck, 16); @@ -30,18 +27,18 @@ void hss_auc_kasme(const c_uint8_t *ck, const c_uint8_t *ik, s[12] = 0x00; s[13] = 0x06; - hmac_sha256(k, 32, s, 14, kasme, 32); + ogs_hmac_sha256(k, 32, s, 14, kasme, 32); } void hss_auc_sqn( - const c_uint8_t *opc, const c_uint8_t *k, const c_uint8_t *auts, - c_uint8_t *sqn_ms, c_uint8_t *mac_s) + const uint8_t *opc, const uint8_t *k, const uint8_t *auts, + uint8_t *sqn_ms, uint8_t *mac_s) { int i; - c_uint8_t ak[HSS_AK_LEN]; - c_uint8_t amf[2] = { 0, 0 }; - const c_uint8_t *rand = auts; - const c_uint8_t *conc_sqn_ms = auts + RAND_LEN; + uint8_t ak[HSS_AK_LEN]; + uint8_t amf[2] = { 0, 0 }; + const uint8_t *rand = auts; + const uint8_t *conc_sqn_ms = auts + RAND_LEN; milenage_f2345(opc, k, rand, NULL, NULL, NULL, NULL, ak); for (i = 0; i < HSS_SQN_LEN; i++) diff --git a/src/hss/hss_auc.h b/src/hss/hss_auc.h index 7cda31e3c..3f087e08c 100644 --- a/src/hss/hss_auc.h +++ b/src/hss/hss_auc.h @@ -1,17 +1,17 @@ #ifndef __HSS_KDF_H__ #define __HSS_KDF_H__ -#include "core.h" +#include "ogs-core.h" #define HSS_SQN_LEN 6 #define HSS_AK_LEN 6 -CORE_DECLARE(void) hss_auc_kasme(const c_uint8_t *ck, const c_uint8_t *ik, - const c_uint8_t plmn_id[3], const c_uint8_t *sqn, const c_uint8_t *ak, - c_uint8_t *kasme); +void hss_auc_kasme(const uint8_t *ck, const uint8_t *ik, + const uint8_t plmn_id[3], const uint8_t *sqn, const uint8_t *ak, + uint8_t *kasme); -CORE_DECLARE(void) hss_auc_sqn( - const c_uint8_t *opc, const c_uint8_t *k, const c_uint8_t *auts, - c_uint8_t *sqn_ms, c_uint8_t *mac_s); +void hss_auc_sqn( + const uint8_t *opc, const uint8_t *k, const uint8_t *auts, + uint8_t *sqn_ms, uint8_t *mac_s); #endif /* __HSS_KDF_H__ */ diff --git a/src/hss/hss_context.c b/src/hss/hss_context.c index 2dfd480da..c6c4eda3c 100644 --- a/src/hss/hss_context.c +++ b/src/hss/hss_context.c @@ -1,21 +1,16 @@ -#define TRACE_MODULE _hss_context - -#include "core_debug.h" -#include "core_lib.h" -#include "core_network.h" - #include #include -#include "common/yaml_helper.h" #include "fd/fd_lib.h" -#include "common/context.h" +#include "app/context.h" #include "hss_context.h" static hss_context_t self; static fd_config_t g_fd_conf; +int __hss_log_domain; + static int context_initialized = 0; hss_context_t* hss_self() @@ -23,12 +18,9 @@ hss_context_t* hss_self() return &self; } -status_t hss_context_init(void) +int hss_context_init(void) { - status_t rv; - - d_assert(context_initialized == 0, return CORE_ERROR, - "HSS context already has been context_initialized"); + ogs_assert(context_initialized == 0); /* Initial FreeDiameter Config */ memset(&g_fd_conf, 0, sizeof(fd_config_t)); @@ -37,170 +29,169 @@ status_t hss_context_init(void) memset(&self, 0, sizeof(hss_context_t)); self.fd_config = &g_fd_conf; - rv = mutex_create(&self.db_lock, MUTEX_DEFAULT); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_log_install_domain(&__hss_log_domain, "hss", ogs_core()->log.level); + + ogs_thread_mutex_init(&self.db_lock); context_initialized = 1; - return CORE_OK; + return OGS_OK; } -status_t hss_context_final(void) +int hss_context_final(void) { - d_assert(context_initialized == 1, return CORE_ERROR, - "HSS context already has been finalized"); + ogs_assert(context_initialized == 1); - mutex_delete(self.db_lock); + ogs_thread_mutex_destroy(&self.db_lock); context_initialized = 0; - return CORE_OK; + return OGS_OK; } -static status_t hss_context_prepare() +static int hss_context_prepare() { self.fd_config->cnf_port = DIAMETER_PORT; self.fd_config->cnf_port_tls = DIAMETER_SECURE_PORT; - return CORE_OK; + return OGS_OK; } -static status_t hss_context_validation() +static int hss_context_validation() { if (self.fd_conf_path == NULL && (self.fd_config->cnf_diamid == NULL || self.fd_config->cnf_diamrlm == NULL || self.fd_config->cnf_addr == NULL)) { - d_error("No hss.freeDiameter in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No hss.freeDiameter in '%s'", context_self()->config.path); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t hss_context_parse_config() +int hss_context_parse_config() { - status_t rv; + int rv; config_t *config = &context_self()->config; yaml_document_t *document = NULL; - yaml_iter_t root_iter; + ogs_yaml_iter_t root_iter; - d_assert(config, return CORE_ERROR,); + ogs_assert(config); document = config->document; - d_assert(document, return CORE_ERROR,); + ogs_assert(document); rv = hss_context_prepare(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - yaml_iter_init(&root_iter, document); - while(yaml_iter_next(&root_iter)) + ogs_yaml_iter_init(&root_iter, document); + while(ogs_yaml_iter_next(&root_iter)) { - const char *root_key = yaml_iter_key(&root_iter); - d_assert(root_key, return CORE_ERROR,); + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); if (!strcmp(root_key, "hss")) { - yaml_iter_t hss_iter; - yaml_iter_recurse(&root_iter, &hss_iter); - while(yaml_iter_next(&hss_iter)) + ogs_yaml_iter_t hss_iter; + ogs_yaml_iter_recurse(&root_iter, &hss_iter); + while(ogs_yaml_iter_next(&hss_iter)) { - const char *hss_key = yaml_iter_key(&hss_iter); - d_assert(hss_key, return CORE_ERROR,); + const char *hss_key = ogs_yaml_iter_key(&hss_iter); + ogs_assert(hss_key); if (!strcmp(hss_key, "freeDiameter")) { yaml_node_t *node = yaml_document_get_node(document, hss_iter.pair->value); - d_assert(node, return CORE_ERROR,); + ogs_assert(node); if (node->type == YAML_SCALAR_NODE) { - self.fd_conf_path = yaml_iter_value(&hss_iter); + self.fd_conf_path = ogs_yaml_iter_value(&hss_iter); } else if (node->type == YAML_MAPPING_NODE) { - yaml_iter_t fd_iter; - yaml_iter_recurse(&hss_iter, &fd_iter); + ogs_yaml_iter_t fd_iter; + ogs_yaml_iter_recurse(&hss_iter, &fd_iter); - while(yaml_iter_next(&fd_iter)) + while(ogs_yaml_iter_next(&fd_iter)) { - const char *fd_key = yaml_iter_key(&fd_iter); - d_assert(fd_key, return CORE_ERROR,); + const char *fd_key = ogs_yaml_iter_key(&fd_iter); + ogs_assert(fd_key); if (!strcmp(fd_key, "identity")) { self.fd_config->cnf_diamid = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "realm")) { self.fd_config->cnf_diamrlm = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port = atoi(v); } else if (!strcmp(fd_key, "sec_port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port_tls = atoi(v); } else if (!strcmp(fd_key, "no_sctp")) { self.fd_config->cnf_flags.no_sctp = - yaml_iter_bool(&fd_iter); + ogs_yaml_iter_bool(&fd_iter); } else if (!strcmp(fd_key, "listen_on")) { self.fd_config->cnf_addr = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "load_extension")) { - yaml_iter_t ext_array, ext_iter; - yaml_iter_recurse(&fd_iter, &ext_array); + ogs_yaml_iter_t ext_array, ext_iter; + ogs_yaml_iter_recurse(&fd_iter, &ext_array); do { const char *module = NULL; const char *conf = NULL; - if (yaml_iter_type(&ext_array) == + if (ogs_yaml_iter_type(&ext_array) == YAML_MAPPING_NODE) { memcpy(&ext_iter, &ext_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&ext_array)) + if (!ogs_yaml_iter_next(&ext_array)) break; - yaml_iter_recurse( + ogs_yaml_iter_recurse( &ext_array, &ext_iter); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&ext_iter)) + while(ogs_yaml_iter_next(&ext_iter)) { const char *ext_key = - yaml_iter_key(&ext_iter); - d_assert(ext_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&ext_iter); + ogs_assert(ext_key); if (!strcmp(ext_key, "module")) { - module = yaml_iter_value(&ext_iter); + module = ogs_yaml_iter_value(&ext_iter); } else if (!strcmp(ext_key, "conf")) { - conf = yaml_iter_value(&ext_iter); + conf = ogs_yaml_iter_value(&ext_iter); } else - d_warn("unknown key `%s`", ext_key); + ogs_warn("unknown key `%s`", ext_key); } if (module) @@ -213,62 +204,61 @@ status_t hss_context_parse_config() conf = conf; self.fd_config->num_of_ext++; } - } while(yaml_iter_type(&ext_array) == + } while(ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(fd_key, "connect")) { - yaml_iter_t conn_array, conn_iter; - yaml_iter_recurse(&fd_iter, &conn_array); + ogs_yaml_iter_t conn_array, conn_iter; + ogs_yaml_iter_recurse(&fd_iter, &conn_array); do { const char *identity = NULL; const char *addr = NULL; - c_uint16_t port = 0; + uint16_t port = 0; - if (yaml_iter_type(&conn_array) == + if (ogs_yaml_iter_type(&conn_array) == YAML_MAPPING_NODE) { memcpy(&conn_iter, &conn_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&conn_array)) + if (!ogs_yaml_iter_next(&conn_array)) break; - yaml_iter_recurse(&conn_array, &conn_iter); + ogs_yaml_iter_recurse(&conn_array, &conn_iter); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&conn_iter)) + while(ogs_yaml_iter_next(&conn_iter)) { const char *conn_key = - yaml_iter_key(&conn_iter); - d_assert(conn_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&conn_iter); + ogs_assert(conn_key); if (!strcmp(conn_key, "identity")) { - identity = yaml_iter_value(&conn_iter); + identity = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "addr")) { - addr = yaml_iter_value(&conn_iter); + addr = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "port")) { const char *v = - yaml_iter_value(&conn_iter); + ogs_yaml_iter_value(&conn_iter); if (v) port = atoi(v); } else - d_warn("unknown key `%s`", conn_key); + ogs_warn("unknown key `%s`", conn_key); } if (identity && addr) @@ -284,79 +274,53 @@ status_t hss_context_parse_config() port = port; self.fd_config->num_of_conn++; } - } while(yaml_iter_type(&conn_array) == + } while(ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", fd_key); + ogs_warn("unknown key `%s`", fd_key); } } } else - d_warn("unknown key `%s`", hss_key); + ogs_warn("unknown key `%s`", hss_key); } } } rv = hss_context_validation(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } -status_t hss_context_setup_trace_module() +int hss_db_init() { - int app = context_self()->logger.trace.app; - int diameter = context_self()->logger.trace.diameter; - - if (app) - { - extern int _hss_context; - d_trace_level(&_hss_context, app); - } - - if (diameter) - { - extern int _hss_fd_path; - d_trace_level(&_hss_fd_path, diameter); - extern int _fd_init; - d_trace_level(&_fd_init, diameter); - extern int _fd_logger; - d_trace_level(&_fd_logger, diameter); - } - - return CORE_OK; -} - -status_t hss_db_init() -{ - if (context_self()->db_client && context_self()->db_name) + if (context_self()->db.client && context_self()->db.name) { self.subscriberCollection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); - d_assert(self.subscriberCollection, return CORE_ERROR, - "Couldn't find Subscriber Collection in '%s'", - context_self()->db_name); + context_self()->db.client, + context_self()->db.name, "subscribers"); + ogs_assert(self.subscriberCollection); } - return CORE_OK; + return OGS_OK; } -status_t hss_db_final() +int hss_db_final() { if (self.subscriberCollection) { mongoc_collection_destroy(self.subscriberCollection); } - return CORE_OK; + return OGS_OK; } -status_t hss_db_auth_info( +int hss_db_auth_info( char *imsi_bcd, hss_db_auth_info_t *auth_info) { - status_t rv = CORE_OK; + int rv = OGS_OK; mongoc_cursor_t *cursor = NULL; bson_t *query = NULL; bson_error_t error; @@ -365,12 +329,12 @@ status_t hss_db_auth_info( bson_iter_t inner_iter; char buf[HSS_KEY_LEN]; char *utf8 = NULL; - c_uint32_t length = 0; + uint32_t length = 0; - d_assert(imsi_bcd, return CORE_ERROR, "Null param"); - d_assert(auth_info, return CORE_ERROR, "Null param"); + ogs_assert(imsi_bcd); + ogs_assert(auth_info); - mutex_lock(self.db_lock); + ogs_thread_mutex_lock(&self.db_lock); query = BCON_NEW("imsi", BCON_UTF8(imsi_bcd)); #if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5 @@ -383,25 +347,25 @@ status_t hss_db_auth_info( if (!mongoc_cursor_next(cursor, &document)) { - d_warn("Cannot find IMSI in DB : %s", imsi_bcd); + ogs_warn("Cannot find IMSI in DB : %s", imsi_bcd); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } if (mongoc_cursor_error(cursor, &error)) { - d_error("Cursor Failure: %s", error.message); + ogs_error("Cursor Failure: %s", error.message); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } if (!bson_iter_init_find(&iter, document, "security")) { - d_error("No 'security' field in this document"); + ogs_error("No 'security' field in this document"); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } @@ -414,28 +378,28 @@ status_t hss_db_auth_info( if (!strcmp(key, "k") && BSON_ITER_HOLDS_UTF8(&inner_iter)) { utf8 = (char *)bson_iter_utf8(&inner_iter, &length); - memcpy(auth_info->k, CORE_HEX(utf8, length, buf), HSS_KEY_LEN); + memcpy(auth_info->k, OGS_HEX(utf8, length, buf), HSS_KEY_LEN); } else if (!strcmp(key, "opc") && BSON_ITER_HOLDS_UTF8(&inner_iter)) { utf8 = (char *)bson_iter_utf8(&inner_iter, &length); auth_info->use_opc = 1; - memcpy(auth_info->opc, CORE_HEX(utf8, length, buf), HSS_KEY_LEN); + memcpy(auth_info->opc, OGS_HEX(utf8, length, buf), HSS_KEY_LEN); } else if (!strcmp(key, "op") && BSON_ITER_HOLDS_UTF8(&inner_iter)) { utf8 = (char *)bson_iter_utf8(&inner_iter, &length); - memcpy(auth_info->op, CORE_HEX(utf8, length, buf), HSS_KEY_LEN); + memcpy(auth_info->op, OGS_HEX(utf8, length, buf), HSS_KEY_LEN); } else if (!strcmp(key, "amf") && BSON_ITER_HOLDS_UTF8(&inner_iter)) { utf8 = (char *)bson_iter_utf8(&inner_iter, &length); - memcpy(auth_info->amf, CORE_HEX(utf8, length, buf), HSS_AMF_LEN); + memcpy(auth_info->amf, OGS_HEX(utf8, length, buf), HSS_AMF_LEN); } else if (!strcmp(key, "rand") && BSON_ITER_HOLDS_UTF8(&inner_iter)) { utf8 = (char *)bson_iter_utf8(&inner_iter, &length); - memcpy(auth_info->rand, CORE_HEX(utf8, length, buf), RAND_LEN); + memcpy(auth_info->rand, OGS_HEX(utf8, length, buf), RAND_LEN); } else if (!strcmp(key, "sqn") && BSON_ITER_HOLDS_INT64(&inner_iter)) { @@ -447,24 +411,24 @@ out: if (query) bson_destroy(query); if (cursor) mongoc_cursor_destroy(cursor); - mutex_unlock(self.db_lock); + ogs_thread_mutex_unlock(&self.db_lock); return rv; } -status_t hss_db_update_rand_and_sqn( - char *imsi_bcd, c_uint8_t *rand, c_uint64_t sqn) +int hss_db_update_rand_and_sqn( + char *imsi_bcd, uint8_t *rand, uint64_t sqn) { - status_t rv = CORE_OK; + int rv = OGS_OK; bson_t *query = NULL; bson_t *update = NULL; bson_error_t error; char printable_rand[128]; - d_assert(rand, return CORE_ERROR, "Null param"); - core_hex_to_ascii(rand, RAND_LEN, printable_rand, sizeof(printable_rand)); + ogs_assert(rand); + ogs_hex_to_ascii(rand, RAND_LEN, printable_rand, sizeof(printable_rand)); - mutex_lock(self.db_lock); + ogs_thread_mutex_lock(&self.db_lock); query = BCON_NEW("imsi", BCON_UTF8(imsi_bcd)); update = BCON_NEW("$set", @@ -476,28 +440,28 @@ status_t hss_db_update_rand_and_sqn( if (!mongoc_collection_update(self.subscriberCollection, MONGOC_UPDATE_NONE, query, update, NULL, &error)) { - d_error("mongoc_collection_update() failure: %s", error.message); + ogs_error("mongoc_collection_update() failure: %s", error.message); - rv = CORE_ERROR; + rv = OGS_ERROR; } if (query) bson_destroy(query); if (update) bson_destroy(update); - mutex_unlock(self.db_lock); + ogs_thread_mutex_unlock(&self.db_lock); return rv; } -status_t hss_db_increment_sqn(char *imsi_bcd) +int hss_db_increment_sqn(char *imsi_bcd) { - status_t rv = CORE_OK; + int rv = OGS_OK; bson_t *query = NULL; bson_t *update = NULL; bson_error_t error; - c_uint64_t max_sqn = HSS_MAX_SQN; + uint64_t max_sqn = HSS_MAX_SQN; - mutex_lock(self.db_lock); + ogs_thread_mutex_lock(&self.db_lock); query = BCON_NEW("imsi", BCON_UTF8(imsi_bcd)); update = BCON_NEW("$inc", @@ -507,9 +471,9 @@ status_t hss_db_increment_sqn(char *imsi_bcd) if (!mongoc_collection_update(self.subscriberCollection, MONGOC_UPDATE_NONE, query, update, NULL, &error)) { - d_error("mongoc_collection_update() failure: %s", error.message); + ogs_error("mongoc_collection_update() failure: %s", error.message); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } bson_destroy(update); @@ -522,24 +486,24 @@ status_t hss_db_increment_sqn(char *imsi_bcd) if (!mongoc_collection_update(self.subscriberCollection, MONGOC_UPDATE_NONE, query, update, NULL, &error)) { - d_error("mongoc_collection_update() failure: %s", error.message); + ogs_error("mongoc_collection_update() failure: %s", error.message); - rv = CORE_ERROR; + rv = OGS_ERROR; } out: if (query) bson_destroy(query); if (update) bson_destroy(update); - mutex_unlock(self.db_lock); + ogs_thread_mutex_unlock(&self.db_lock); return rv; } -status_t hss_db_subscription_data( +int hss_db_subscription_data( char *imsi_bcd, s6a_subscription_data_t *subscription_data) { - status_t rv = CORE_OK; + int rv = OGS_OK; mongoc_cursor_t *cursor = NULL; bson_t *query = NULL; bson_error_t error; @@ -547,12 +511,12 @@ status_t hss_db_subscription_data( bson_iter_t iter; bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter; const char *utf8 = NULL; - c_uint32_t length = 0; + uint32_t length = 0; - d_assert(imsi_bcd, return CORE_ERROR, "Null param"); - d_assert(subscription_data, return CORE_ERROR, "Null param"); + ogs_assert(imsi_bcd); + ogs_assert(subscription_data); - mutex_lock(self.db_lock); + ogs_thread_mutex_lock(&self.db_lock); query = BCON_NEW("imsi", BCON_UTF8(imsi_bcd)); #if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5 @@ -565,25 +529,25 @@ status_t hss_db_subscription_data( if (!mongoc_cursor_next(cursor, &document)) { - d_error("Cannot find IMSI in DB : %s", imsi_bcd); + ogs_error("Cannot find IMSI in DB : %s", imsi_bcd); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } if (mongoc_cursor_error(cursor, &error)) { - d_error("Cursor Failure: %s", error.message); + ogs_error("Cursor Failure: %s", error.message); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } if (!bson_iter_init(&iter, document)) { - d_error("bson_iter_init failed in this document"); + ogs_error("bson_iter_init failed in this document"); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } @@ -648,11 +612,9 @@ status_t hss_db_subscription_data( const char *child1_key = bson_iter_key(&child1_iter); pdn_t *pdn = NULL; - d_assert(child1_key, goto out, "PDN is not ARRAY"); + ogs_assert(child1_key); pdn_index = atoi(child1_key); - d_assert(pdn_index < MAX_NUM_OF_SESS, - goto out, "Overflow of PDN number(%d>%d)", - pdn_index, MAX_NUM_OF_SESS); + ogs_assert(pdn_index < MAX_NUM_OF_SESS); pdn = &subscription_data->pdn[pdn_index]; @@ -664,8 +626,8 @@ status_t hss_db_subscription_data( BSON_ITER_HOLDS_UTF8(&child2_iter)) { utf8 = bson_iter_utf8(&child2_iter, &length); - core_cpystrn(pdn->apn, utf8, - c_min(length, MAX_APN_LEN)+1); + ogs_cpystrn(pdn->apn, utf8, + ogs_min(length, MAX_APN_LEN)+1); } else if (!strcmp(child2_key, "type") && BSON_ITER_HOLDS_INT32(&child2_iter)) @@ -750,11 +712,11 @@ status_t hss_db_subscription_data( if (!strcmp(child3_key, "addr") && BSON_ITER_HOLDS_UTF8(&child3_iter)) { - ipsubnet_t ipsub; + ogs_ipsubnet_t ipsub; const char *v = bson_iter_utf8(&child3_iter, &length); - rv = core_ipsubnet(&ipsub, v, NULL); - if (rv == CORE_OK) + rv = ogs_ipsubnet(&ipsub, v, NULL); + if (rv == OGS_OK) { pdn->pgw_ip.ipv4 = 1; pdn->pgw_ip.both.addr = ipsub.sub[0]; @@ -763,11 +725,11 @@ status_t hss_db_subscription_data( else if (!strcmp(child3_key, "addr6") && BSON_ITER_HOLDS_UTF8(&child3_iter)) { - ipsubnet_t ipsub; + ogs_ipsubnet_t ipsub; const char *v = bson_iter_utf8(&child3_iter, &length); - rv = core_ipsubnet(&ipsub, v, NULL); - if (rv == CORE_OK) + rv = ogs_ipsubnet(&ipsub, v, NULL); + if (rv == OGS_OK) { pdn->pgw_ip.ipv6 = 1; memcpy(pdn->pgw_ip.both.addr6, @@ -787,7 +749,7 @@ out: if (query) bson_destroy(query); if (cursor) mongoc_cursor_destroy(cursor); - mutex_unlock(self.db_lock); + ogs_thread_mutex_unlock(&self.db_lock); return rv; } diff --git a/src/hss/hss_context.h b/src/hss/hss_context.h index 83cd0adb7..bf63ac245 100644 --- a/src/hss/hss_context.h +++ b/src/hss/hss_context.h @@ -1,9 +1,6 @@ #ifndef __HSS_CONTEXT_H__ #define __HSS_CONTEXT_H__ -#include "core_errno.h" -#include "core_mutex.h" - #include "fd/s6a/s6a_message.h" #ifdef __cplusplus @@ -15,14 +12,19 @@ extern "C" { #define HSS_MAX_SQN 0x7ffffffffff +extern int __hss_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __hss_log_domain + typedef struct _hss_db_auth_info_t { - c_uint8_t k[HSS_KEY_LEN]; - c_uint8_t use_opc; - c_uint8_t opc[HSS_KEY_LEN]; - c_uint8_t op[HSS_KEY_LEN]; - c_uint8_t amf[HSS_AMF_LEN]; - c_uint8_t rand[RAND_LEN]; - c_uint64_t sqn; + uint8_t k[HSS_KEY_LEN]; + uint8_t use_opc; + uint8_t opc[HSS_KEY_LEN]; + uint8_t op[HSS_KEY_LEN]; + uint8_t amf[HSS_AMF_LEN]; + uint8_t rand[RAND_LEN]; + uint64_t sqn; } hss_db_auth_info_t; typedef struct _fd_config_t fd_config_t; @@ -31,26 +33,23 @@ typedef struct _hss_context_t { fd_config_t *fd_config; /* HSS freeDiameter config */ void *subscriberCollection; - mutex_id db_lock; + ogs_thread_mutex_t db_lock; } hss_context_t; -CORE_DECLARE(status_t) hss_context_init(void); -CORE_DECLARE(status_t) hss_context_final(void); -CORE_DECLARE(hss_context_t*) hss_self(void); +int hss_context_init(void); +int hss_context_final(void); +hss_context_t* hss_self(void); -CORE_DECLARE(status_t) hss_context_parse_config(void); -CORE_DECLARE(status_t) hss_context_setup_trace_module(void); +int hss_context_parse_config(void); -CORE_DECLARE(status_t) hss_db_init(void); -CORE_DECLARE(status_t) hss_db_final(void); +int hss_db_init(void); +int hss_db_final(void); -CORE_DECLARE(status_t) hss_db_auth_info( - char *imsi_bcd, hss_db_auth_info_t *auth_info); -CORE_DECLARE(status_t) hss_db_update_rand_and_sqn( - char *imsi_bcd, c_uint8_t *rand, c_uint64_t sqn); -CORE_DECLARE(status_t) hss_db_increment_sqn(char *imsi_bcd); +int hss_db_auth_info(char *imsi_bcd, hss_db_auth_info_t *auth_info); +int hss_db_update_rand_and_sqn(char *imsi_bcd, uint8_t *rand, uint64_t sqn); +int hss_db_increment_sqn(char *imsi_bcd); -CORE_DECLARE(status_t) hss_db_subscription_data( +int hss_db_subscription_data( char *imsi_bcd, s6a_subscription_data_t *subscription_data); #ifdef __cplusplus diff --git a/src/hss/hss_fd_path.c b/src/hss/hss_fd_path.c index c693db711..79d25705e 100644 --- a/src/hss/hss_fd_path.c +++ b/src/hss/hss_fd_path.c @@ -1,9 +1,4 @@ -#define TRACE_MODULE _hss_fd_path - -#include "core_debug.h" -#include "core_lib.h" -#include "core_sha2.h" -#include "core_network.h" +#include "ogs-crypt.h" #include "fd/fd_lib.h" #include "fd/s6a/s6a_dict.h" @@ -25,7 +20,7 @@ static int hss_s6a_fb_cb(struct msg **msg, struct avp *avp, struct session *session, void *opaque, enum disp_action *act) { /* This CB should never be called */ - d_warn("Unexpected message received!"); + ogs_warn("Unexpected message received!"); return ENOTSUP; } @@ -42,44 +37,44 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp, struct avp_hdr *hdr; union avp_value val; - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; - c_uint8_t opc[HSS_KEY_LEN]; - c_uint8_t sqn[HSS_SQN_LEN]; - c_uint8_t autn[AUTN_LEN]; - c_uint8_t ik[HSS_KEY_LEN]; - c_uint8_t ck[HSS_KEY_LEN]; - c_uint8_t ak[HSS_AK_LEN]; - c_uint8_t xres[MAX_RES_LEN]; - c_uint8_t kasme[SHA256_DIGEST_SIZE]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; + uint8_t opc[HSS_KEY_LEN]; + uint8_t sqn[HSS_SQN_LEN]; + uint8_t autn[AUTN_LEN]; + uint8_t ik[HSS_KEY_LEN]; + uint8_t ck[HSS_KEY_LEN]; + uint8_t ak[HSS_AK_LEN]; + uint8_t xres[MAX_RES_LEN]; + uint8_t kasme[OGS_SHA256_DIGEST_SIZE]; size_t xres_len = 8; #define MAC_S_LEN 8 - c_uint8_t mac_s[MAC_S_LEN]; + uint8_t mac_s[MAC_S_LEN]; hss_db_auth_info_t auth_info; - c_uint8_t zero[RAND_LEN]; - status_t rv; - c_uint32_t result_code = 0; + uint8_t zero[RAND_LEN]; + int rv; + uint32_t result_code = 0; - d_assert(msg, return EINVAL,); + ogs_assert(msg); - d_trace(3, "[HSS] Authentication-Information-Request\n"); + ogs_debug("[HSS] Authentication-Information-Request\n"); /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ans = *msg; ret = fd_msg_search_avp(qry, fd_user_name, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); - core_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data, - c_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1); + ogs_assert(ret == 0); + ogs_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data, + ogs_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1); rv = hss_db_auth_info(imsi_bcd, &auth_info); - if (rv != CORE_OK) + if (rv != OGS_OK) { result_code = S6A_DIAMETER_ERROR_USER_UNKNOWN; goto out; @@ -88,7 +83,7 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp, memset(zero, 0, sizeof(zero)); if (memcmp(auth_info.rand, zero, RAND_LEN) == 0) { - core_generate_random_bytes(auth_info.rand, RAND_LEN); + ogs_random(auth_info.rand, RAND_LEN); } if (auth_info.use_opc) @@ -97,33 +92,34 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp, milenage_opc(auth_info.k, auth_info.op, opc); ret = fd_msg_search_avp(qry, s6a_req_eutran_auth_info, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, s6a_re_synchronization_info, &avpch); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avpch) { ret = fd_msg_avp_hdr(avpch, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); hss_auc_sqn(opc, auth_info.k, hdr->avp_value->os.data, sqn, mac_s); if (memcmp(mac_s, hdr->avp_value->os.data + RAND_LEN + HSS_SQN_LEN, MAC_S_LEN) == 0) { - core_generate_random_bytes(auth_info.rand, RAND_LEN); - auth_info.sqn = core_buffer_to_uint64(sqn, HSS_SQN_LEN); + ogs_random(auth_info.rand, RAND_LEN); + auth_info.sqn = ogs_buffer_to_uint64(sqn, HSS_SQN_LEN); /* 33.102 C.3.4 Guide : IND + 1 */ auth_info.sqn = (auth_info.sqn + 32 + 1) & HSS_MAX_SQN; } else { - d_error("Re-synch MAC failed for IMSI:`%s`", imsi_bcd); - d_print("MAC_S: "); - d_print_hex(mac_s, MAC_S_LEN); - d_print_hex(hdr->avp_value->os.data + - RAND_LEN + HSS_SQN_LEN, MAC_S_LEN); - d_print("SQN: "); - d_print_hex(sqn, HSS_SQN_LEN); + ogs_error("Re-synch MAC failed for IMSI:`%s`", imsi_bcd); + ogs_log_print(OGS_LOG_ERROR, "MAC_S: "); + ogs_log_hexdump(OGS_LOG_ERROR, mac_s, MAC_S_LEN); + ogs_log_hexdump(OGS_LOG_ERROR, + (void*)(hdr->avp_value->os.data + RAND_LEN + HSS_SQN_LEN), + MAC_S_LEN); + ogs_log_print(OGS_LOG_ERROR, "SQN: "); + ogs_log_hexdump(OGS_LOG_ERROR, sqn, HSS_SQN_LEN); result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE; goto out; } @@ -131,130 +127,130 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp, } rv = hss_db_update_rand_and_sqn(imsi_bcd, auth_info.rand, auth_info.sqn); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Cannot update rand and sqn for IMSI:'%s'", imsi_bcd); + ogs_error("Cannot update rand and sqn for IMSI:'%s'", imsi_bcd); result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE; goto out; } rv = hss_db_increment_sqn(imsi_bcd); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Cannot increment sqn for IMSI:'%s'", imsi_bcd); + ogs_error("Cannot increment sqn for IMSI:'%s'", imsi_bcd); result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE; goto out; } ret = fd_msg_search_avp(qry, s6a_visited_plmn_id, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); #if 0 // TODO : check visited_plmn_id memcpy(visited_plmn_id, hdr->avp_value->os.data, hdr->avp_value->os.len); #endif milenage_generate(opc, auth_info.amf, auth_info.k, - core_uint64_to_buffer(auth_info.sqn, HSS_SQN_LEN, sqn), auth_info.rand, + ogs_uint64_to_buffer(auth_info.sqn, HSS_SQN_LEN, sqn), auth_info.rand, autn, ik, ck, ak, xres, &xres_len); hss_auc_kasme(ck, ik, hdr->avp_value->os.data, sqn, ak, kasme); /* Set the Authentication-Info */ ret = fd_msg_avp_new(s6a_authentication_info, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_e_utran_vector, 0, &avp_e_utran_vector); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_rand, 0, &avp_rand); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.os.data = auth_info.rand; val.os.len = HSS_KEY_LEN; ret = fd_msg_avp_setvalue(avp_rand, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_e_utran_vector, MSG_BRW_LAST_CHILD, avp_rand); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_xres, 0, &avp_xres); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.os.data = xres; val.os.len = xres_len; ret = fd_msg_avp_setvalue(avp_xres, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_e_utran_vector, MSG_BRW_LAST_CHILD, avp_xres); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_autn, 0, &avp_autn); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.os.data = autn; val.os.len = AUTN_LEN; ret = fd_msg_avp_setvalue(avp_autn, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_e_utran_vector, MSG_BRW_LAST_CHILD, avp_autn); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_kasme, 0, &avp_kasme); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.os.data = kasme; - val.os.len = SHA256_DIGEST_SIZE; + val.os.len = OGS_SHA256_DIGEST_SIZE; ret = fd_msg_avp_setvalue(avp_kasme, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_e_utran_vector, MSG_BRW_LAST_CHILD, avp_kasme); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_e_utran_vector); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Auth-Session-State AVP */ ret = fd_msg_avp_new(fd_auth_session_state, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = fd_message_vendor_specific_appid_set(ans, S6A_APPLICATION_ID); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); - d_trace(3, "[HSS] Authentication-Information-Answer\n"); + ogs_debug("[HSS] Authentication-Information-Answer\n"); /* Add this value to the stats */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); return 0; out: ret = fd_message_experimental_rescode_set(ans, result_code); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Auth-Session-State AVP */ ret = fd_msg_avp_new(fd_auth_session_state, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = fd_message_vendor_specific_appid_set(ans, S6A_APPLICATION_ID); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); return 0; } @@ -269,73 +265,73 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp, struct avp_hdr *hdr; union avp_value val; - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; - status_t rv; - c_uint32_t result_code = 0; + int rv; + uint32_t result_code = 0; s6a_subscription_data_t subscription_data; struct sockaddr_in sin; struct sockaddr_in6 sin6; - d_assert(msg, return EINVAL,); + ogs_assert(msg); - d_trace(3, "[HSS] Update-Location-Request\n"); + ogs_debug("[HSS] Update-Location-Request\n"); /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ans = *msg; ret = fd_msg_search_avp(qry, fd_user_name, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,) - core_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data, - c_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1); + ogs_assert(ret == 0); + ogs_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data, + ogs_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1); rv = hss_db_subscription_data(imsi_bcd, &subscription_data); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Cannot get Subscription-Data for IMSI:'%s'", imsi_bcd); + ogs_error("Cannot get Subscription-Data for IMSI:'%s'", imsi_bcd); result_code = S6A_DIAMETER_ERROR_USER_UNKNOWN; goto out; } ret = fd_msg_search_avp(qry, s6a_visited_plmn_id, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); #if 0 // TODO : check visited_plmn_id memcpy(visited_plmn_id, hdr->avp_value->os.data, hdr->avp_value->os.len); #endif /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set the Auth-Session-State AVP */ ret = fd_msg_avp_new(fd_auth_session_state, 0, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set the ULA Flags */ ret = fd_msg_avp_new(s6a_ula_flags, 0, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = S6A_ULA_FLAGS_MME_REGISTERED_FOR_SMS; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_search_avp(qry, s6a_ulr_flags, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); if (!(hdr->avp_value->u32 & S6A_ULR_SKIP_SUBSCRIBER_DATA)) { struct avp *avp_access_restriction_data; @@ -345,57 +341,57 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp, /* Set the Subscription Data */ ret = fd_msg_avp_new(s6a_subscription_data, 0, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); if (subscription_data.access_restriction_data) { ret = fd_msg_avp_new(s6a_access_restriction_data, 0, &avp_access_restriction_data); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = subscription_data.access_restriction_data; ret = fd_msg_avp_setvalue( avp_access_restriction_data, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_access_restriction_data); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } ret = fd_msg_avp_new(s6a_subscriber_status, 0, &avp_subscriber_status); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = subscription_data.subscriber_status; ret = fd_msg_avp_setvalue(avp_subscriber_status, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_subscriber_status); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_network_access_mode, 0, &avp_network_access_mode); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = subscription_data.network_access_mode; ret = fd_msg_avp_setvalue(avp_network_access_mode, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_network_access_mode); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set the AMBR */ ret = fd_msg_avp_new(s6a_ambr, 0, &avp_ambr); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_max_bandwidth_ul, 0, &avp_max_bandwidth_ul); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = subscription_data.ambr.uplink; ret = fd_msg_avp_setvalue(avp_max_bandwidth_ul, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, avp_max_bandwidth_ul); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_max_bandwidth_dl, 0, &avp_max_bandwidth_dl); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = subscription_data.ambr.downlink; ret = fd_msg_avp_setvalue(avp_max_bandwidth_dl, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, avp_max_bandwidth_dl); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_ambr); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); if (subscription_data.num_of_pdn) { @@ -406,30 +402,30 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_new(s6a_apn_configuration_profile, 0, &apn_configuration_profile); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_context_identifier, 0, &context_identifier); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = 1; /* Context Identifier : 1 */ ret = fd_msg_avp_setvalue(context_identifier, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration_profile, MSG_BRW_LAST_CHILD, context_identifier); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new( s6a_all_apn_configuration_included_indicator, 0, &all_apn_configuration_included_indicator); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = 0; ret = fd_msg_avp_setvalue( all_apn_configuration_included_indicator, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration_profile, MSG_BRW_LAST_CHILD, all_apn_configuration_included_indicator); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); for (i = 0; i < subscription_data.num_of_pdn; i++) { @@ -442,248 +438,248 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp, struct avp *mip6_agent_info, *mip_home_agent_address; pdn_t *pdn = &subscription_data.pdn[i]; - d_assert(pdn, goto out,); + ogs_assert(pdn); pdn->context_identifier = i+1; ret = fd_msg_avp_new(s6a_apn_configuration, 0, &apn_configuration); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set Context-Identifier */ ret = fd_msg_avp_new(s6a_context_identifier, 0, &context_identifier); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = pdn->context_identifier; ret = fd_msg_avp_setvalue(context_identifier, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, context_identifier); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set PDN-Type */ ret = fd_msg_avp_new(s6a_pdn_type, 0, &pdn_type); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = pdn->pdn_type; ret = fd_msg_avp_setvalue(pdn_type, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, pdn_type); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set Service-Selection */ ret = fd_msg_avp_new(s6a_service_selection, 0, &service_selection); - d_assert(ret == 0, return EINVAL,) - val.os.data = (c_uint8_t *)pdn->apn; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)pdn->apn; val.os.len = strlen(pdn->apn); ret = fd_msg_avp_setvalue(service_selection, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, service_selection); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set the EPS Subscribed QoS Profile */ ret = fd_msg_avp_new(s6a_eps_subscribed_qos_profile, 0, &eps_subscribed_qos_profile); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_qos_class_identifier, 0, &qos_class_identifier); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = pdn->qos.qci; ret = fd_msg_avp_setvalue(qos_class_identifier, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(eps_subscribed_qos_profile, MSG_BRW_LAST_CHILD, qos_class_identifier); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set Allocation retention priority */ ret = fd_msg_avp_new(s6a_allocation_retention_priority, 0, &allocation_retention_priority); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_priority_level, 0, &priority_level); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = pdn->qos.arp.priority_level; ret = fd_msg_avp_setvalue(priority_level, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(allocation_retention_priority, MSG_BRW_LAST_CHILD, priority_level); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_pre_emption_capability, 0, &pre_emption_capability); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = pdn->qos.arp.pre_emption_capability; ret = fd_msg_avp_setvalue(pre_emption_capability, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(allocation_retention_priority, MSG_BRW_LAST_CHILD, pre_emption_capability); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_pre_emption_vulnerability, 0, &pre_emption_vulnerability); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = pdn->qos.arp.pre_emption_vulnerability; ret = fd_msg_avp_setvalue(pre_emption_vulnerability, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(allocation_retention_priority, MSG_BRW_LAST_CHILD, pre_emption_vulnerability); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(eps_subscribed_qos_profile, MSG_BRW_LAST_CHILD, allocation_retention_priority); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, eps_subscribed_qos_profile); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set MIP6-Agent-Info */ if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6) { ret = fd_msg_avp_new(fd_mip6_agent_info, 0, &mip6_agent_info); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); if (pdn->pgw_ip.ipv4) { ret = fd_msg_avp_new(fd_mip_home_agent_address, 0, &mip_home_agent_address); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); sin.sin_family = AF_INET; sin.sin_addr.s_addr = pdn->pgw_ip.both.addr; ret = fd_msg_avp_value_encode ( &sin, mip_home_agent_address ); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(mip6_agent_info, MSG_BRW_LAST_CHILD, mip_home_agent_address); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } if (pdn->pgw_ip.ipv6) { ret = fd_msg_avp_new(fd_mip_home_agent_address, 0, &mip_home_agent_address); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); sin6.sin6_family = AF_INET6; memcpy(sin6.sin6_addr.s6_addr, pdn->pgw_ip.both.addr6, sizeof pdn->pgw_ip.both.addr6); ret = fd_msg_avp_value_encode ( &sin6, mip_home_agent_address ); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(mip6_agent_info, MSG_BRW_LAST_CHILD, mip_home_agent_address); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, mip6_agent_info); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } /* Set AMBR */ if (pdn->ambr.downlink || pdn->ambr.uplink) { ret = fd_msg_avp_new(s6a_ambr, 0, &avp_ambr); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_max_bandwidth_ul, 0, &avp_max_bandwidth_ul); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = pdn->ambr.uplink; ret = fd_msg_avp_setvalue(avp_max_bandwidth_ul, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, avp_max_bandwidth_ul); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_max_bandwidth_dl, 0, &avp_max_bandwidth_dl); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.u32 = pdn->ambr.downlink; ret = fd_msg_avp_setvalue(avp_max_bandwidth_dl, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, avp_max_bandwidth_dl); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, avp_ambr); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } ret = fd_msg_avp_add(apn_configuration_profile, MSG_BRW_LAST_CHILD, apn_configuration); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, apn_configuration_profile); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); } ret = fd_msg_avp_new(s6a_subscribed_rau_tau_timer, 0, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = subscription_data.subscribed_rau_tau_timer * 60; /* seconds */ ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = fd_message_vendor_specific_appid_set(ans, S6A_APPLICATION_ID); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); - d_trace(3, "[HSS] Update-Location-Answer\n"); + ogs_debug("[HSS] Update-Location-Answer\n"); /* Add this value to the stats */ - d_assert( pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert( pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert( pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert( pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); return 0; out: ret = fd_message_experimental_rescode_set(ans, result_code); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set the Auth-Session-State AVP */ ret = fd_msg_avp_new(fd_auth_session_state, 0, &avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = fd_message_vendor_specific_appid_set(ans, S6A_APPLICATION_ID); - d_assert(ret == 0, return EINVAL,) + ogs_assert(ret == 0); ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); return 0; } -status_t hss_fd_init(void) +int hss_fd_init(void) { int ret; struct disp_when data; ret = fd_init(FD_MODE_SERVER, hss_self()->fd_conf_path, hss_self()->fd_config); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Install objects definitions for this application */ ret = s6a_dict_init(); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); memset(&data, 0, sizeof(data)); data.app = s6a_application; @@ -691,25 +687,25 @@ status_t hss_fd_init(void) /* Fallback CB if command != unexpected message received */ ret = fd_disp_register(hss_s6a_fb_cb, DISP_HOW_APPID, &data, NULL, &hdl_s6a_fb); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Specific handler for Authentication-Information-Request */ data.command = s6a_cmd_air; ret = fd_disp_register(hss_s6a_air_cb, DISP_HOW_CC, &data, NULL, &hdl_s6a_air); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Specific handler for Location-Update-Request */ data.command = s6a_cmd_ulr; ret = fd_disp_register(hss_s6a_ulr_cb, DISP_HOW_CC, &data, NULL, &hdl_s6a_ulr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Advertise the support for the application in the peer */ ret = fd_disp_app_support(s6a_application, fd_vendor, 1, 0); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); - return CORE_OK; + return OGS_OK; } void hss_fd_final(void) diff --git a/src/hss/hss_fd_path.h b/src/hss/hss_fd_path.h index 1ff25baca..44cef7482 100644 --- a/src/hss/hss_fd_path.h +++ b/src/hss/hss_fd_path.h @@ -1,14 +1,12 @@ #ifndef __HSS_FD_PATH_H__ #define __HSS_FD_PATH_H__ -#include "core_errno.h" - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) hss_fd_init(void); -CORE_DECLARE(void) hss_fd_final(void); +int hss_fd_init(void); +void hss_fd_final(void); #ifdef __cplusplus } diff --git a/src/hss/hss_init.c b/src/hss/hss_init.c index bff0f73e1..c966c917c 100644 --- a/src/hss/hss_init.c +++ b/src/hss/hss_init.c @@ -1,32 +1,32 @@ -#define TRACE_MODULE _hss_init +#include "app/context.h" #include "hss_context.h" #include "hss_fd_path.h" static int initialized = 0; -status_t hss_initialize(void) +int hss_initialize(void) { - status_t rv; + int rv; rv = hss_context_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = hss_context_parse_config(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - rv = hss_context_setup_trace_module(); - if (rv != CORE_OK) return rv; + rv = context_setup_log_module(); + if (rv != OGS_OK) return rv; rv = hss_db_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = hss_fd_init(); - if (rv != CORE_OK) return CORE_ERROR; + if (rv != OGS_OK) return OGS_ERROR; initialized = 1; - return CORE_OK; + return OGS_OK; } void hss_terminate(void) diff --git a/src/hss/milenage.c b/src/hss/milenage.c index 145913343..89da73b3c 100644 --- a/src/hss/milenage.c +++ b/src/hss/milenage.c @@ -14,11 +14,7 @@ * c2=00..01, c3=00..02, c4=00..04, c5=00..08. The block cipher is assumed to * be AES (Rijndael). */ -#define TRACE_MODULE _milenage - -#include "core_debug.h" -#include "core_aes.h" -#include "core_sha2.h" +#include "ogs-crypt.h" #include "milenage.h" @@ -26,15 +22,15 @@ #define os_memcmp memcmp #define os_memcmp_const memcmp -int aes_128_encrypt_block(const c_uint8_t *key, - const c_uint8_t *in, c_uint8_t *out) +int aes_128_encrypt_block(const uint8_t *key, + const uint8_t *in, uint8_t *out) { const int key_bits = 128; - unsigned int rk[RKLENGTH(128)]; + unsigned int rk[OGS_AES_RKLENGTH(128)]; int nrounds; - nrounds = aes_setup_enc(rk, key, key_bits); - aes_encrypt(rk, nrounds, in, out); + nrounds = ogs_aes_setup_enc(rk, key, key_bits); + ogs_aes_encrypt(rk, nrounds, in, out); return 0; } @@ -50,11 +46,11 @@ int aes_128_encrypt_block(const c_uint8_t *key, * @mac_s: Buffer for MAC-S = 64-bit resync authentication code, or %NULL * Returns: 0 on success, -1 on failure */ -int milenage_f1(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, const c_uint8_t *sqn, - const c_uint8_t *amf, c_uint8_t *mac_a, c_uint8_t *mac_s) +int milenage_f1(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, const uint8_t *sqn, + const uint8_t *amf, uint8_t *mac_a, uint8_t *mac_s) { - c_uint8_t tmp1[16], tmp2[16], tmp3[16]; + uint8_t tmp1[16], tmp2[16], tmp3[16]; int i; /* tmp1 = TEMP = E_K(RAND XOR OP_C) */ @@ -103,11 +99,11 @@ int milenage_f1(const c_uint8_t *opc, const c_uint8_t *k, * @akstar: Buffer for AK = 48-bit anonymity key (f5*), or %NULL * Returns: 0 on success, -1 on failure */ -int milenage_f2345(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, c_uint8_t *res, c_uint8_t *ck, - c_uint8_t *ik, c_uint8_t *ak, c_uint8_t *akstar) +int milenage_f2345(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, uint8_t *res, uint8_t *ck, + uint8_t *ik, uint8_t *ak, uint8_t *akstar) { - c_uint8_t tmp1[16], tmp2[16], tmp3[16]; + uint8_t tmp1[16], tmp2[16], tmp3[16]; int i; /* tmp2 = TEMP = E_K(RAND XOR OP_C) */ @@ -189,13 +185,13 @@ int milenage_f2345(const c_uint8_t *opc, const c_uint8_t *k, * @res: Buffer for RES = 64-bit signed response (f2), or %NULL * @res_len: Max length for res; set to used length or 0 on failure */ -void milenage_generate(const c_uint8_t *opc, const c_uint8_t *amf, - const c_uint8_t *k, const c_uint8_t *sqn, const c_uint8_t *_rand, - c_uint8_t *autn, c_uint8_t *ik, c_uint8_t *ck, c_uint8_t *ak, - c_uint8_t *res, size_t *res_len) +void milenage_generate(const uint8_t *opc, const uint8_t *amf, + const uint8_t *k, const uint8_t *sqn, const uint8_t *_rand, + uint8_t *autn, uint8_t *ik, uint8_t *ck, uint8_t *ak, + uint8_t *res, size_t *res_len) { int i; - c_uint8_t mac_a[8]; + uint8_t mac_a[8]; if (*res_len < 8) { *res_len = 0; @@ -224,11 +220,11 @@ void milenage_generate(const c_uint8_t *opc, const c_uint8_t *amf, * @sqn: Buffer for SQN = 48-bit sequence number * Returns: 0 = success (sqn filled), -1 on failure */ -int milenage_auts(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, const c_uint8_t *auts, c_uint8_t *sqn) +int milenage_auts(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, const uint8_t *auts, uint8_t *sqn) { - c_uint8_t amf[2] = { 0x00, 0x00 }; /* TS 33.102 v7.0.0, 6.3.3 */ - c_uint8_t ak[6], mac_s[8]; + uint8_t amf[2] = { 0x00, 0x00 }; /* TS 33.102 v7.0.0, 6.3.3 */ + uint8_t ak[6], mac_s[8]; int i; if (milenage_f2345(opc, k, _rand, NULL, NULL, NULL, NULL, ak)) @@ -251,10 +247,10 @@ int milenage_auts(const c_uint8_t *opc, const c_uint8_t *k, * @kc: Buffer for Kc = 64-bit Kc * Returns: 0 on success, -1 on failure */ -int gsm_milenage(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, c_uint8_t *sres, c_uint8_t *kc) +int gsm_milenage(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, uint8_t *sres, uint8_t *kc) { - c_uint8_t res[8], ck[16], ik[16]; + uint8_t res[8], ck[16], ik[16]; int i; if (milenage_f2345(opc, k, _rand, res, ck, ik, NULL, NULL)) @@ -287,62 +283,74 @@ int gsm_milenage(const c_uint8_t *opc, const c_uint8_t *k, * @auts: 112-bit buffer for AUTS * Returns: 0 on success, -1 on failure, or -2 on synchronization failure */ -int milenage_check(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *sqn, const c_uint8_t *_rand, const c_uint8_t *autn, - c_uint8_t *ik, c_uint8_t *ck, c_uint8_t *res, size_t *res_len, - c_uint8_t *auts) +int milenage_check(const uint8_t *opc, const uint8_t *k, + const uint8_t *sqn, const uint8_t *_rand, const uint8_t *autn, + uint8_t *ik, uint8_t *ck, uint8_t *res, size_t *res_len, + uint8_t *auts) { int i; - c_uint8_t mac_a[8], ak[6], rx_sqn[6]; - const c_uint8_t *amf; + uint8_t mac_a[8], ak[6], rx_sqn[6]; + const uint8_t *amf; - d_trace(1, "Milenage: AUTN\n"); d_trace_hex(1, autn, 16); - d_trace(1, "Milenage: RAND\n"); d_trace_hex(1, _rand, 16); + ogs_log_print(OGS_LOG_INFO, "Milenage: AUTN\n"); + ogs_log_hexdump(OGS_LOG_INFO, autn, 16); + ogs_log_print(OGS_LOG_INFO, "Milenage: RAND\n"); + ogs_log_hexdump(OGS_LOG_INFO, _rand, 16); if (milenage_f2345(opc, k, _rand, res, ck, ik, ak, NULL)) return -1; *res_len = 8; - d_trace(1, "Milenage: RES\n"); d_trace_hex(1, res, *res_len); - d_trace(1, "Milenage: CK\n"); d_trace_hex(1, ck, 16); - d_trace(1, "Milenage: IK\n"); d_trace_hex(1, ik, 16); - d_trace(1, "Milenage: AK\n"); d_trace_hex(1, ak, 6); + ogs_log_print(OGS_LOG_INFO, "Milenage: RES\n"); + ogs_log_hexdump(OGS_LOG_INFO, res, *res_len); + ogs_log_print(OGS_LOG_INFO, "Milenage: CK\n"); + ogs_log_hexdump(OGS_LOG_INFO, ck, 16); + ogs_log_print(OGS_LOG_INFO, "Milenage: IK\n"); + ogs_log_hexdump(OGS_LOG_INFO, ik, 16); + ogs_log_print(OGS_LOG_INFO, "Milenage: AK\n"); + ogs_log_hexdump(OGS_LOG_INFO, ak, 6); /* AUTN = (SQN ^ AK) || AMF || MAC */ for (i = 0; i < 6; i++) rx_sqn[i] = autn[i] ^ ak[i]; - d_trace(1, "Milenage: SQN\n"); d_trace_hex(1, rx_sqn, 6); + ogs_log_print(OGS_LOG_INFO, "Milenage: SQN\n"); + ogs_log_hexdump(OGS_LOG_INFO, rx_sqn, 6); if (os_memcmp(rx_sqn, sqn, 6) <= 0) { - c_uint8_t auts_amf[2] = { 0x00, 0x00 }; /* TS 33.102 v7.0.0, 6.3.3 */ + uint8_t auts_amf[2] = { 0x00, 0x00 }; /* TS 33.102 v7.0.0, 6.3.3 */ if (milenage_f2345(opc, k, _rand, NULL, NULL, NULL, NULL, ak)) return -1; - d_trace(1, "Milenage: AK*\n"); d_trace_hex(1, ak, 6); + ogs_log_print(OGS_LOG_INFO, "Milenage: AK*\n"); + ogs_log_hexdump(OGS_LOG_INFO, ak, 6); for (i = 0; i < 6; i++) auts[i] = sqn[i] ^ ak[i]; if (milenage_f1(opc, k, _rand, sqn, auts_amf, NULL, auts + 6)) return -1; - d_trace(1, "Milenage: AUTS*\n"); d_trace_hex(1, auts, 14); + ogs_log_print(OGS_LOG_INFO, "Milenage: AUTS*\n"); + ogs_log_hexdump(OGS_LOG_INFO, auts, 14); return -2; } amf = autn + 6; - d_trace(1, "Milenage: AMF\n"); d_trace_hex(1, amf, 2); + ogs_log_print(OGS_LOG_INFO, "Milenage: AMF\n"); + ogs_log_hexdump(OGS_LOG_INFO, amf, 2); if (milenage_f1(opc, k, _rand, rx_sqn, amf, mac_a, NULL)) return -1; - d_trace(1, "Milenage: MAC_A\n"); d_trace_hex(1, mac_a, 8); + ogs_log_print(OGS_LOG_INFO, "Milenage: MAC_A\n"); + ogs_log_hexdump(OGS_LOG_INFO, mac_a, 8); if (os_memcmp_const(mac_a, autn + 8, 8) != 0) { - d_trace(1, "Milenage: MAC mismatch\n"); - d_trace(1, "Milenage: Received MAC_A\n"); d_trace_hex(1, autn + 8, 8); + ogs_log_print(OGS_LOG_INFO, "Milenage: MAC mismatch\n"); + ogs_log_print(OGS_LOG_INFO, "Milenage: Received MAC_A\n"); + ogs_log_hexdump(OGS_LOG_INFO, autn + 8, 8); return -1; } return 0; } -void milenage_opc(const c_uint8_t *k, const c_uint8_t *op, c_uint8_t *opc) +void milenage_opc(const uint8_t *k, const uint8_t *op, uint8_t *opc) { int i; diff --git a/src/hss/milenage.h b/src/hss/milenage.h index 0a269cd46..eca37d848 100644 --- a/src/hss/milenage.h +++ b/src/hss/milenage.h @@ -9,27 +9,25 @@ #ifndef __MILENAGE_H__ #define __MILENAGE_H__ -#include "core.h" +void milenage_generate(const uint8_t *opc, const uint8_t *amf, + const uint8_t *k, const uint8_t *sqn, const uint8_t *_rand, + uint8_t *autn, uint8_t *ik, uint8_t *ck, uint8_t *ak, + uint8_t *res, size_t *res_len); +int milenage_auts(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, const uint8_t *auts, uint8_t *sqn); +int gsm_milenage(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, uint8_t *sres, uint8_t *kc); +int milenage_check(const uint8_t *opc, const uint8_t *k, + const uint8_t *sqn, const uint8_t *_rand, const uint8_t *autn, + uint8_t *ik, uint8_t *ck, uint8_t *res, size_t *res_len, + uint8_t *auts); +int milenage_f1(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, const uint8_t *sqn, const uint8_t *amf, + uint8_t *mac_a, uint8_t *mac_s); +int milenage_f2345(const uint8_t *opc, const uint8_t *k, + const uint8_t *_rand, uint8_t *res, uint8_t *ck, uint8_t *ik, + uint8_t *ak, uint8_t *akstar); -void milenage_generate(const c_uint8_t *opc, const c_uint8_t *amf, - const c_uint8_t *k, const c_uint8_t *sqn, const c_uint8_t *_rand, - c_uint8_t *autn, c_uint8_t *ik, c_uint8_t *ck, c_uint8_t *ak, - c_uint8_t *res, size_t *res_len); -int milenage_auts(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, const c_uint8_t *auts, c_uint8_t *sqn); -int gsm_milenage(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, c_uint8_t *sres, c_uint8_t *kc); -int milenage_check(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *sqn, const c_uint8_t *_rand, const c_uint8_t *autn, - c_uint8_t *ik, c_uint8_t *ck, c_uint8_t *res, size_t *res_len, - c_uint8_t *auts); -int milenage_f1(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, const c_uint8_t *sqn, const c_uint8_t *amf, - c_uint8_t *mac_a, c_uint8_t *mac_s); -int milenage_f2345(const c_uint8_t *opc, const c_uint8_t *k, - const c_uint8_t *_rand, c_uint8_t *res, c_uint8_t *ck, c_uint8_t *ik, - c_uint8_t *ak, c_uint8_t *akstar); - -void milenage_opc(const c_uint8_t *k, const c_uint8_t *op, c_uint8_t *opc); +void milenage_opc(const uint8_t *k, const uint8_t *op, uint8_t *opc); #endif /* __MILENAGE_H__ */ diff --git a/src/mme.c b/src/mme.c index 86a372f93..1e5dc6b82 100644 --- a/src/mme.c +++ b/src/mme.c @@ -1,54 +1,42 @@ -#define TRACE_MODULE _mme_main - -#include "core_debug.h" -#include "core_signal.h" -#include "core_semaphore.h" - -#include "common/context.h" -#include "common/application.h" +#include "app/context.h" +#include "app/application.h" #include "app_init.h" -status_t app_initialize( - const char *config_path, const char *log_path, const char *pid_path) +extern int __mme_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __mme_log_domain + +int app_initialize(app_param_t *param) { - status_t rv; - int app = 0; + int rv; - rv = app_log_pid(pid_path, "mme"); - if (rv != CORE_OK) return rv; + param->name = "mme"; + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_mme_main, app); - } - - d_trace(1, "MME try to initialize\n"); rv = mme_initialize(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Failed to intialize MME"); + ogs_error("Failed to intialize MME"); return rv; } - d_trace(1, "MME initialize...done\n"); + ogs_info("MME initialize...done"); rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } void app_terminate(void) { app_will_terminate(); - d_trace(1, "MME try to terminate\n"); + ogs_info("MME try to terminate"); mme_terminate(); - d_trace(1, "MME terminate...done\n"); + ogs_info("MME terminate...done"); app_did_terminate(); } diff --git a/src/mme/Makefile.am b/src/mme/Makefile.am index 4736af4df..a2554a346 100644 --- a/src/mme/Makefile.am +++ b/src/mme/Makefile.am @@ -24,33 +24,34 @@ libmme_la_SOURCES = \ sbc_message.h sbc_handler.h sbc_handler.c \ $(NULL) -if USRSCTP +if WITH_USRSCTP libmme_la_SOURCES += s1ap_usrsctp.c else -libmme_la_SOURCES += s1ap_sctp.c +libmme_la_SOURCES += ogs-sctp.h ogs-sctp.c s1ap_lksctp.c endif libmme_la_DEPENDENCIES = \ - $(top_srcdir)/lib/s1ap/libs1ap.la \ + $(top_srcdir)/lib/asn1c/libasn1c.la \ $(top_srcdir)/lib/nas/libnas.la \ $(top_srcdir)/lib/fd/libfd.la \ $(top_srcdir)/lib/gtp/libgtp.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) libmme_la_LIBADD = \ - $(top_srcdir)/lib/s1ap/libs1ap.la \ + $(top_srcdir)/lib/asn1c/libasn1c.la \ $(top_srcdir)/lib/nas/libnas.la \ $(top_srcdir)/lib/fd/libfd.la \ $(top_srcdir)/lib/gtp/libgtp.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ - -I$(top_srcdir)/lib/s1ap/asn1c \ + -I$(top_srcdir)/lib/asn1c/common \ + -I$(top_srcdir)/lib/asn1c/s1ap \ -I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \ @MONGOC_CFLAGS@ \ $(NULL) @@ -58,6 +59,3 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/src/mme/emm_build.c b/src/mme/emm_build.c index 8ed634f33..b1c026c96 100644 --- a/src/mme/emm_build.c +++ b/src/mme/emm_build.c @@ -1,17 +1,16 @@ -#define TRACE_MODULE _emm_build - -#include "core_debug.h" - #include "nas/nas_message.h" #include "nas_security.h" #include "mme_kdf.h" #include "emm_build.h" -status_t emm_build_attach_accept( - pkbuf_t **emmbuf, mme_ue_t *mme_ue, pkbuf_t *esmbuf) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __emm_log_domain + +int emm_build_attach_accept( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue, ogs_pkbuf_t *esmbuf) { - status_t rv; + int rv; nas_message_t message; nas_attach_accept_t *attach_accept = &message.emm.attach_accept; nas_eps_attach_result_t *eps_attach_result = @@ -22,10 +21,10 @@ status_t emm_build_attach_accept( nas_eps_network_feature_support_t *eps_network_feature_support = &attach_accept->eps_network_feature_support; - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(esmbuf, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(esmbuf); - d_trace(3, "[EMM] Attach accept\n"); + ogs_debug("[EMM] Attach accept"); memset(&message, 0, sizeof(message)); message.h.security_header_type = @@ -40,23 +39,24 @@ status_t emm_build_attach_accept( t3412_value->unit = NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; t3412_value->value = 9; - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - mme_ue->tai.plmn_id, mme_ue->tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - mme_ue->e_cgi.plmn_id, mme_ue->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), + mme_ue->tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), + mme_ue->e_cgi.cell_id); served_tai_index = mme_find_served_tai(&mme_ue->tai); - d_trace(5, " SERVED_TAI_INDEX[%d]\n", served_tai_index); - d_assert(served_tai_index >= 0 && - served_tai_index < MAX_NUM_OF_SERVED_TAI, return CORE_ERROR, - "Cannot find Served TAI. Check 'mme.tai' configuration"); + ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); + ogs_assert(served_tai_index >= 0 && + served_tai_index < MAX_NUM_OF_SERVED_TAI); nas_tai_list_build(&attach_accept->tai_list, &mme_self()->served_tai[served_tai_index].list0, &mme_self()->served_tai[served_tai_index].list2); - attach_accept->esm_message_container.buffer = esmbuf->payload; + attach_accept->esm_message_container.buffer = esmbuf->data; attach_accept->esm_message_container.length = esmbuf->len; - d_trace(5, " %s GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]\n", + ogs_debug(" %s GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]", mme_ue->guti_present ? "[V]" : "[N]", mme_ue->guti.mme_gid, mme_ue->guti.mme_code, mme_ue->guti.m_tmsi, mme_ue->imsi_bcd); @@ -66,7 +66,8 @@ status_t emm_build_attach_accept( guti->length = sizeof(nas_eps_mobile_identity_guti_t); guti->guti.odd_even = NAS_EPS_MOBILE_IDENTITY_EVEN; guti->guti.type = NAS_EPS_MOBILE_IDENTITY_GUTI; - memcpy(&guti->guti.plmn_id, &mme_ue->guti.plmn_id, PLMN_ID_LEN); + nas_from_plmn_id(&guti->guti.plmn_id, + (plmn_id_t*)&mme_ue->guti.plmn_id); guti->guti.mme_gid = mme_ue->guti.mme_gid; guti->guti.mme_code = mme_ue->guti.mme_code; guti->guti.m_tmsi = mme_ue->guti.m_tmsi; @@ -90,16 +91,16 @@ status_t emm_build_attach_accept( eps_network_feature_support->ims_vops = 1; rv = nas_security_encode(emmbuf, mme_ue, &message); - d_assert(rv == CORE_OK && *emmbuf,, "nas_security_encode error"); - pkbuf_free(esmbuf); + ogs_assert(rv == OGS_OK && *emmbuf); + ogs_pkbuf_free(esmbuf); - return CORE_OK; + return OGS_OK; } -status_t emm_build_attach_reject( - pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, pkbuf_t *esmbuf) +int emm_build_attach_reject( + ogs_pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, ogs_pkbuf_t *esmbuf) { - status_t rv; + int rv; nas_message_t message; nas_attach_reject_t *attach_reject = &message.emm.attach_reject; @@ -113,55 +114,55 @@ status_t emm_build_attach_reject( { attach_reject->presencemask |= NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT; - attach_reject->esm_message_container.buffer = esmbuf->payload; + attach_reject->esm_message_container.buffer = esmbuf->data; attach_reject->esm_message_container.length = esmbuf->len; } rv = nas_plain_encode(emmbuf, &message); - d_assert(rv == CORE_OK && *emmbuf,, "nas_plain_encode error"); + ogs_assert(rv == OGS_OK && *emmbuf); if (esmbuf) { - pkbuf_free(esmbuf); + ogs_pkbuf_free(esmbuf); } return rv; } -status_t emm_build_identity_request( - pkbuf_t **emmbuf, mme_ue_t *mme_ue) +int emm_build_identity_request( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue) { - status_t rv; + int rv; nas_message_t message; nas_identity_request_t *identity_request = &message.emm.identity_request; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; message.emm.h.message_type = NAS_IDENTITY_REQUEST; /* Request IMSI */ - d_trace(3, "[EMM] Identity request\n"); - d_trace(5, " Identity Type 2 : IMSI\n"); + ogs_debug("[EMM] Identity request"); + ogs_debug(" Identity Type 2 : IMSI"); identity_request->identity_type.type = NAS_IDENTITY_TYPE_2_IMSI; rv = nas_plain_encode(emmbuf, &message); - d_assert(rv == CORE_OK && *emmbuf,, "nas_plain_encode error"); + ogs_assert(rv == OGS_OK && *emmbuf); return rv; } -status_t emm_build_authentication_request( - pkbuf_t **emmbuf, e_utran_vector_t *e_utran_vector) +int emm_build_authentication_request( + ogs_pkbuf_t **emmbuf, e_utran_vector_t *e_utran_vector) { - status_t rv; + int rv; nas_message_t message; nas_authentication_request_t *authentication_request = &message.emm.authentication_request; - d_assert(e_utran_vector, return CORE_ERROR, "Null param"); + ogs_assert(e_utran_vector); memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; @@ -175,14 +176,14 @@ status_t emm_build_authentication_request( AUTN_LEN; rv = nas_plain_encode(emmbuf, &message); - d_assert(rv == CORE_OK && *emmbuf, , "nas encode error"); + ogs_assert(rv == OGS_OK && *emmbuf); return rv; } -status_t emm_build_authentication_reject(pkbuf_t **emmbuf) +int emm_build_authentication_reject(ogs_pkbuf_t **emmbuf) { - status_t rv; + int rv; nas_message_t message; memset(&message, 0, sizeof(message)); @@ -191,15 +192,15 @@ status_t emm_build_authentication_reject(pkbuf_t **emmbuf) message.emm.h.message_type = NAS_AUTHENTICATION_REJECT; rv = nas_plain_encode(emmbuf, &message); - d_assert(rv == CORE_OK && *emmbuf,, "nas_plain_encode error"); + ogs_assert(rv == OGS_OK && *emmbuf); return rv; } -status_t emm_build_security_mode_command( - pkbuf_t **emmbuf, mme_ue_t *mme_ue) +int emm_build_security_mode_command( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue) { - status_t rv; + int rv; int i; nas_message_t message; @@ -212,10 +213,10 @@ status_t emm_build_security_mode_command( nas_ue_security_capability_t *replayed_ue_security_capabilities = &security_mode_command->replayed_ue_security_capabilities; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[EMM] Security mode command\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Security mode command"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); memset(&message, 0, sizeof(message)); message.h.security_header_type = @@ -278,59 +279,61 @@ status_t emm_build_security_mode_command( sizeof(replayed_ue_security_capabilities->uea) + sizeof(replayed_ue_security_capabilities->uia) + sizeof(replayed_ue_security_capabilities->gea); - d_trace(5, " UE[LEN:%d EEA:0x%x EIA:0x%x UEA:0x%x UIA:0x%x GEA:0x%x]\n", + ogs_debug(" Replayed UE SEC[LEN:%d EEA:0x%x EIA:0x%x UEA:0x%x UIA:0x%x GEA:0x%x]", replayed_ue_security_capabilities->length, replayed_ue_security_capabilities->eea, replayed_ue_security_capabilities->eia, replayed_ue_security_capabilities->uea, replayed_ue_security_capabilities->uia, replayed_ue_security_capabilities->gea); - d_trace(5, " Selected[Integrity:0x%x Encrypt:0x%x]\n", + ogs_debug(" Selected[Integrity:0x%x Encrypt:0x%x]", mme_ue->selected_int_algorithm, mme_ue->selected_enc_algorithm); if (mme_ue->selected_int_algorithm == NAS_SECURITY_ALGORITHMS_EIA0) { - d_fatal("Encrypt[0x%x] CAN BE skipped, " - "but Integrity[0x%x] CANNOT BE skipped", + ogs_fatal("Encrypt[0x%x] can be skipped with EEA0, " + "but Integrity[0x%x] cannot be bypassed with EIA0", mme_ue->selected_enc_algorithm, mme_ue->selected_int_algorithm); - return CORE_ERROR; + ogs_assert_if_reached(); + return OGS_ERROR; } + mme_kdf_nas(MME_KDF_NAS_INT_ALG, mme_ue->selected_int_algorithm, mme_ue->kasme, mme_ue->knas_int); mme_kdf_nas(MME_KDF_NAS_ENC_ALG, mme_ue->selected_enc_algorithm, mme_ue->kasme, mme_ue->knas_enc); rv = nas_security_encode(emmbuf, mme_ue, &message); - d_assert(rv == CORE_OK && *emmbuf, return CORE_ERROR, "emm build error"); + ogs_assert(rv == OGS_OK && *emmbuf); - return CORE_OK; + return OGS_OK; } -status_t emm_build_detach_accept(pkbuf_t **emmbuf, mme_ue_t *mme_ue) +int emm_build_detach_accept(ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue) { - status_t rv; + int rv; nas_message_t message; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&message, 0, sizeof(message)); message.h.security_header_type = NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; message.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; - d_trace(3, "[EMM] Detach accept\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Detach accept"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; message.emm.h.message_type = NAS_DETACH_ACCEPT; rv = nas_security_encode(emmbuf, mme_ue, &message); - d_assert(rv == CORE_OK && emmbuf, return CORE_ERROR, "emm build error"); + ogs_assert(rv == OGS_OK && emmbuf); - return CORE_OK; + return OGS_OK; } -status_t emm_build_tau_accept(pkbuf_t **emmbuf, mme_ue_t *mme_ue) +int emm_build_tau_accept(ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue) { nas_message_t message; nas_tracking_area_update_accept_t *tau_accept = @@ -339,7 +342,7 @@ status_t emm_build_tau_accept(pkbuf_t **emmbuf, mme_ue_t *mme_ue) mme_sess_t *sess = NULL; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); memset(&message, 0, sizeof(message)); message.h.security_header_type = @@ -361,15 +364,16 @@ status_t emm_build_tau_accept(pkbuf_t **emmbuf, mme_ue_t *mme_ue) tau_accept->presencemask |= NAS_TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT; - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - mme_ue->tai.plmn_id, mme_ue->tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - mme_ue->e_cgi.plmn_id, mme_ue->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), + mme_ue->tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), + mme_ue->e_cgi.cell_id); served_tai_index = mme_find_served_tai(&mme_ue->tai); - d_trace(5, " SERVED_TAI_INDEX[%d]\n", served_tai_index); - d_assert(served_tai_index >= 0 && - served_tai_index < MAX_NUM_OF_SERVED_TAI, return CORE_ERROR, - "Cannot find Served TAI. Check 'mme.tai' configuration"); + ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); + ogs_assert(served_tai_index >= 0 && + served_tai_index < MAX_NUM_OF_SERVED_TAI); nas_tai_list_build(&tau_accept->tai_list, &mme_self()->served_tai[served_tai_index].list0, &mme_self()->served_tai[served_tai_index].list2); @@ -425,23 +429,23 @@ status_t emm_build_tau_accept(pkbuf_t **emmbuf, mme_ue_t *mme_ue) tau_accept->eps_network_feature_support.length = 1; tau_accept->eps_network_feature_support.ims_vops = 1; - d_assert(nas_security_encode(emmbuf, mme_ue, &message) == CORE_OK && - *emmbuf,,); + ogs_assert(nas_security_encode(emmbuf, mme_ue, &message) == OGS_OK && + *emmbuf); - return CORE_OK; + return OGS_OK; } -status_t emm_build_tau_reject(pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, +int emm_build_tau_reject(ogs_pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, mme_ue_t *mme_ue) { nas_message_t message; nas_tracking_area_update_reject_t *tau_reject = &message.emm.tracking_area_update_reject; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); - d_trace(3, "[EMM] Tracking area update reject\n"); - d_trace(5, " IMSI[%s] Cause[%d]\n", + ogs_debug("[EMM] Tracking area update reject"); + ogs_debug(" IMSI[%s] Cause[%d]", MME_UE_HAVE_IMSI(mme_ue) ? mme_ue->imsi_bcd : "Unknown", emm_cause); memset(&message, 0, sizeof(message)); @@ -450,21 +454,21 @@ status_t emm_build_tau_reject(pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, tau_reject->emm_cause = emm_cause; - d_assert(nas_plain_encode(emmbuf, &message) == CORE_OK && *emmbuf,,); + ogs_assert(nas_plain_encode(emmbuf, &message) == OGS_OK && *emmbuf); - return CORE_OK; + return OGS_OK; } -status_t emm_build_service_reject(pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, +int emm_build_service_reject(ogs_pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, mme_ue_t *mme_ue) { nas_message_t message; nas_service_reject_t *service_reject = &message.emm.service_reject; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[EMM] Service reject\n"); - d_trace(5, " Cause[%d]\n", emm_cause); + ogs_debug("[EMM] Service reject"); + ogs_debug(" Cause[%d]", emm_cause); memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; @@ -472,7 +476,7 @@ status_t emm_build_service_reject(pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, service_reject->emm_cause = emm_cause; - d_assert(nas_plain_encode(emmbuf, &message) == CORE_OK && *emmbuf,,); + ogs_assert(nas_plain_encode(emmbuf, &message) == OGS_OK && *emmbuf); - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/emm_build.h b/src/mme/emm_build.h index dfcc1b069..18e06549c 100644 --- a/src/mme/emm_build.h +++ b/src/mme/emm_build.h @@ -7,28 +7,28 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) emm_build_attach_accept( - pkbuf_t **emmbuf, mme_ue_t *mme_ue, pkbuf_t *esmbuf); -CORE_DECLARE(status_t) emm_build_attach_reject( - pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, pkbuf_t *esmbuf); +int emm_build_attach_accept( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue, ogs_pkbuf_t *esmbuf); +int emm_build_attach_reject( + ogs_pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, ogs_pkbuf_t *esmbuf); -CORE_DECLARE(status_t) emm_build_identity_request( - pkbuf_t **emmbuf, mme_ue_t *mme_ue); -CORE_DECLARE(status_t) emm_build_security_mode_command( - pkbuf_t **emmbuf, mme_ue_t *mme_ue); +int emm_build_identity_request( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue); +int emm_build_security_mode_command( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue); -CORE_DECLARE(status_t) emm_build_authentication_request( - pkbuf_t **emmbuf, e_utran_vector_t *e_utran_vector); -CORE_DECLARE(status_t) emm_build_authentication_reject(pkbuf_t **emmbuf); +int emm_build_authentication_request( + ogs_pkbuf_t **emmbuf, e_utran_vector_t *e_utran_vector); +int emm_build_authentication_reject(ogs_pkbuf_t **emmbuf); -CORE_DECLARE(status_t) emm_build_detach_accept( - pkbuf_t **emmbuf, mme_ue_t *mme_ue); +int emm_build_detach_accept( + ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue); -CORE_DECLARE(status_t) emm_build_tau_accept(pkbuf_t **emmbuf, mme_ue_t *mme_ue); -CORE_DECLARE(status_t) emm_build_tau_reject(pkbuf_t **emmbuf, +int emm_build_tau_accept(ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue); +int emm_build_tau_reject(ogs_pkbuf_t **emmbuf, nas_emm_cause_t emm_cause,mme_ue_t *mme_ue); -CORE_DECLARE(status_t) emm_build_service_reject(pkbuf_t **emmbuf, +int emm_build_service_reject(ogs_pkbuf_t **emmbuf, nas_emm_cause_t emm_cause, mme_ue_t *mme_ue); #ifdef __cplusplus diff --git a/src/mme/emm_handler.c b/src/mme/emm_handler.c index 9902b644a..5b114aebb 100644 --- a/src/mme/emm_handler.c +++ b/src/mme/emm_handler.c @@ -1,8 +1,3 @@ -#define TRACE_MODULE _emm_handler - -#include "core_debug.h" -#include "core_lib.h" - #include "nas/nas_message.h" #include "mme_event.h" @@ -18,7 +13,10 @@ #include "emm_handler.h" -status_t emm_handle_attach_request( +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __emm_log_domain + +int emm_handle_attach_request( mme_ue_t *mme_ue, nas_attach_request_t *attach_request) { int served_tai_index = 0; @@ -31,19 +29,19 @@ status_t emm_handle_attach_request( nas_esm_message_container_t *esm_message_container = &attach_request->esm_message_container; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); - d_assert(esm_message_container, return CORE_ERROR, "Null param"); - d_assert(esm_message_container->length, return CORE_ERROR, "Null param"); + ogs_assert(esm_message_container); + ogs_assert(esm_message_container->length); /* Set EPS Attach Type */ memcpy(&mme_ue->nas_eps.attach, eps_attach_type, sizeof(nas_eps_attach_type_t)); mme_ue->nas_eps.type = MME_EPS_TYPE_ATTACH_REQUEST; mme_ue->nas_eps.ksi = eps_attach_type->nas_key_set_identifier; - d_trace(5, " NAS_EPS TYPE[%d] KSI[%d] ATTACH[0x%x]\n", + ogs_debug(" NAS_EPS TYPE[%d] KSI[%d] ATTACH[0x%x]", mme_ue->nas_eps.type, mme_ue->nas_eps.ksi, mme_ue->nas_eps.data); /* * ATTACH_REQUEST @@ -67,14 +65,15 @@ status_t emm_handle_attach_request( mme_ue->nhcc = 1; } - d_trace(5, " OLD TAI[PLMN_ID:0x%x,TAC:%d]\n", - mme_ue->tai.plmn_id, mme_ue->tai.tac); - d_trace(5, " OLD E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - mme_ue->e_cgi.plmn_id, mme_ue->e_cgi.cell_id); - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - enb_ue->nas.tai.plmn_id, enb_ue->nas.tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - enb_ue->nas.e_cgi.plmn_id, enb_ue->nas.e_cgi.cell_id); + ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); + ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&enb_ue->nas.tai.plmn_id), enb_ue->nas.tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&enb_ue->nas.e_cgi.plmn_id), + enb_ue->nas.e_cgi.cell_id); /* Copy TAI and ECGI from enb_ue */ memcpy(&mme_ue->tai, &enb_ue->nas.tai, sizeof(tai_t)); @@ -85,14 +84,14 @@ status_t emm_handle_attach_request( if (served_tai_index < 0) { /* Send Attach Reject */ - d_warn("Cannot find Served TAI[PLMN_ID:0x%x,TAC:%d]", - mme_ue->tai.plmn_id, mme_ue->tai.tac); + ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); nas_send_attach_reject(mme_ue, EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED, ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED); - return CORE_ERROR; + return OGS_ERROR; } - d_trace(5, " SERVED_TAI_INDEX[%d]\n", served_tai_index); + ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); /* Store UE specific information */ if (attach_request->presencemask & @@ -100,8 +99,11 @@ status_t emm_handle_attach_request( { nas_tracking_area_identity_t *last_visited_registered_tai = &attach_request->last_visited_registered_tai; + nas_to_plmn_id( &mme_ue->visited_plmn_id, &last_visited_registered_tai->plmn_id); + ogs_debug(" Visited_PLMN_ID:%06x", + plmn_id_hexdump(&mme_ue->visited_plmn_id)); } else { @@ -124,14 +126,14 @@ status_t emm_handle_attach_request( { case NAS_EPS_MOBILE_IDENTITY_IMSI: { - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; nas_imsi_to_bcd( &eps_mobile_identity->imsi, eps_mobile_identity->length, imsi_bcd); mme_ue_set_imsi(mme_ue, imsi_bcd); - d_trace(5, " IMSI[%s]\n", imsi_bcd); + ogs_debug(" IMSI[%s]", imsi_bcd); break; } @@ -146,7 +148,7 @@ status_t emm_handle_attach_request( guti.mme_code = nas_guti->mme_code; guti.m_tmsi = nas_guti->m_tmsi; - d_trace(5, " GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]\n", + ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]", guti.mme_gid, guti.mme_code, guti.m_tmsi, @@ -156,21 +158,21 @@ status_t emm_handle_attach_request( } default: { - d_warn("Not implemented[%d]", eps_mobile_identity->imsi.type); + ogs_warn("Not implemented[%d]", eps_mobile_identity->imsi.type); break; } } NAS_STORE_DATA(&mme_ue->pdn_connectivity_request, esm_message_container); - return CORE_OK; + return OGS_OK; } -status_t emm_handle_attach_complete( +int emm_handle_attach_complete( mme_ue_t *mme_ue, nas_attach_complete_t *attach_complete) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; nas_message_t message; nas_emm_information_t *emm_information = &message.emm.emm_information; @@ -179,26 +181,26 @@ status_t emm_handle_attach_complete( nas_daylight_saving_time_t *network_daylight_saving_time = &emm_information->network_daylight_saving_time; - time_exp_t xt_gmt, xt_local; + struct timeval tv; + struct tm gmt, local; - rv = time_exp_gmt(&xt_gmt, time_now()); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = time_exp_lt(&xt_local, time_now()); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_gettimeofday(&tv); + ogs_gmtime(tv.tv_sec, &gmt); + ogs_localtime(tv.tv_sec, &local); - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(5, " GMT Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d\n", - xt_gmt.tm_year, xt_gmt.tm_mon, xt_gmt.tm_mday, - xt_gmt.tm_hour, xt_gmt.tm_min, xt_gmt.tm_sec, - xt_gmt.tm_gmtoff); - d_trace(5, " LOCAL Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d\n", - xt_local.tm_year, xt_local.tm_mon, xt_local.tm_mday, - xt_local.tm_hour, xt_local.tm_min, xt_local.tm_sec, - xt_local.tm_gmtoff); + ogs_debug(" GMT Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d", + gmt.tm_year, gmt.tm_mon, gmt.tm_mday, + gmt.tm_hour, gmt.tm_min, gmt.tm_sec, + (int)gmt.tm_gmtoff); + ogs_debug(" LOCAL Time[Y:M:D H:M:S GMT] - %d:%d:%d, %d:%d:%d, %d", + local.tm_year, local.tm_mon, local.tm_mday, + local.tm_hour, local.tm_min, local.tm_sec, + (int)local.tm_gmtoff); rv = nas_send_emm_to_esm(mme_ue, &attach_complete->esm_message_container); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas_send_emm_to_esm failed"); + ogs_assert(rv == OGS_OK); memset(&message, 0, sizeof(message)); message.h.security_header_type = @@ -211,26 +213,28 @@ status_t emm_handle_attach_complete( emm_information->presencemask |= NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT; universal_time_and_local_time_zone->year = - NAS_TIME_TO_BCD(xt_gmt.tm_year % 100); + NAS_TIME_TO_BCD(gmt.tm_year % 100); universal_time_and_local_time_zone->mon = - NAS_TIME_TO_BCD(xt_gmt.tm_mon+1); + NAS_TIME_TO_BCD(gmt.tm_mon+1); universal_time_and_local_time_zone->mday = - NAS_TIME_TO_BCD(xt_gmt.tm_mday); + NAS_TIME_TO_BCD(gmt.tm_mday); universal_time_and_local_time_zone->hour = - NAS_TIME_TO_BCD(xt_gmt.tm_hour); - universal_time_and_local_time_zone->min = NAS_TIME_TO_BCD(xt_gmt.tm_min); - universal_time_and_local_time_zone->sec = NAS_TIME_TO_BCD(xt_gmt.tm_sec); - if (xt_local.tm_gmtoff >= 0) + NAS_TIME_TO_BCD(gmt.tm_hour); + universal_time_and_local_time_zone->min = NAS_TIME_TO_BCD(gmt.tm_min); + universal_time_and_local_time_zone->sec = NAS_TIME_TO_BCD(gmt.tm_sec); + if (local.tm_gmtoff >= 0) { universal_time_and_local_time_zone->timezone = - NAS_TIME_TO_BCD(xt_local.tm_gmtoff / 900); + NAS_TIME_TO_BCD(local.tm_gmtoff / 900); } else { universal_time_and_local_time_zone->timezone = - NAS_TIME_TO_BCD((-xt_local.tm_gmtoff) / 900); + NAS_TIME_TO_BCD((-local.tm_gmtoff) / 900); universal_time_and_local_time_zone->timezone |= 0x08; } + ogs_debug(" Timezone:0x%x", + universal_time_and_local_time_zone->timezone); emm_information->presencemask |= NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT; @@ -253,55 +257,54 @@ status_t emm_handle_attach_complete( } rv = nas_security_encode(&emmbuf, mme_ue, &message); - d_assert(rv == CORE_OK && emmbuf, return CORE_ERROR, "emm build error"); - d_assert(nas_send_to_downlink_nas_transport(mme_ue, emmbuf) == CORE_OK,,); + ogs_assert(rv == OGS_OK && emmbuf); + ogs_assert(nas_send_to_downlink_nas_transport(mme_ue, emmbuf) == OGS_OK); - d_trace(3, "[EMM] EMM information\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] EMM information"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); - return CORE_OK; + return OGS_OK; } -status_t emm_handle_identity_response( +int emm_handle_identity_response( mme_ue_t *mme_ue, nas_identity_response_t *identity_response) { nas_mobile_identity_t *mobile_identity = NULL; enb_ue_t *enb_ue = NULL; - d_assert(identity_response, return CORE_ERROR, "Null param"); + ogs_assert(identity_response); - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); mobile_identity = &identity_response->mobile_identity; if (mobile_identity->imsi.type == NAS_IDENTITY_TYPE_2_IMSI) { - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; nas_imsi_to_bcd( &mobile_identity->imsi, mobile_identity->length, imsi_bcd); mme_ue_set_imsi(mme_ue, imsi_bcd); - d_assert(mme_ue->imsi_len, return CORE_ERROR, - "Can't get IMSI : [LEN:%d]\n", mme_ue->imsi_len); + ogs_assert(mme_ue->imsi_len); } else { - d_warn("Not supported Identity type[%d]", mobile_identity->imsi.type); + ogs_warn("Not supported Identity type[%d]", mobile_identity->imsi.type); } - return CORE_OK; + return OGS_OK; } -status_t emm_handle_detach_request( +int emm_handle_detach_request( mme_ue_t *mme_ue, nas_detach_request_from_ue_t *detach_request) { nas_detach_type_t *detach_type = NULL; - d_assert(detach_request, return CORE_ERROR, "Null param"); - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(detach_request); + ogs_assert(mme_ue); detach_type = &detach_request->detach_type; @@ -309,48 +312,48 @@ status_t emm_handle_detach_request( memcpy(&mme_ue->nas_eps.detach, detach_type, sizeof(nas_detach_type_t)); mme_ue->nas_eps.type = MME_EPS_TYPE_DETACH_REQUEST_FROM_UE; mme_ue->nas_eps.ksi = detach_type->nas_key_set_identifier; - d_trace(5, " NAS_EPS TYPE[%d] KSI[%d] DETACH[0x%x]\n", + ogs_debug(" NAS_EPS TYPE[%d] KSI[%d] DETACH[0x%x]", mme_ue->nas_eps.type, mme_ue->nas_eps.ksi, mme_ue->nas_eps.data); switch (detach_request->detach_type.detach_type) { /* 0 0 1 : EPS detach */ case NAS_DETACH_TYPE_FROM_UE_EPS_DETACH: - d_trace(5, " EPS Detach\n"); + ogs_debug(" EPS Detach"); break; /* 0 1 0 : IMSI detach */ case NAS_DETACH_TYPE_FROM_UE_IMSI_DETACH: - d_trace(5, " IMSI Detach\n"); + ogs_debug(" IMSI Detach"); break; case 6: /* 1 1 0 : reserved */ case 7: /* 1 1 1 : reserved */ - d_warn("Unknown Detach type[%d]", + ogs_warn("Unknown Detach type[%d]", detach_request->detach_type.detach_type); break; /* 0 1 1 : combined EPS/IMSI detach */ case NAS_DETACH_TYPE_FROM_UE_COMBINED_EPS_IMSI_DETACH: - d_trace(5, " Combined EPS/IMSI Detach\n"); + ogs_debug(" Combined EPS/IMSI Detach"); default: /* all other values */ break; } if (detach_request->detach_type.switch_off) - d_trace(5, " Switch-Off\n"); + ogs_debug(" Switch-Off"); - return CORE_OK; + return OGS_OK; } -status_t emm_handle_service_request( +int emm_handle_service_request( mme_ue_t *mme_ue, nas_service_request_t *service_request) { nas_ksi_and_sequence_number_t *ksi_and_sequence_number = &service_request->ksi_and_sequence_number; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); /* Set EPS Update Type */ mme_ue->nas_eps.type = MME_EPS_TYPE_SERVICE_REQUEST; mme_ue->nas_eps.ksi = ksi_and_sequence_number->ksi; - d_trace(5, " NAS_EPS TYPE[%d] KSI[%d]\n", + ogs_debug(" NAS_EPS TYPE[%d] KSI[%d]", mme_ue->nas_eps.type, mme_ue->nas_eps.ksi); /* @@ -374,16 +377,16 @@ status_t emm_handle_service_request( mme_ue->nhcc = 1; } - d_trace(5, " GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]\n", + ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]", mme_ue->guti.mme_gid, mme_ue->guti.mme_code, mme_ue->guti.m_tmsi, MME_UE_HAVE_IMSI(mme_ue) ? mme_ue->imsi_bcd : "Unknown"); - return CORE_OK; + return OGS_OK; } -status_t emm_handle_tau_request( +int emm_handle_tau_request( mme_ue_t *mme_ue, nas_tracking_area_update_request_t *tau_request) { int served_tai_index = 0; @@ -394,16 +397,16 @@ status_t emm_handle_tau_request( &tau_request->old_guti; enb_ue_t *enb_ue = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); /* Set EPS Update Type */ memcpy(&mme_ue->nas_eps.update, eps_update_type, sizeof(nas_eps_update_type_t)); mme_ue->nas_eps.type = MME_EPS_TYPE_TAU_REQUEST; mme_ue->nas_eps.ksi = eps_update_type->nas_key_set_identifier; - d_trace(5, " NAS_EPS TYPE[%d] KSI[%d] UPDATE[0x%x]\n", + ogs_debug(" NAS_EPS TYPE[%d] KSI[%d] UPDATE[0x%x]", mme_ue->nas_eps.type, mme_ue->nas_eps.ksi, mme_ue->nas_eps.data); @@ -423,23 +426,24 @@ status_t emm_handle_tau_request( CLEAR_PAGING_INFO(mme_ue); if (BEARER_CONTEXT_IS_ACTIVE(mme_ue)) - d_trace(5, " Bearer-Active\n"); + ogs_debug(" Bearer-Active"); else - d_trace(5, " Bearer-Inactive\n"); + ogs_debug(" Bearer-Inactive"); if (mme_ue->nas_eps.update.active_flag) - d_trace(5, " Active flag\n"); + ogs_debug(" Active flag"); else - d_trace(5, " No Active flag\n"); + ogs_debug(" No Active flag"); - d_trace(5, " OLD TAI[PLMN_ID:0x%x,TAC:%d]\n", - mme_ue->tai.plmn_id, mme_ue->tai.tac); - d_trace(5, " OLD E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - mme_ue->e_cgi.plmn_id, mme_ue->e_cgi.cell_id); - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - enb_ue->nas.tai.plmn_id, enb_ue->nas.tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - enb_ue->nas.e_cgi.plmn_id, enb_ue->nas.e_cgi.cell_id); + ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); + ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&enb_ue->nas.tai.plmn_id), enb_ue->nas.tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&enb_ue->nas.e_cgi.plmn_id), + enb_ue->nas.e_cgi.cell_id); /* Copy TAI and ECGI from enb_ue */ memcpy(&mme_ue->tai, &enb_ue->nas.tai, sizeof(tai_t)); @@ -450,12 +454,12 @@ status_t emm_handle_tau_request( if (served_tai_index < 0) { /* Send TAU reject */ - d_warn("Cannot find Served TAI[PLMN_ID:0x%x,TAC:%d]", - mme_ue->tai.plmn_id, mme_ue->tai.tac); + ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); nas_send_tau_reject(mme_ue, EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED); - return CORE_ERROR; + return OGS_ERROR; } - d_trace(5, " SERVED_TAI_INDEX[%d]\n", served_tai_index); + ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); /* Store UE specific information */ if (tau_request->presencemask & @@ -463,8 +467,11 @@ status_t emm_handle_tau_request( { nas_tracking_area_identity_t *last_visited_registered_tai = &tau_request->last_visited_registered_tai; + nas_to_plmn_id( &mme_ue->visited_plmn_id, &last_visited_registered_tai->plmn_id); + ogs_debug(" Visited_PLMN_ID:%06x", + plmn_id_hexdump(&mme_ue->visited_plmn_id)); } else { @@ -504,7 +511,7 @@ status_t emm_handle_tau_request( guti.mme_code = nas_guti->mme_code; guti.m_tmsi = nas_guti->m_tmsi; - d_trace(5, " GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]\n", + ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]", guti.mme_gid, guti.mme_code, guti.m_tmsi, @@ -514,12 +521,12 @@ status_t emm_handle_tau_request( } default: { - d_warn("Not implemented[%d]", + ogs_warn("Not implemented[%d]", eps_mobile_identity->imsi.type); - return CORE_OK; + return OGS_OK; } } - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/emm_handler.h b/src/mme/emm_handler.h index 37fd1a241..c0fa36cfc 100644 --- a/src/mme/emm_handler.h +++ b/src/mme/emm_handler.h @@ -9,21 +9,21 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) emm_handle_attach_request( +int emm_handle_attach_request( mme_ue_t *mme_ue, nas_attach_request_t *attach_request); -CORE_DECLARE(status_t) emm_handle_attach_complete( +int emm_handle_attach_complete( mme_ue_t *mme_ue, nas_attach_complete_t *attach_complete); -CORE_DECLARE(status_t) emm_handle_identity_response( +int emm_handle_identity_response( mme_ue_t *mme_ue, nas_identity_response_t *identity_response); -CORE_DECLARE(status_t) emm_handle_detach_request( +int emm_handle_detach_request( mme_ue_t *mme_ue, nas_detach_request_from_ue_t *detach_request); -CORE_DECLARE(status_t) emm_handle_service_request( +int emm_handle_service_request( mme_ue_t *mme_ue, nas_service_request_t *service_request); -CORE_DECLARE(status_t) emm_handle_tau_request( +int emm_handle_tau_request( mme_ue_t *mme_ue, nas_tracking_area_update_request_t *tau_request); #ifdef __cplusplus diff --git a/src/mme/emm_sm.c b/src/mme/emm_sm.c index fa0cf5956..6ce1d6d2f 100644 --- a/src/mme/emm_sm.c +++ b/src/mme/emm_sm.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _emm_sm - -#include "core_debug.h" - #include "nas/nas_message.h" #include "fd/fd_lib.h" #include "fd/s6a/s6a_message.h" @@ -19,115 +15,116 @@ #include "mme_path.h" #include "mme_sm.h" -void emm_state_initial(fsm_t *s, event_t *e) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __emm_log_domain + +void emm_state_initial(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); + ogs_assert(s); - mme_sm_trace(3, e); + mme_sm_debug(e); - FSM_TRAN(s, &emm_state_de_registered); + OGS_FSM_TRAN(s, &emm_state_de_registered); } -void emm_state_final(fsm_t *s, event_t *e) +void emm_state_final(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); + ogs_assert(s); - mme_sm_trace(3, e); + mme_sm_debug(e); } -static void common_register_state(fsm_t *s, event_t *e); +static void common_register_state(ogs_fsm_t *s, mme_event_t *e); -void emm_state_de_registered(fsm_t *s, event_t *e) +void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); common_register_state(s, e); } -void emm_state_registered(fsm_t *s, event_t *e) +void emm_state_registered(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); common_register_state(s, e); } -static void common_register_state(fsm_t *s, event_t *e) +static void common_register_state(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; + + ogs_assert(e); - mme_ue = mme_ue_find(event_get_param1(e)); - d_assert(mme_ue, return, "Null param"); + mme_ue = e->mme_ue; + ogs_assert(mme_ue); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { return; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { return; } case MME_EVT_EMM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param5(e); - d_assert(message, return, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return, "Null param"); + ogs_assert(enb_ue); if (message->emm.h.security_header_type == NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { - d_trace(3, "[EMM] Service request\n"); + ogs_debug("[EMM] Service request"); rv = emm_handle_service_request( mme_ue, &message->emm.service_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_service_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_service_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } if (!MME_UE_HAVE_IMSI(mme_ue)) { - d_warn("[EMM] Service request : Unknown UE"); + ogs_warn("[EMM] Service request : Unknown UE"); rv = nas_send_service_reject(mme_ue, EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK); - d_assert(rv == CORE_OK,, - "nas_send_service_reject() failed"); - FSM_TRAN(s, &emm_state_exception); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(s, &emm_state_exception); return; } if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) { - d_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd); + ogs_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd); rv = nas_send_service_reject(mme_ue, EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK); - d_assert(rv == CORE_OK,, - "nas_send_service_reject() failed"); + ogs_assert(rv == OGS_OK); rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_S1_NORMAL_RELEASE, 0); - d_assert(rv == CORE_OK,, - "s1ap_send_ue_context_release_command() failed"); + ogs_assert(rv == OGS_OK); return; } rv = s1ap_send_initial_context_setup_request(mme_ue); - d_assert(rv == CORE_OK, return, - "s1ap_send_initial_context_setup_request() failed"); + ogs_assert(rv == OGS_OK); return; } @@ -135,59 +132,58 @@ static void common_register_state(fsm_t *s, event_t *e) { case NAS_IDENTITY_RESPONSE: { - d_trace(3, "[EMM] Identity response\n"); + ogs_debug("[EMM] Identity response"); rv = emm_handle_identity_response(mme_ue, &message->emm.identity_response); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_identity_response() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_identity_response() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } if (!MME_UE_HAVE_IMSI(mme_ue)) { - d_error("No IMSI"); - FSM_TRAN(s, emm_state_exception); + ogs_error("No IMSI"); + OGS_FSM_TRAN(s, emm_state_exception); return; } - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); break; } case NAS_ATTACH_REQUEST: { - d_trace(3, "[EMM] Attach request\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Attach request[%s]", mme_ue->imsi_bcd); rv = emm_handle_attach_request( mme_ue, &message->emm.attach_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } break; } case NAS_TRACKING_AREA_UPDATE_REQUEST: { - d_trace(3, "[EMM] Tracking area update request\n"); + ogs_debug("[EMM] Tracking area update request"); rv = emm_handle_tau_request( mme_ue, &message->emm.tracking_area_update_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_tau_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_tau_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } if (!MME_UE_HAVE_IMSI(mme_ue)) { - d_warn("[EMM] TAU request : Unknown UE"); + ogs_warn("[EMM] TAU request : Unknown UE"); rv = nas_send_tau_reject(mme_ue, EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK); - d_assert(rv == CORE_OK,, - "nas_send_tau_reject() failed"); - FSM_TRAN(s, &emm_state_exception); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(s, &emm_state_exception); return; } @@ -195,71 +191,48 @@ static void common_register_state(fsm_t *s, event_t *e) } case NAS_TRACKING_AREA_UPDATE_COMPLETE: { - d_trace(3, "[EMM] Tracking area update complete\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Tracking area update complete"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); return; } case NAS_EMM_STATUS: { - d_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", + ogs_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", mme_ue->imsi_bcd, message->emm.emm_status.emm_cause); - FSM_TRAN(s, &emm_state_exception); + OGS_FSM_TRAN(s, &emm_state_exception); return; } case NAS_DETACH_REQUEST: { - d_trace(3, "[EMM] Detach request\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Detach request"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_handle_detach_request( mme_ue, &message->emm.detach_request_from_ue); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } rv = mme_send_delete_session_or_detach(mme_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_detach() failed"); + ogs_assert(rv == OGS_OK); - FSM_TRAN(s, &emm_state_de_registered); + OGS_FSM_TRAN(s, &emm_state_de_registered); return; } default: { - d_warn("Unknown message[%d]", message->emm.h.message_type); + ogs_warn("Unknown message[%d]", message->emm.h.message_type); return; } } break; } - case MME_EVT_EMM_T3413: - { - if (mme_ue->max_paging_retry >= MAX_NUM_OF_PAGING) - { - /* Paging failed */ - d_warn("[EMM] Paging to IMSI[%s] failed. Stop paging", - mme_ue->imsi_bcd); - if (mme_ue->last_paging_msg) - { - pkbuf_free(mme_ue->last_paging_msg); - mme_ue->last_paging_msg = NULL; - } - } - else - { - mme_ue->max_paging_retry++; - s1ap_handle_paging(mme_ue); - /* Start T3413 */ - tm_start(mme_ue->t3413); - } - return; - } default: { - d_error("Unknown event[%s]", mme_event_get_name(e)); + ogs_error("Unknown event[%s]", mme_event_get_name(e)); return; } } @@ -267,12 +240,12 @@ static void common_register_state(fsm_t *s, event_t *e) if (!MME_UE_HAVE_IMSI(mme_ue)) { rv = nas_send_identity_request(mme_ue); - d_assert(rv == CORE_OK, return, "nas_send_identity_request() failed"); + ogs_assert(rv == OGS_OK); return; } enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return, "Null param"); + ogs_assert(enb_ue); switch(mme_ue->nas_eps.type) { @@ -282,112 +255,113 @@ static void common_register_state(fsm_t *s, event_t *e) { rv = nas_send_emm_to_esm(mme_ue, &mme_ue->pdn_connectivity_request); - d_assert(rv == CORE_OK,, "nas_send_emm_to_esm() failed"); - FSM_TRAN(s, &emm_state_initial_context_setup); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(s, &emm_state_initial_context_setup); } else { if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) { rv = mme_gtp_send_delete_all_sessions(mme_ue); - d_assert(rv == CORE_OK,, - "mme_gtp_send_delete_all_sessions() failed"); + ogs_assert(rv == OGS_OK); } else { mme_s6a_send_air(mme_ue, NULL); } - FSM_TRAN(s, &emm_state_authentication); + OGS_FSM_TRAN(s, &emm_state_authentication); } break; } case MME_EPS_TYPE_TAU_REQUEST: { - S1AP_ProcedureCode_t procedureCode = - (S1AP_ProcedureCode_t)event_get_param2(e); + S1AP_ProcedureCode_t procedureCode = e->s1ap_code; if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) { - d_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd); + ogs_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd); rv = nas_send_tau_reject(mme_ue, EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK); - d_assert(rv == CORE_OK,, "nas_send_tau_reject() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(s, emm_state_exception); break; } if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) { mme_s6a_send_air(mme_ue, NULL); - FSM_TRAN(&mme_ue->sm, &emm_state_authentication); + OGS_FSM_TRAN(&mme_ue->sm, &emm_state_authentication); break; } if (procedureCode == S1AP_ProcedureCode_id_initialUEMessage) { - d_trace(5, " Iniital UE Message\n"); + ogs_debug(" Iniital UE Message"); if (mme_ue->nas_eps.update.active_flag) { rv = nas_send_tau_accept(mme_ue, S1AP_ProcedureCode_id_InitialContextSetup); - d_assert(rv == CORE_OK,, "nas_send_tau_accept() failed"); + ogs_assert(rv == OGS_OK); } else { rv = nas_send_tau_accept(mme_ue, S1AP_ProcedureCode_id_downlinkNASTransport); - d_assert(rv == CORE_OK,, "nas_send_tau_accept() failed"); + ogs_assert(rv == OGS_OK); rv = mme_send_release_access_bearer_or_ue_context_release( mme_ue, enb_ue); - d_assert(rv == CORE_OK,, "mme_send_release_access_bearer" - "_or_ue_context_release() failed"); + ogs_assert(rv == OGS_OK); } } else if (procedureCode == S1AP_ProcedureCode_id_uplinkNASTransport) { - d_trace(5, " Uplink NAS Transport\n"); + ogs_debug(" Uplink NAS Transport"); rv = nas_send_tau_accept(mme_ue, S1AP_ProcedureCode_id_downlinkNASTransport); - d_assert(rv == CORE_OK,, "nas_send_tau_accept() failed"); + ogs_assert(rv == OGS_OK); } else - d_assert(0,, "Invalid Procedure Code[%d]", procedureCode); + { + ogs_fatal("Invalid Procedure Code[%d]", (int)procedureCode); + ogs_assert_if_reached(); + } break; } default: - d_assert(0,, "Invalid NAS-EPS[%d]", mme_ue->nas_eps.type); + ogs_fatal("Invalid NAS-EPS[%d]", mme_ue->nas_eps.type); + ogs_assert_if_reached(); break; } } -void emm_state_authentication(fsm_t *s, event_t *e) +void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); + + mme_sm_debug(e); - mme_sm_trace(3, e); + mme_ue = e->mme_ue; + ogs_assert(mme_ue); - mme_ue = mme_ue_find(event_get_param1(e)); - d_assert(mme_ue, return, "Null param"); - - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_EMM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param5(e); - d_assert(message, break, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); switch(message->emm.h.message_type) { @@ -400,20 +374,25 @@ void emm_state_authentication(fsm_t *s, event_t *e) &authentication_response-> authentication_response_parameter; - d_trace(3, "[EMM] Authentication response\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Authentication response"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); if (memcmp(authentication_response_parameter->res, mme_ue->xres, authentication_response_parameter->length) != 0) { + ogs_log_hexdump(OGS_LOG_WARN, + authentication_response_parameter->res, + authentication_response_parameter->length); + ogs_log_hexdump(OGS_LOG_WARN, + mme_ue->xres, MAX_RES_LEN); rv = nas_send_authentication_reject(mme_ue); - d_assert(rv == CORE_OK,, "nas send error"); - FSM_TRAN(&mme_ue->sm, &emm_state_exception); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception); } else { - FSM_TRAN(&mme_ue->sm, &emm_state_security_mode); + OGS_FSM_TRAN(&mme_ue->sm, &emm_state_security_mode); } break; } @@ -426,84 +405,82 @@ void emm_state_authentication(fsm_t *s, event_t *e) &authentication_failure-> authentication_failure_parameter; - d_trace(3, "[EMM] Authentication failure\n"); - d_trace(5, " IMSI[%s] EMM_CAUSE[%d]\n", mme_ue->imsi_bcd, + ogs_debug("[EMM] Authentication failure"); + ogs_debug(" IMSI[%s] EMM_CAUSE[%d]", mme_ue->imsi_bcd, authentication_failure->emm_cause); switch(authentication_failure->emm_cause) { case EMM_CAUSE_MAC_FAILURE: - d_warn("Authentication failure(MAC failure)"); + ogs_warn("Authentication failure(MAC failure)"); break; case EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE: - d_error("Authentication failure" + ogs_error("Authentication failure" "(Non-EPS authentication unacceptable)"); break; case EMM_CAUSE_SYNCH_FAILURE: - d_warn("Authentication failure(Synch failure)"); + ogs_warn("Authentication failure(Synch failure)"); mme_s6a_send_air(mme_ue, authentication_failure_parameter); return; default: - d_error("Unknown EMM_CAUSE{%d] in Authentication" + ogs_error("Unknown EMM_CAUSE{%d] in Authentication" " failure", authentication_failure->emm_cause); break; } rv = nas_send_authentication_reject(mme_ue); - d_assert(rv == CORE_OK,, "nas send error"); - FSM_TRAN(&mme_ue->sm, &emm_state_exception); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception); break; } case NAS_ATTACH_REQUEST: { - d_warn("[EMM] Attach request", mme_ue->imsi_bcd); - d_trace(3, "[EMM] Attach request\n", mme_ue->imsi_bcd); + ogs_warn("[EMM] Attach request[%s]", mme_ue->imsi_bcd); rv = emm_handle_attach_request( mme_ue, &message->emm.attach_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } mme_s6a_send_air(mme_ue, NULL); - FSM_TRAN(s, &emm_state_authentication); + OGS_FSM_TRAN(s, &emm_state_authentication); break; } case NAS_EMM_STATUS: { - d_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", + ogs_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", mme_ue->imsi_bcd, message->emm.emm_status.emm_cause); - FSM_TRAN(s, &emm_state_exception); + OGS_FSM_TRAN(s, &emm_state_exception); break; } case NAS_DETACH_REQUEST: { - d_trace(3, "[EMM] Detach request\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Detach request"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_handle_detach_request( mme_ue, &message->emm.detach_request_from_ue); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } rv = mme_send_delete_session_or_detach(mme_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_detach() failed"); + ogs_assert(rv == OGS_OK); - FSM_TRAN(s, &emm_state_de_registered); + OGS_FSM_TRAN(s, &emm_state_de_registered); break; } default: { - d_warn("Unknown message[%d]", message->emm.h.message_type); + ogs_warn("Unknown message[%d]", message->emm.h.message_type); break; } } @@ -511,54 +488,54 @@ void emm_state_authentication(fsm_t *s, event_t *e) } default: { - d_error("Unknown event[%s]", mme_event_get_name(e)); + ogs_error("Unknown event[%s]", mme_event_get_name(e)); break; } } } -void emm_state_security_mode(fsm_t *s, event_t *e) +void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); - mme_ue = mme_ue_find(event_get_param1(e)); - d_assert(mme_ue, return, "Null param"); + mme_ue = e->mme_ue; + ogs_assert(mme_ue); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { - pkbuf_t *emmbuf = NULL; + ogs_pkbuf_t *emmbuf = NULL; rv = emm_build_security_mode_command(&emmbuf, mme_ue); - d_assert(rv == CORE_OK && emmbuf, break, "emm build error"); + ogs_assert(rv == OGS_OK && emmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK && emmbuf, break, "emm send error"); + ogs_assert(rv == OGS_OK && emmbuf); break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_EMM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param5(e); - d_assert(message, break, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); switch(message->emm.h.message_type) { case NAS_SECURITY_MODE_COMPLETE: { - d_trace(3, "[EMM] Security mode complete\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Security mode complete"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); /* Update Kenb */ if (SECURITY_CONTEXT_IS_VALID(mme_ue)) @@ -572,75 +549,75 @@ void emm_state_security_mode(fsm_t *s, event_t *e) mme_s6a_send_ulr(mme_ue); if (mme_ue->nas_eps.type == MME_EPS_TYPE_ATTACH_REQUEST) { - FSM_TRAN(s, &emm_state_initial_context_setup); + OGS_FSM_TRAN(s, &emm_state_initial_context_setup); } else if (mme_ue->nas_eps.type == MME_EPS_TYPE_SERVICE_REQUEST || mme_ue->nas_eps.type == MME_EPS_TYPE_TAU_REQUEST) { - FSM_TRAN(s, &emm_state_registered); + OGS_FSM_TRAN(s, &emm_state_registered); } else - d_assert(0,, "Invalid NAS_EPS[%d]", - mme_ue->nas_eps.type); + { + ogs_fatal("Invalid NAS_EPS[%d]", mme_ue->nas_eps.type); + ogs_assert_if_reached(); + } break; } case NAS_SECURITY_MODE_REJECT: { - d_warn("[EMM] Security mode reject : IMSI[%s] Cause[%d]", + ogs_warn("[EMM] Security mode reject : IMSI[%s] Cause[%d]", mme_ue->imsi_bcd, message->emm.security_mode_reject.emm_cause); - FSM_TRAN(s, &emm_state_exception); + OGS_FSM_TRAN(s, &emm_state_exception); break; } case NAS_ATTACH_REQUEST: { - d_warn("[EMM] Attach request", mme_ue->imsi_bcd); - d_trace(3, "[EMM] Attach request\n", mme_ue->imsi_bcd); + ogs_warn("[EMM] Attach request[%s]", mme_ue->imsi_bcd); rv = emm_handle_attach_request( mme_ue, &message->emm.attach_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } mme_s6a_send_air(mme_ue, NULL); - FSM_TRAN(s, &emm_state_authentication); + OGS_FSM_TRAN(s, &emm_state_authentication); break; } case NAS_EMM_STATUS: { - d_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", + ogs_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", mme_ue->imsi_bcd, message->emm.emm_status.emm_cause); - FSM_TRAN(s, &emm_state_exception); + OGS_FSM_TRAN(s, &emm_state_exception); break; } case NAS_DETACH_REQUEST: { - d_trace(3, "[EMM] Detach request\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Detach request"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_handle_detach_request( mme_ue, &message->emm.detach_request_from_ue); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } rv = mme_send_delete_session_or_detach(mme_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_detach() failed"); + ogs_assert(rv == OGS_OK); - FSM_TRAN(s, &emm_state_de_registered); + OGS_FSM_TRAN(s, &emm_state_de_registered); break; } default: { - d_warn("Unknown message[%d]", message->emm.h.message_type); + ogs_warn("Unknown message[%d]", message->emm.h.message_type); break; } } @@ -648,108 +625,105 @@ void emm_state_security_mode(fsm_t *s, event_t *e) } default: { - d_error("Unknown event[%s]", mme_event_get_name(e)); + ogs_error("Unknown event[%s]", mme_event_get_name(e)); break; } } } -void emm_state_initial_context_setup(fsm_t *s, event_t *e) +void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); - mme_ue = mme_ue_find(event_get_param1(e)); - d_assert(mme_ue, return, "Null param"); + mme_ue = e->mme_ue; + ogs_assert(mme_ue); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_EMM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param5(e); - d_assert(message, break, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); switch(message->emm.h.message_type) { case NAS_ATTACH_COMPLETE: { - d_trace(3, "[EMM] Attach complete\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Attach complete"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_handle_attach_complete( mme_ue, &message->emm.attach_complete); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_complete() failed " + ogs_error("emm_handle_attach_complete() failed " "in emm_state_initial_context_setup"); - FSM_TRAN(s, emm_state_exception); + OGS_FSM_TRAN(s, emm_state_exception); break; } - FSM_TRAN(s, &emm_state_registered); + OGS_FSM_TRAN(s, &emm_state_registered); break; } case NAS_ATTACH_REQUEST: { - d_warn("[EMM] Attach request", mme_ue->imsi_bcd); - d_trace(3, "[EMM] Attach request\n", mme_ue->imsi_bcd); + ogs_warn("[EMM] Attach request[%s]", mme_ue->imsi_bcd); rv = emm_handle_attach_request( mme_ue, &message->emm.attach_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } rv = mme_gtp_send_delete_all_sessions(mme_ue); - d_assert(rv == CORE_OK,, - "mme_gtp_send_delete_all_sessions() failed"); - FSM_TRAN(s, &emm_state_authentication); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(s, &emm_state_authentication); break; } case NAS_EMM_STATUS: { - d_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", + ogs_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]", mme_ue->imsi_bcd, message->emm.emm_status.emm_cause); - FSM_TRAN(s, &emm_state_exception); + OGS_FSM_TRAN(s, &emm_state_exception); break; } case NAS_DETACH_REQUEST: { - d_trace(3, "[EMM] Detach request\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Detach request"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_handle_detach_request( mme_ue, &message->emm.detach_request_from_ue); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("emm_handle_attach_request() failed"); - FSM_TRAN(s, emm_state_exception); + ogs_error("emm_handle_attach_request() failed"); + OGS_FSM_TRAN(s, emm_state_exception); return; } rv = mme_send_delete_session_or_detach(mme_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_detach() failed"); + ogs_assert(rv == OGS_OK); - FSM_TRAN(s, &emm_state_de_registered); + OGS_FSM_TRAN(s, &emm_state_de_registered); break; } default: { - d_warn("Unknown message[%d]", + ogs_warn("Unknown message[%d]", message->emm.h.message_type); break; } @@ -758,29 +732,30 @@ void emm_state_initial_context_setup(fsm_t *s, event_t *e) } default: { - d_error("Unknown event[%s]", mme_event_get_name(e)); + ogs_error("Unknown event[%s]", mme_event_get_name(e)); break; } } } -void emm_state_exception(fsm_t *s, event_t *e) +void emm_state_exception(ogs_fsm_t *s, mme_event_t *e) { - mme_sm_trace(3, e); + ogs_assert(e); + mme_sm_debug(e); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } default: { - d_error("Unknown event[%s]", mme_event_get_name(e)); + ogs_error("Unknown event[%s]", mme_event_get_name(e)); break; } } diff --git a/src/mme/esm_build.c b/src/mme/esm_build.c index b51f78d23..4e55b2596 100644 --- a/src/mme/esm_build.c +++ b/src/mme/esm_build.c @@ -1,32 +1,30 @@ -#define TRACE_MODULE _esm_build - -#include "core_debug.h" -#include "core_lib.h" - #include "nas/nas_message.h" #include "nas_security.h" #include "esm_build.h" #include "mme_sm.h" -status_t esm_build_pdn_connectivity_reject( - pkbuf_t **pkbuf, mme_sess_t *sess, nas_esm_cause_t esm_cause) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __esm_log_domain + +int esm_build_pdn_connectivity_reject( + ogs_pkbuf_t **pkbuf, mme_sess_t *sess, nas_esm_cause_t esm_cause) { mme_ue_t *mme_ue = NULL; nas_message_t message; nas_pdn_connectivity_reject_t *pdn_connectivity_reject = &message.esm.pdn_connectivity_reject; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[ESM] PDN connectivity reject\n"); - d_trace(5, " IMSI[%s] PTI[%d] Cause[%d]\n", + ogs_debug("[ESM] PDN connectivity reject"); + ogs_debug(" IMSI[%s] PTI[%d] Cause[%d]", mme_ue->imsi_bcd, sess->pti, esm_cause); memset(&message, 0, sizeof(message)); - if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { message.h.security_header_type = NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; @@ -39,34 +37,33 @@ status_t esm_build_pdn_connectivity_reject( pdn_connectivity_reject->esm_cause = esm_cause; - if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { - d_assert(nas_security_encode(pkbuf, mme_ue, &message) == CORE_OK && - *pkbuf, return CORE_ERROR,); + ogs_assert(nas_security_encode(pkbuf, mme_ue, &message) == OGS_OK && + *pkbuf); } else { - d_assert(nas_plain_encode(pkbuf, &message) == CORE_OK && *pkbuf, - return CORE_ERROR,); + ogs_assert(nas_plain_encode(pkbuf, &message) == OGS_OK && *pkbuf); } - return CORE_OK; + return OGS_OK; } -status_t esm_build_information_request(pkbuf_t **pkbuf, mme_bearer_t *bearer) +int esm_build_information_request(ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer) { nas_message_t message; mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[ESM] ESM information request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] ESM information request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); memset(&message, 0, sizeof(message)); @@ -78,14 +75,14 @@ status_t esm_build_information_request(pkbuf_t **pkbuf, mme_bearer_t *bearer) message.esm.h.procedure_transaction_identity = sess->pti; message.esm.h.message_type = NAS_ESM_INFORMATION_REQUEST; - d_assert(nas_security_encode(pkbuf, mme_ue, &message) == CORE_OK && - *pkbuf, return CORE_ERROR,); + ogs_assert(nas_security_encode(pkbuf, mme_ue, &message) == OGS_OK && + *pkbuf); - return CORE_OK; + return OGS_OK; } -status_t esm_build_activate_default_bearer_context_request( - pkbuf_t **pkbuf, mme_sess_t *sess) +int esm_build_activate_default_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_sess_t *sess) { nas_message_t message; nas_activate_default_eps_bearer_context_request_t @@ -107,22 +104,21 @@ status_t esm_build_activate_default_bearer_context_request( mme_bearer_t *bearer = NULL; pdn_t *pdn = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); pdn = sess->pdn; - d_assert(pdn, return CORE_ERROR, "Null param"); + ogs_assert(pdn); bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR, "Null param"); - d_assert(mme_bearer_next(bearer) == NULL, - return CORE_ERROR, "there is dedicated bearer"); + ogs_assert(bearer); + ogs_assert(mme_bearer_next(bearer) == NULL); - d_trace(3, "[ESM] Activate default bearer context request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] Activate default bearer context request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); memset(&message, 0, sizeof(message)); - if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { message.h.security_header_type = NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED; @@ -141,22 +137,22 @@ status_t esm_build_activate_default_bearer_context_request( bearer->qos.gbr.downlink, bearer->qos.gbr.uplink); access_point_name->length = strlen(pdn->apn); - core_cpystrn(access_point_name->apn, pdn->apn, - c_min(access_point_name->length, MAX_APN_LEN) + 1); - d_trace(5, " APN[%s]\n", pdn->apn); + ogs_cpystrn(access_point_name->apn, pdn->apn, + ogs_min(access_point_name->length, MAX_APN_LEN) + 1); + ogs_debug(" APN[%s]", pdn->apn); pdn_address->pdn_type = pdn->paa.pdn_type; if (pdn_address->pdn_type == GTP_PDN_TYPE_IPV4) { pdn_address->addr = pdn->paa.addr; pdn_address->length = NAS_PDN_ADDRESS_IPV4_LEN; - d_trace(5, " IPv4\n"); + ogs_debug(" IPv4"); } else if (pdn_address->pdn_type == GTP_PDN_TYPE_IPV6) { memcpy(pdn_address->addr6, pdn->paa.addr6+(IPV6_LEN>>1), IPV6_LEN>>1); pdn_address->length = NAS_PDN_ADDRESS_IPV6_LEN; - d_trace(5, " IPv6\n"); + ogs_debug(" IPv6"); } else if (pdn_address->pdn_type == GTP_PDN_TYPE_IPV4V6) { @@ -164,11 +160,10 @@ status_t esm_build_activate_default_bearer_context_request( memcpy(pdn_address->both.addr6, pdn->paa.both.addr6+(IPV6_LEN>>1), IPV6_LEN>>1); pdn_address->length = NAS_PDN_ADDRESS_IPV4V6_LEN; - d_trace(5, " IPv4v6\n"); + ogs_debug(" IPv4v6"); } else - d_assert(0, return CORE_ERROR, - "Invalid PDN_TYPE(%d)", pdn->paa.pdn_type); + ogs_assert_if_reached(); if (pdn->ambr.downlink || pdn->ambr.uplink) { @@ -186,22 +181,21 @@ status_t esm_build_activate_default_bearer_context_request( sess->pgw_pco.data, protocol_configuration_options->length); } - if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { - d_assert(nas_security_encode(pkbuf, mme_ue, &message) == CORE_OK && - *pkbuf, return CORE_ERROR,); + ogs_assert(nas_security_encode(pkbuf, mme_ue, &message) == OGS_OK && + *pkbuf); } else { - d_assert(nas_plain_encode(pkbuf, &message) == CORE_OK && *pkbuf, - return CORE_ERROR,); + ogs_assert(nas_plain_encode(pkbuf, &message) == OGS_OK && *pkbuf); } - return CORE_OK; + return OGS_OK; } -status_t esm_build_activate_dedicated_bearer_context_request( - pkbuf_t **pkbuf, mme_bearer_t *bearer) +int esm_build_activate_dedicated_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer) { mme_ue_t *mme_ue = NULL; mme_bearer_t *linked_bearer = NULL; @@ -218,14 +212,14 @@ status_t esm_build_activate_dedicated_bearer_context_request( nas_traffic_flow_template_t *tft = &activate_dedicated_eps_bearer_context_request->tft; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); linked_bearer = mme_linked_bearer(bearer); - d_assert(linked_bearer, return CORE_ERROR, "Null param"); + ogs_assert(linked_bearer); - d_trace(3, "[ESM] Activate dedicated bearer context request\n"); - d_trace(5, " IMSI[%s] EBI[%d] Linked-EBI[%d]\n", + ogs_debug("[ESM] Activate dedicated bearer context request"); + ogs_debug(" IMSI[%s] EBI[%d] Linked-EBI[%d]", mme_ue->imsi_bcd, bearer->ebi, linked_bearer->ebi); memset(&message, 0, sizeof(message)); @@ -244,18 +238,18 @@ status_t esm_build_activate_dedicated_bearer_context_request( bearer->qos.gbr.downlink, bearer->qos.gbr.uplink); tft->length = bearer->tft.len; - d_assert(tft->length, return CORE_ERROR, "No TFT Len"); - d_assert(bearer->tft.data, return CORE_ERROR, "Null param"); + ogs_assert(tft->length); + ogs_assert(bearer->tft.data); memcpy(tft->buffer, bearer->tft.data, tft->length); - d_assert(nas_security_encode(pkbuf, mme_ue, &message) == CORE_OK && - *pkbuf, return CORE_ERROR,); + ogs_assert(nas_security_encode(pkbuf, mme_ue, &message) == OGS_OK && + *pkbuf); - return CORE_OK; + return OGS_OK; } -status_t esm_build_modify_bearer_context_request( - pkbuf_t **pkbuf, mme_bearer_t *bearer, int qos_presence, int tft_presence) +int esm_build_modify_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer, int qos_presence, int tft_presence) { mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; @@ -269,14 +263,14 @@ status_t esm_build_modify_bearer_context_request( nas_traffic_flow_template_t *tft = &modify_eps_bearer_context_request->tft; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[ESM] Modify bearer context request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] Modify bearer context request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); memset(&message, 0, sizeof(message)); @@ -302,19 +296,19 @@ status_t esm_build_modify_bearer_context_request( modify_eps_bearer_context_request->presencemask |= NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT; tft->length = bearer->tft.len; - d_assert(tft->length, return CORE_ERROR, "No TFT Len"); - d_assert(bearer->tft.data, return CORE_ERROR, "Null param"); + ogs_assert(tft->length); + ogs_assert(bearer->tft.data); memcpy(tft->buffer, bearer->tft.data, tft->length); } - d_assert(nas_security_encode(pkbuf, mme_ue, &message) == CORE_OK && - *pkbuf, return CORE_ERROR,); + ogs_assert(nas_security_encode(pkbuf, mme_ue, &message) == OGS_OK && + *pkbuf); - return CORE_OK; + return OGS_OK; } -status_t esm_build_deactivate_bearer_context_request( - pkbuf_t **pkbuf, mme_bearer_t *bearer, nas_esm_cause_t esm_cause) +int esm_build_deactivate_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer, nas_esm_cause_t esm_cause) { mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; @@ -324,16 +318,16 @@ status_t esm_build_deactivate_bearer_context_request( *deactivate_eps_bearer_context_request = &message.esm.deactivate_eps_bearer_context_request; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[ESM] Deactivate bearer context request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] Deactivate bearer context request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); - d_trace(5, " Cause[%d]\n", esm_cause); + ogs_debug(" Cause[%d]", esm_cause); memset(&message, 0, sizeof(message)); message.h.security_header_type = @@ -346,8 +340,8 @@ status_t esm_build_deactivate_bearer_context_request( deactivate_eps_bearer_context_request->esm_cause = esm_cause; - d_assert(nas_security_encode(pkbuf, mme_ue, &message) == CORE_OK && - *pkbuf, return CORE_ERROR,); + ogs_assert(nas_security_encode(pkbuf, mme_ue, &message) == OGS_OK && + *pkbuf); - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/esm_build.h b/src/mme/esm_build.h index 17cd29657..b40972d98 100644 --- a/src/mme/esm_build.h +++ b/src/mme/esm_build.h @@ -7,18 +7,18 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) esm_build_pdn_connectivity_reject(pkbuf_t **pkbuf, +int esm_build_pdn_connectivity_reject(ogs_pkbuf_t **pkbuf, mme_sess_t *sess, nas_esm_cause_t esm_cause); -CORE_DECLARE(status_t) esm_build_information_request(pkbuf_t **pkbuf, +int esm_build_information_request(ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer); -CORE_DECLARE(status_t) esm_build_activate_default_bearer_context_request( - pkbuf_t **pkbuf, mme_sess_t *sess); -CORE_DECLARE(status_t) esm_build_activate_dedicated_bearer_context_request( - pkbuf_t **pkbuf, mme_bearer_t *bearer); -CORE_DECLARE(status_t) esm_build_modify_bearer_context_request( - pkbuf_t **pkbuf, mme_bearer_t *bearer, int qos_presence, int tft_presence); -CORE_DECLARE(status_t) esm_build_deactivate_bearer_context_request( - pkbuf_t **pkbuf, mme_bearer_t *bearer, nas_esm_cause_t esm_cause); +int esm_build_activate_default_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_sess_t *sess); +int esm_build_activate_dedicated_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer); +int esm_build_modify_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer, int qos_presence, int tft_presence); +int esm_build_deactivate_bearer_context_request( + ogs_pkbuf_t **pkbuf, mme_bearer_t *bearer, nas_esm_cause_t esm_cause); #ifdef __cplusplus } diff --git a/src/mme/esm_handler.c b/src/mme/esm_handler.c index 33c9ba0b7..681a06581 100644 --- a/src/mme/esm_handler.c +++ b/src/mme/esm_handler.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _esm_handler - -#include "core_debug.h" - #include "nas/nas_message.h" #include "mme_context.h" @@ -10,26 +6,27 @@ #include "esm_build.h" -status_t esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __esm_log_domain + +int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, nas_pdn_connectivity_request_t *pdn_connectivity_request) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; - c_uint8_t security_protected_required = 0; + uint8_t security_protected_required = 0; - d_assert(bearer, return CORE_ERROR,); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR,); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); - d_assert(pdn_connectivity_request, return CORE_ERROR,); + ogs_assert(pdn_connectivity_request); - d_assert(MME_UE_HAVE_IMSI(mme_ue), return CORE_ERROR, - "No IMSI in PDN_CPNNECTIVITY_REQUEST"); - d_assert(SECURITY_CONTEXT_IS_VALID(mme_ue), return CORE_ERROR, - "No Security Context in PDN_CPNNECTIVITY_REQUEST"); + ogs_assert(MME_UE_HAVE_IMSI(mme_ue)); + ogs_assert(SECURITY_CONTEXT_IS_VALID(mme_ue)); memcpy(&sess->request_type, &pdn_connectivity_request->request_type, sizeof(sess->request_type)); @@ -42,7 +39,7 @@ status_t esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, &pdn_connectivity_request->esm_information_transfer_flag; security_protected_required = esm_information_transfer_flag->security_protected_required; - d_trace(5, " EIT(ESM information transfer)[%d]\n", + ogs_debug(" EIT(ESM information transfer)[%d]", security_protected_required); } @@ -56,9 +53,9 @@ status_t esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, /* Invalid APN */ rv = nas_send_pdn_connectivity_reject( sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); - return CORE_ERROR; + return OGS_ERROR; } } @@ -74,9 +71,9 @@ status_t esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, if (security_protected_required) { rv = nas_send_esm_information_request(bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } if (!sess->pdn) @@ -87,31 +84,31 @@ status_t esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, if (sess->pdn) { - d_trace(5, " APN[%s]\n", sess->pdn->apn); + ogs_debug(" APN[%s]", sess->pdn->apn); rv = mme_gtp_send_create_session_request(sess); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp send failed"); + ogs_assert(rv == OGS_OK); } else { rv = nas_send_pdn_connectivity_reject( sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); - return CORE_ERROR; + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t esm_handle_information_response(mme_sess_t *sess, +int esm_handle_information_response(mme_sess_t *sess, nas_esm_information_response_t *esm_information_response) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); if (esm_information_response->presencemask & NAS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) @@ -130,26 +127,26 @@ status_t esm_handle_information_response(mme_sess_t *sess, if (sess->pdn) { - d_trace(5, " APN[%s]\n", sess->pdn->apn); + ogs_debug(" APN[%s]", sess->pdn->apn); if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) { rv = nas_send_attach_accept(mme_ue); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send failed"); + ogs_assert(rv == OGS_OK); } else { rv = mme_gtp_send_create_session_request(sess); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp send failed"); + ogs_assert(rv == OGS_OK); } } else { rv = nas_send_pdn_connectivity_reject( sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); - return CORE_ERROR; + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/esm_handler.h b/src/mme/esm_handler.h index f8315d58f..d3f8de066 100644 --- a/src/mme/esm_handler.h +++ b/src/mme/esm_handler.h @@ -9,9 +9,9 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, +int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, nas_pdn_connectivity_request_t *pdn_connectivity_request); -CORE_DECLARE(status_t) esm_handle_information_response(mme_sess_t *sess, +int esm_handle_information_response(mme_sess_t *sess, nas_esm_information_response_t *bearer_information_response); #ifdef __cplusplus diff --git a/src/mme/esm_sm.c b/src/mme/esm_sm.c index ff9468c02..fb0ddfbc4 100644 --- a/src/mme/esm_sm.c +++ b/src/mme/esm_sm.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _esm_sm - -#include "core_debug.h" - #include "nas/nas_message.h" #include "mme_event.h" @@ -14,126 +10,129 @@ #include "nas_path.h" #include "mme_gtp_path.h" -void esm_state_initial(fsm_t *s, event_t *e) +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __esm_log_domain + +void esm_state_initial(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); + ogs_assert(s); - mme_sm_trace(3, e); + mme_sm_debug(e); - FSM_TRAN(s, &esm_state_inactive); + OGS_FSM_TRAN(s, &esm_state_inactive); } -void esm_state_final(fsm_t *s, event_t *e) +void esm_state_final(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); + ogs_assert(s); - mme_sm_trace(3, e); + mme_sm_debug(e); } -void esm_state_inactive(fsm_t *s, event_t *e) +void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); - bearer = mme_bearer_find(event_get_param1(e)); - d_assert(bearer, return, "Null param"); + bearer = e->bearer; + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return, "Null param"); + ogs_assert(mme_ue); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_ESM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param3(e); - d_assert(message, break, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); switch(message->esm.h.message_type) { case NAS_PDN_CONNECTIVITY_REQUEST: { - d_trace(3, "[ESM] PDN Connectivity request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] PDN Connectivity request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); rv = esm_handle_pdn_connectivity_request( bearer, &message->esm.pdn_connectivity_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - FSM_TRAN(s, esm_state_exception); + OGS_FSM_TRAN(s, esm_state_exception); break; } break; } case NAS_ESM_INFORMATION_RESPONSE: { - d_trace(3, "[ESM] ESM information response\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] ESM information response"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); rv = esm_handle_information_response( sess, &message->esm.esm_information_response); - if (rv != CORE_OK) + if (rv != OGS_OK) { - FSM_TRAN(s, esm_state_exception); + OGS_FSM_TRAN(s, esm_state_exception); break; } break; } case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: { - d_trace(3, "[ESM] Activate default EPS bearer " - "context accept\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] Activate default EPS bearer " + "context accept"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); /* Check if Initial Context Setup Response or * E-RAB Setup Response is received */ if (MME_HAVE_ENB_S1U_PATH(bearer)) { rv = mme_gtp_send_modify_bearer_request(bearer, 0); - d_assert(rv == CORE_OK,, "gtp send failed"); + ogs_assert(rv == OGS_OK); } rv = nas_send_activate_all_dedicated_bearers(bearer); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); - FSM_TRAN(s, esm_state_active); + OGS_FSM_TRAN(s, esm_state_active); break; } case NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: { - d_trace(3, "[ESM] Activate dedicated EPS bearer " - "context accept\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] Activate dedicated EPS bearer " + "context accept"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); /* Check if Initial Context Setup Response or * E-RAB Setup Response is received */ if (MME_HAVE_ENB_S1U_PATH(bearer)) { rv = mme_gtp_send_create_bearer_response(bearer); - d_assert(rv == CORE_OK,, "gtp send failed"); + ogs_assert(rv == OGS_OK); } - FSM_TRAN(s, esm_state_active); + OGS_FSM_TRAN(s, esm_state_active); break; } default: { - d_error("Unknown message(type:%d)", + ogs_error("Unknown message(type:%d)", message->esm.h.message_type); break; } @@ -143,110 +142,106 @@ void esm_state_inactive(fsm_t *s, event_t *e) default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } } -void esm_state_active(fsm_t *s, event_t *e) +void esm_state_active(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); - bearer = mme_bearer_find(event_get_param1(e)); - d_assert(bearer, return, "Null param"); + bearer = e->bearer; + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return, "Null param"); + ogs_assert(mme_ue); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_ESM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param3(e); - d_assert(message, break, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); switch(message->esm.h.message_type) { case NAS_PDN_CONNECTIVITY_REQUEST: { - d_trace(3, "[ESM] PDN Connectivity request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] PDN Connectivity request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); rv = esm_handle_pdn_connectivity_request( bearer, &message->esm.pdn_connectivity_request); - if (rv != CORE_OK) + if (rv != OGS_OK) { - FSM_TRAN(s, esm_state_exception); + OGS_FSM_TRAN(s, esm_state_exception); break; } - FSM_TRAN(s, esm_state_inactive); + OGS_FSM_TRAN(s, esm_state_inactive); break; } case NAS_PDN_DISCONNECT_REQUEST: { - d_trace(3, "[ESM] PDN disconnect request\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] PDN disconnect request"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); if (MME_HAVE_SGW_S1U_PATH(sess)) { rv = mme_gtp_send_delete_session_request(sess); - d_assert(rv == CORE_OK, return, - "mme_gtp_send_delete_session_request error"); + ogs_assert(rv == OGS_OK); } else { rv = nas_send_deactivate_bearer_context_request(bearer); - d_assert(rv == CORE_OK, return, - "nas_send_deactivate_bearer_context_request failed"); + ogs_assert(rv == OGS_OK); } - FSM_TRAN(s, esm_state_pdn_will_disconnect); + OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect); break; } case NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT: { - d_trace(3, "[ESM] Modify EPS bearer context accept\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] Modify EPS bearer context accept"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); rv = mme_gtp_send_update_bearer_response(bearer); - d_assert(rv == CORE_OK, return, - "mme_gtp_send_update_session_request error"); + ogs_assert(rv == OGS_OK); break; } case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: { - d_trace(3, "[ESM] [A] Deactivate EPS bearer " - "context accept\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] [A] Deactivate EPS bearer " + "context accept"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); rv = mme_gtp_send_delete_bearer_response(bearer); - d_assert(rv == CORE_OK, return, - "mme_gtp_send_delete_session_request error"); - FSM_TRAN(s, esm_state_bearer_deactivated); + ogs_assert(rv == OGS_OK); + OGS_FSM_TRAN(s, esm_state_bearer_deactivated); break; } default: { - d_error("Unknown message(type:%d)", + ogs_error("Unknown message(type:%d)", message->esm.h.message_type); break; } @@ -256,59 +251,59 @@ void esm_state_active(fsm_t *s, event_t *e) default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } } -void esm_state_pdn_will_disconnect(fsm_t *s, event_t *e) +void esm_state_pdn_will_disconnect(ogs_fsm_t *s, mme_event_t *e) { mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); - bearer = mme_bearer_find(event_get_param1(e)); - d_assert(bearer, return, "Null param"); + bearer = e->bearer; + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return, "Null param"); + ogs_assert(mme_ue); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_ESM_MESSAGE: { - nas_message_t *message = (nas_message_t *)event_get_param3(e); - d_assert(message, break, "Null param"); + nas_message_t *message = e->nas_message; + ogs_assert(message); switch(message->esm.h.message_type) { case NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: { - d_trace(3, "[ESM] [D] Deactivate EPS bearer " - "context accept\n"); - d_trace(5, " IMSI[%s] PTI[%d] EBI[%d]\n", + ogs_debug("[ESM] [D] Deactivate EPS bearer " + "context accept"); + ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]", mme_ue->imsi_bcd, sess->pti, bearer->ebi); - FSM_TRAN(s, esm_state_pdn_did_disconnect); + OGS_FSM_TRAN(s, esm_state_pdn_did_disconnect); break; } default: { - d_error("Unknown message(type:%d)", + ogs_error("Unknown message(type:%d)", message->esm.h.message_type); break; } @@ -318,73 +313,76 @@ void esm_state_pdn_will_disconnect(fsm_t *s, event_t *e) default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } } -void esm_state_pdn_did_disconnect(fsm_t *s, event_t *e) +void esm_state_pdn_did_disconnect(ogs_fsm_t *s, mme_event_t *e) { - mme_sm_trace(3, e); + ogs_assert(e); + mme_sm_debug(e); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } } -void esm_state_bearer_deactivated(fsm_t *s, event_t *e) +void esm_state_bearer_deactivated(ogs_fsm_t *s, mme_event_t *e) { - mme_sm_trace(3, e); + ogs_assert(e); + mme_sm_debug(e); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } } -void esm_state_exception(fsm_t *s, event_t *e) +void esm_state_exception(ogs_fsm_t *s, mme_event_t *e) { - mme_sm_trace(3, e); + ogs_assert(e); + mme_sm_debug(e); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } diff --git a/src/mme/kasumi.h b/src/mme/kasumi.h index 707ed61a6..9c809121d 100644 --- a/src/mme/kasumi.h +++ b/src/mme/kasumi.h @@ -5,19 +5,19 @@ #ifndef __KASUMI__ #define __KASUMI__ -#include "core.h" +#include "ogs-core.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -typedef c_uint8_t u8; -typedef c_uint16_t u16; +typedef uint8_t u8; +typedef uint16_t u16; /* original reference is using long, which is 64 bits on 64 bits system I changed to int to make it work on x86 32 / 64 bits system typedef unsigned long u32; */ -typedef c_uint32_t u32; +typedef uint32_t u32; /*------- unions: used to remove "endian" issues ------------------------*/ @@ -46,18 +46,16 @@ typedef union { *---------------------------------------------------------*/ /* initialize the 128 bits key into the cipher */ -CORE_DECLARE(void) kasumi_key_schedule( u8 *key ); +void kasumi_key_schedule( u8 *key ); /* cipher a block of 64 bits */ -CORE_DECLARE(void) kasumi( u8 *data ); +void kasumi( u8 *data ); /* cipher a whole message in 3GPP -counter- mode */ -CORE_DECLARE(void) kasumi_f8( u8 *key, u32 count, u32 bearer, u32 dir, \ - u8 *data, int length ); +void kasumi_f8( u8 *key, u32 count, u32 bearer, u32 dir, u8 *data, int length ); /* compute a 3GPP MAC on a message */ -CORE_DECLARE(u8*) kasumi_f9( u8 *key, u32 count, u32 fresh, u32 dir, \ - u8 *data, int length ); +u8* kasumi_f9( u8 *key, u32 count, u32 fresh, u32 dir, u8 *data, int length ); #ifdef __cplusplus } diff --git a/src/mme/mme_context.c b/src/mme/mme_context.c index a8110ed9d..d21234cac 100644 --- a/src/mme/mme_context.c +++ b/src/mme/mme_context.c @@ -1,27 +1,18 @@ -#define TRACE_MODULE _mme_context - -#include "core_debug.h" -#include "core_pool.h" -#include "core_lib.h" -#include "core_msgq.h" -#include "core_fsm.h" -#include "core_network.h" - #include #include -#include "common/yaml_helper.h" -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #include "gtp/gtp_xact.h" #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" #include "fd/fd_lib.h" -#include "common/context.h" +#include "app/context.h" #include "nas_conv.h" #include "mme_context.h" #include "mme_event.h" #include "s1ap_path.h" +#include "s1ap_handler.h" #include "mme_sm.h" #define MAX_CELL_PER_ENB 8 @@ -29,21 +20,24 @@ static mme_context_t self; static fd_config_t g_fd_conf; -pool_declare(mme_sgw_pool, mme_sgw_t, MAX_NUM_OF_SGW); -pool_declare(mme_pgw_pool, mme_pgw_t, MAX_NUM_OF_PGW); +int __mme_log_domain; +int __emm_log_domain; +int __esm_log_domain; -index_declare(mme_enb_pool, mme_enb_t, MAX_NUM_OF_ENB); -index_declare(mme_ue_pool, mme_ue_t, MAX_POOL_OF_UE); -index_declare(enb_ue_pool, enb_ue_t, MAX_POOL_OF_UE); -index_declare(mme_sess_pool, mme_sess_t, MAX_POOL_OF_SESS); -index_declare(mme_bearer_pool, mme_bearer_t, MAX_POOL_OF_BEARER); +static OGS_POOL(mme_sgw_pool, mme_sgw_t); +static OGS_POOL(mme_pgw_pool, mme_pgw_t); + +static OGS_POOL(mme_enb_pool, mme_enb_t); +static OGS_POOL(mme_ue_pool, mme_ue_t); +static OGS_POOL(enb_ue_pool, enb_ue_t); +static OGS_POOL(mme_sess_pool, mme_sess_t); +static OGS_POOL(mme_bearer_pool, mme_bearer_t); static int context_initialized = 0; -status_t mme_context_init() +int mme_context_init() { - d_assert(context_initialized == 0, return CORE_ERROR, - "MME context already has been context_initialized"); + ogs_assert(context_initialized == 0); /* Initial FreeDiameter Config */ memset(&g_fd_conf, 0, sizeof(fd_config_t)); @@ -52,97 +46,91 @@ status_t mme_context_init() memset(&self, 0, sizeof(mme_context_t)); self.fd_config = &g_fd_conf; - list_init(&self.s1ap_list); - list_init(&self.s1ap_list6); + ogs_log_install_domain(&__mme_log_domain, "mme", ogs_core()->log.level); + ogs_log_install_domain(&__emm_log_domain, "emm", ogs_core()->log.level); + ogs_log_install_domain(&__esm_log_domain, "esm", ogs_core()->log.level); - list_init(&self.gtpc_list); - list_init(&self.gtpc_list6); + ogs_list_init(&self.s1ap_list); + ogs_list_init(&self.s1ap_list6); + + ogs_list_init(&self.gtpc_list); + ogs_list_init(&self.gtpc_list6); gtp_node_init(); - list_init(&self.sgw_list); - list_init(&self.pgw_list); + ogs_list_init(&self.sgw_list); + ogs_list_init(&self.pgw_list); - pool_init(&mme_sgw_pool, MAX_NUM_OF_SGW); - pool_init(&mme_pgw_pool, MAX_NUM_OF_PGW); + ogs_pool_init(&mme_sgw_pool, MAX_NUM_OF_SGW); + ogs_pool_init(&mme_pgw_pool, MAX_NUM_OF_PGW); - index_init(&mme_enb_pool, MAX_NUM_OF_ENB); + ogs_pool_init(&mme_enb_pool, MAX_NUM_OF_ENB); - index_init(&mme_ue_pool, MAX_POOL_OF_UE); - index_init(&enb_ue_pool, MAX_POOL_OF_UE); - index_init(&mme_sess_pool, MAX_POOL_OF_SESS); - index_init(&mme_bearer_pool, MAX_POOL_OF_BEARER); - pool_init(&self.m_tmsi, MAX_POOL_OF_UE); + ogs_pool_init(&mme_ue_pool, MAX_POOL_OF_UE); + ogs_pool_init(&enb_ue_pool, MAX_POOL_OF_UE); + ogs_pool_init(&mme_sess_pool, MAX_POOL_OF_SESS); + ogs_pool_init(&mme_bearer_pool, MAX_POOL_OF_BEARER); + ogs_pool_init(&self.m_tmsi, MAX_POOL_OF_UE); - self.enb_sock_hash = hash_make(); - self.enb_addr_hash = hash_make(); - self.enb_id_hash = hash_make(); - self.mme_ue_s1ap_id_hash = hash_make(); - self.imsi_ue_hash = hash_make(); - self.guti_ue_hash = hash_make(); + self.enb_sock_hash = ogs_hash_make(); + self.enb_addr_hash = ogs_hash_make(); + self.enb_id_hash = ogs_hash_make(); + self.mme_ue_s1ap_id_hash = ogs_hash_make(); + self.imsi_ue_hash = ogs_hash_make(); + self.guti_ue_hash = ogs_hash_make(); /* Timer value */ - self.t3413_value = 2; /* Paging retry timer: 2 secs */ - self.s1_holding_timer_value = 30; /* S1 holding timer: 30 secs */ + self.t3413_value = ogs_time_from_sec(2); /* Paging retry timer: 2 secs */ context_initialized = 1; - return CORE_OK; + return OGS_OK; } -status_t mme_context_final() +int mme_context_final() { - d_assert(context_initialized == 1, return CORE_ERROR, - "MME context already has been finalized"); + ogs_assert(context_initialized == 1); mme_enb_remove_all(); mme_ue_remove_all(); - if (pool_used(&self.m_tmsi)) - { - d_error("%d not freed in M-TMSI pool[%d] in MME-Context", - pool_used(&self.m_tmsi), pool_size(&self.m_tmsi)); - } - d_trace(9, "%d not freed in M-TMSI pool[%d] in MME-Context\n", - pool_used(&self.m_tmsi), pool_size(&self.m_tmsi)); + ogs_assert(self.enb_sock_hash); + ogs_hash_destroy(self.enb_sock_hash); + ogs_assert(self.enb_addr_hash); + ogs_hash_destroy(self.enb_addr_hash); + ogs_assert(self.enb_id_hash); + ogs_hash_destroy(self.enb_id_hash); - d_assert(self.enb_sock_hash, , "Null param"); - hash_destroy(self.enb_sock_hash); - d_assert(self.enb_addr_hash, , "Null param"); - hash_destroy(self.enb_addr_hash); - d_assert(self.enb_id_hash, , "Null param"); - hash_destroy(self.enb_id_hash); + ogs_assert(self.mme_ue_s1ap_id_hash); + ogs_hash_destroy(self.mme_ue_s1ap_id_hash); + ogs_assert(self.imsi_ue_hash); + ogs_hash_destroy(self.imsi_ue_hash); + ogs_assert(self.guti_ue_hash); + ogs_hash_destroy(self.guti_ue_hash); - d_assert(self.mme_ue_s1ap_id_hash, , "Null param"); - hash_destroy(self.mme_ue_s1ap_id_hash); - d_assert(self.imsi_ue_hash, , "Null param"); - hash_destroy(self.imsi_ue_hash); - d_assert(self.guti_ue_hash, , "Null param"); - hash_destroy(self.guti_ue_hash); + ogs_pool_final(&self.m_tmsi); + ogs_pool_final(&mme_bearer_pool); + ogs_pool_final(&mme_sess_pool); + ogs_pool_final(&mme_ue_pool); + ogs_pool_final(&enb_ue_pool); - pool_final(&self.m_tmsi); - index_final(&mme_bearer_pool); - index_final(&mme_sess_pool); - index_final(&mme_ue_pool); - index_final(&enb_ue_pool); - - index_final(&mme_enb_pool); + ogs_pool_final(&mme_enb_pool); mme_sgw_remove_all(); mme_pgw_remove_all(); - pool_final(&mme_sgw_pool); - pool_final(&mme_pgw_pool); + ogs_pool_final(&mme_sgw_pool); + ogs_pool_final(&mme_pgw_pool); gtp_node_final(); - sock_remove_all_nodes(&self.s1ap_list); - sock_remove_all_nodes(&self.s1ap_list6); - sock_remove_all_nodes(&self.gtpc_list); - sock_remove_all_nodes(&self.gtpc_list6); + ogs_sock_remove_all_nodes(&self.s1ap_list); + ogs_sock_remove_all_nodes(&self.s1ap_list6); + ogs_sock_remove_all_nodes(&self.gtpc_list); + ogs_sock_remove_all_nodes(&self.gtpc_list6); context_initialized = 0; - return CORE_OK; + return OGS_OK; } mme_context_t* mme_self() @@ -150,7 +138,7 @@ mme_context_t* mme_self() return &self; } -static status_t mme_context_prepare() +static int mme_context_prepare() { self.relative_capacity = 0xff; @@ -159,221 +147,220 @@ static status_t mme_context_prepare() self.fd_config->cnf_port = DIAMETER_PORT; self.fd_config->cnf_port_tls = DIAMETER_SECURE_PORT; - return CORE_OK; + return OGS_OK; } -static status_t mme_context_validation() +static int mme_context_validation() { if (self.fd_conf_path == NULL && (self.fd_config->cnf_diamid == NULL || self.fd_config->cnf_diamrlm == NULL || self.fd_config->cnf_addr == NULL)) { - d_error("No mme.freeDiameter in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.freeDiameter in '%s'", context_self()->config.path); + return OGS_ERROR; } - if (list_first(&self.s1ap_list) == NULL && - list_first(&self.s1ap_list6) == NULL) + if (ogs_list_first(&self.s1ap_list) == NULL && + ogs_list_first(&self.s1ap_list6) == NULL) { - d_error("No mme.s1ap in '%s'", context_self()->config.path); - return CORE_EAGAIN; + ogs_error("No mme.s1ap in '%s'", context_self()->config.path); + return OGS_RETRY; } - if (list_first(&self.gtpc_list) == NULL && - list_first(&self.gtpc_list6) == NULL) + if (ogs_list_first(&self.gtpc_list) == NULL && + ogs_list_first(&self.gtpc_list6) == NULL) { - d_error("No mme.gtpc in '%s'", context_self()->config.path); - return CORE_EAGAIN; + ogs_error("No mme.gtpc in '%s'", context_self()->config.path); + return OGS_RETRY; } - if (list_first(&self.sgw_list) == NULL) + if (ogs_list_first(&self.sgw_list) == NULL) { - d_error("No sgw.gtpc in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No sgw.gtpc in '%s'", context_self()->config.path); + return OGS_ERROR; } - if (list_first(&self.pgw_list) == NULL) + if (ogs_list_first(&self.pgw_list) == NULL) { - d_error("No pgw.gtpc in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No pgw.gtpc in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.max_num_of_served_gummei == 0) { - d_error("No mme.gummei in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.gummei in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.served_gummei[0].num_of_plmn_id == 0) { - d_error("No mme.gummei.plmn_id in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.gummei.plmn_id in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.served_gummei[0].num_of_mme_gid == 0) { - d_error("No mme.gummei.mme_gid in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.gummei.mme_gid in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.served_gummei[0].num_of_mme_code == 0) { - d_error("No mme.gummei.mme_code in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.gummei.mme_code in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.num_of_served_tai == 0) { - d_error("No mme.tai in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.tai in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.served_tai[0].list0.tai[0].num == 0 && self.served_tai[0].list2.num == 0) { - d_error("No mme.tai.plmn_id|tac in '%s'", context_self()->config.path); - return CORE_ERROR; + ogs_error("No mme.tai.plmn_id|tac in '%s'", context_self()->config.path); + return OGS_ERROR; } if (self.num_of_integrity_order == 0) { - d_error("No mme.security.integrity_order in '%s'", + ogs_error("No mme.security.integrity_order in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } if (self.num_of_ciphering_order == 0) { - d_error("no mme.security.ciphering_order in '%s'", + ogs_error("no mme.security.ciphering_order in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t mme_context_parse_config() +int mme_context_parse_config() { - status_t rv; + int rv; config_t *config = &context_self()->config; yaml_document_t *document = NULL; - yaml_iter_t root_iter; + ogs_yaml_iter_t root_iter; - d_assert(config, return CORE_ERROR,); + ogs_assert(config); document = config->document; - d_assert(document, return CORE_ERROR,); + ogs_assert(document); rv = mme_context_prepare(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - yaml_iter_init(&root_iter, document); - while(yaml_iter_next(&root_iter)) + ogs_yaml_iter_init(&root_iter, document); + while(ogs_yaml_iter_next(&root_iter)) { - const char *root_key = yaml_iter_key(&root_iter); - d_assert(root_key, return CORE_ERROR,); + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); if (!strcmp(root_key, "mme")) { - yaml_iter_t mme_iter; - yaml_iter_recurse(&root_iter, &mme_iter); - while(yaml_iter_next(&mme_iter)) + ogs_yaml_iter_t mme_iter; + ogs_yaml_iter_recurse(&root_iter, &mme_iter); + while(ogs_yaml_iter_next(&mme_iter)) { - const char *mme_key = yaml_iter_key(&mme_iter); - d_assert(mme_key, return CORE_ERROR,); + const char *mme_key = ogs_yaml_iter_key(&mme_iter); + ogs_assert(mme_key); if (!strcmp(mme_key, "freeDiameter")) { yaml_node_t *node = yaml_document_get_node(document, mme_iter.pair->value); - d_assert(node, return CORE_ERROR,); + ogs_assert(node); if (node->type == YAML_SCALAR_NODE) { - self.fd_conf_path = yaml_iter_value(&mme_iter); + self.fd_conf_path = ogs_yaml_iter_value(&mme_iter); } else if (node->type == YAML_MAPPING_NODE) { - yaml_iter_t fd_iter; - yaml_iter_recurse(&mme_iter, &fd_iter); + ogs_yaml_iter_t fd_iter; + ogs_yaml_iter_recurse(&mme_iter, &fd_iter); - while(yaml_iter_next(&fd_iter)) + while(ogs_yaml_iter_next(&fd_iter)) { - const char *fd_key = yaml_iter_key(&fd_iter); - d_assert(fd_key, return CORE_ERROR,); + const char *fd_key = ogs_yaml_iter_key(&fd_iter); + ogs_assert(fd_key); if (!strcmp(fd_key, "identity")) { self.fd_config->cnf_diamid = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "realm")) { self.fd_config->cnf_diamrlm = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port = atoi(v); } else if (!strcmp(fd_key, "sec_port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port_tls = atoi(v); } else if (!strcmp(fd_key, "no_sctp")) { self.fd_config->cnf_flags.no_sctp = - yaml_iter_bool(&fd_iter); + ogs_yaml_iter_bool(&fd_iter); } else if (!strcmp(fd_key, "listen_on")) { self.fd_config->cnf_addr = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "load_extension")) { - yaml_iter_t ext_array, ext_iter; - yaml_iter_recurse(&fd_iter, &ext_array); + ogs_yaml_iter_t ext_array, ext_iter; + ogs_yaml_iter_recurse(&fd_iter, &ext_array); do { const char *module = NULL; const char *conf = NULL; - if (yaml_iter_type(&ext_array) == + if (ogs_yaml_iter_type(&ext_array) == YAML_MAPPING_NODE) { memcpy(&ext_iter, &ext_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&ext_array)) + if (!ogs_yaml_iter_next(&ext_array)) break; - yaml_iter_recurse( + ogs_yaml_iter_recurse( &ext_array, &ext_iter); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&ext_iter)) + while(ogs_yaml_iter_next(&ext_iter)) { const char *ext_key = - yaml_iter_key(&ext_iter); - d_assert(ext_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&ext_iter); + ogs_assert(ext_key); if (!strcmp(ext_key, "module")) { - module = yaml_iter_value(&ext_iter); + module = ogs_yaml_iter_value(&ext_iter); } else if (!strcmp(ext_key, "conf")) { - conf = yaml_iter_value(&ext_iter); + conf = ogs_yaml_iter_value(&ext_iter); } else - d_warn("unknown key `%s`", ext_key); + ogs_warn("unknown key `%s`", ext_key); } if (module) @@ -386,62 +373,61 @@ status_t mme_context_parse_config() conf = conf; self.fd_config->num_of_ext++; } - } while(yaml_iter_type(&ext_array) == + } while(ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(fd_key, "connect")) { - yaml_iter_t conn_array, conn_iter; - yaml_iter_recurse(&fd_iter, &conn_array); + ogs_yaml_iter_t conn_array, conn_iter; + ogs_yaml_iter_recurse(&fd_iter, &conn_array); do { const char *identity = NULL; const char *addr = NULL; - c_uint16_t port = 0; + uint16_t port = 0; - if (yaml_iter_type(&conn_array) == + if (ogs_yaml_iter_type(&conn_array) == YAML_MAPPING_NODE) { memcpy(&conn_iter, &conn_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&conn_array)) + if (!ogs_yaml_iter_next(&conn_array)) break; - yaml_iter_recurse(&conn_array, &conn_iter); + ogs_yaml_iter_recurse(&conn_array, &conn_iter); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&conn_iter)) + while(ogs_yaml_iter_next(&conn_iter)) { const char *conn_key = - yaml_iter_key(&conn_iter); - d_assert(conn_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&conn_iter); + ogs_assert(conn_key); if (!strcmp(conn_key, "identity")) { - identity = yaml_iter_value(&conn_iter); + identity = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "addr")) { - addr = yaml_iter_value(&conn_iter); + addr = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "port")) { const char *v = - yaml_iter_value(&conn_iter); + ogs_yaml_iter_value(&conn_iter); if (v) port = atoi(v); } else - d_warn("unknown key `%s`", conn_key); + ogs_warn("unknown key `%s`", conn_key); } if (identity && addr) @@ -457,67 +443,66 @@ status_t mme_context_parse_config() port = port; self.fd_config->num_of_conn++; } - } while(yaml_iter_type(&conn_array) == + } while(ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", fd_key); + ogs_warn("unknown key `%s`", fd_key); } } } else if (!strcmp(mme_key, "relative_capacity")) { - const char *v = yaml_iter_value(&mme_iter); + const char *v = ogs_yaml_iter_value(&mme_iter); if (v) self.relative_capacity = atoi(v); } else if (!strcmp(mme_key, "s1ap")) { - yaml_iter_t s1ap_array, s1ap_iter; - yaml_iter_recurse(&mme_iter, &s1ap_array); + ogs_yaml_iter_t s1ap_array, s1ap_iter; + ogs_yaml_iter_recurse(&mme_iter, &s1ap_array); do { int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.s1ap_port; + uint16_t port = self.s1ap_port; const char *dev = NULL; - c_sockaddr_t *list = NULL; - sock_node_t *node = NULL; + ogs_sockaddr_t *list = NULL; + ogs_socknode_t *node = NULL; - if (yaml_iter_type(&s1ap_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(&s1ap_array) == YAML_MAPPING_NODE) { memcpy(&s1ap_iter, &s1ap_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&s1ap_array) == + else if (ogs_yaml_iter_type(&s1ap_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&s1ap_array)) + if (!ogs_yaml_iter_next(&s1ap_array)) break; - yaml_iter_recurse(&s1ap_array, &s1ap_iter); + ogs_yaml_iter_recurse(&s1ap_array, &s1ap_iter); } - else if (yaml_iter_type(&s1ap_array) == + else if (ogs_yaml_iter_type(&s1ap_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&s1ap_iter)) + while(ogs_yaml_iter_next(&s1ap_iter)) { const char *s1ap_key = - yaml_iter_key(&s1ap_iter); - d_assert(s1ap_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&s1ap_iter); + ogs_assert(s1ap_key); if (!strcmp(s1ap_key, "family")) { - const char *v = yaml_iter_value(&s1ap_iter); + const char *v = ogs_yaml_iter_value(&s1ap_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -526,31 +511,30 @@ status_t mme_context_parse_config() else if (!strcmp(s1ap_key, "addr") || !strcmp(s1ap_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(&s1ap_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(&s1ap_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(s1ap_key, "port")) { - const char *v = yaml_iter_value(&s1ap_iter); + const char *v = ogs_yaml_iter_value(&s1ap_iter); if (v) { port = atoi(v); @@ -559,112 +543,111 @@ status_t mme_context_parse_config() } else if (!strcmp(s1ap_key, "dev")) { - dev = yaml_iter_value(&s1ap_iter); + dev = ogs_yaml_iter_value(&s1ap_iter); } else - d_warn("unknown key `%s`", s1ap_key); + ogs_warn("unknown key `%s`", s1ap_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (list) { - if (context_self()->parameter.no_ipv4 == 0) + if (context_self()->config.parameter.no_ipv4 == 0) { - rv = sock_add_node(&self.s1ap_list, + rv = ogs_sock_add_node(&self.s1ap_list, &node, list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - if (context_self()->parameter.no_ipv6 == 0) + if (context_self()->config.parameter.no_ipv6 == 0) { - rv = sock_add_node(&self.s1ap_list6, + rv = ogs_sock_add_node(&self.s1ap_list6, &node, list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); } if (dev) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.s1ap_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.s1ap_list6, dev, self.s1ap_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - } while(yaml_iter_type(&s1ap_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(&s1ap_array) == YAML_SEQUENCE_NODE); - if (list_first(&self.s1ap_list) == NULL && - list_first(&self.s1ap_list6) == NULL) + if (ogs_list_first(&self.s1ap_list) == NULL && + ogs_list_first(&self.s1ap_list6) == NULL) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.s1ap_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.s1ap_list6, NULL, self.s1ap_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } } else if (!strcmp(mme_key, "gtpc")) { - yaml_iter_t gtpc_array, gtpc_iter; - yaml_iter_recurse(&mme_iter, >pc_array); + ogs_yaml_iter_t gtpc_array, gtpc_iter; + ogs_yaml_iter_recurse(&mme_iter, >pc_array); do { int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.gtpc_port; + uint16_t port = self.gtpc_port; const char *dev = NULL; - c_sockaddr_t *list = NULL; - sock_node_t *node = NULL; + ogs_sockaddr_t *list = NULL; + ogs_socknode_t *node = NULL; - if (yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) { memcpy(>pc_iter, >pc_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(>pc_array)) + if (!ogs_yaml_iter_next(>pc_array)) break; - yaml_iter_recurse(>pc_array, >pc_iter); + ogs_yaml_iter_recurse(>pc_array, >pc_iter); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(>pc_iter)) + while(ogs_yaml_iter_next(>pc_iter)) { const char *gtpc_key = - yaml_iter_key(>pc_iter); - d_assert(gtpc_key, - return CORE_ERROR,); + ogs_yaml_iter_key(>pc_iter); + ogs_assert(gtpc_key); if (!strcmp(gtpc_key, "family")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -673,31 +656,30 @@ status_t mme_context_parse_config() else if (!strcmp(gtpc_key, "addr") || !strcmp(gtpc_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(>pc_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(>pc_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gtpc_key, "port")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) { port = atoi(v); @@ -706,155 +688,153 @@ status_t mme_context_parse_config() } else if (!strcmp(gtpc_key, "dev")) { - dev = yaml_iter_value(>pc_iter); + dev = ogs_yaml_iter_value(>pc_iter); } else - d_warn("unknown key `%s`", gtpc_key); + ogs_warn("unknown key `%s`", gtpc_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (list) { - if (context_self()->parameter.no_ipv4 == 0) + if (context_self()->config.parameter.no_ipv4 == 0) { - rv = sock_add_node(&self.gtpc_list, + rv = ogs_sock_add_node(&self.gtpc_list, &node, list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - if (context_self()->parameter.no_ipv6 == 0) + if (context_self()->config.parameter.no_ipv6 == 0) { - rv = sock_add_node(&self.gtpc_list6, + rv = ogs_sock_add_node(&self.gtpc_list6, &node, list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); } if (dev) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpc_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpc_list6, dev, self.gtpc_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - } while(yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); - if (list_first(&self.gtpc_list) == NULL && - list_first(&self.gtpc_list6) == NULL) + if (ogs_list_first(&self.gtpc_list) == NULL && + ogs_list_first(&self.gtpc_list6) == NULL) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpc_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpc_list6, NULL, self.gtpc_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } } else if (!strcmp(mme_key, "gummei")) { - yaml_iter_t gummei_array, gummei_iter; - yaml_iter_recurse(&mme_iter, &gummei_array); + ogs_yaml_iter_t gummei_array, gummei_iter; + ogs_yaml_iter_recurse(&mme_iter, &gummei_array); do { served_gummei_t *gummei = NULL; - d_assert(self.max_num_of_served_gummei <= - MAX_NUM_OF_SERVED_GUMMEI, return CORE_ERROR,); + ogs_assert(self.max_num_of_served_gummei <= + MAX_NUM_OF_SERVED_GUMMEI); gummei = &self.served_gummei[ self.max_num_of_served_gummei]; - d_assert(gummei, return CORE_ERROR,); + ogs_assert(gummei); - if (yaml_iter_type(&gummei_array) == + if (ogs_yaml_iter_type(&gummei_array) == YAML_MAPPING_NODE) { memcpy(&gummei_iter, &gummei_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&gummei_array) == + else if (ogs_yaml_iter_type(&gummei_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&gummei_array)) + if (!ogs_yaml_iter_next(&gummei_array)) break; - yaml_iter_recurse(&gummei_array, + ogs_yaml_iter_recurse(&gummei_array, &gummei_iter); } - else if (yaml_iter_type(&gummei_array) == + else if (ogs_yaml_iter_type(&gummei_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&gummei_iter)) + while(ogs_yaml_iter_next(&gummei_iter)) { const char *gummei_key = - yaml_iter_key(&gummei_iter); - d_assert(gummei_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&gummei_iter); + ogs_assert(gummei_key); if (!strcmp(gummei_key, "plmn_id")) { - yaml_iter_t plmn_id_array, plmn_id_iter; - yaml_iter_recurse(&gummei_iter, &plmn_id_array); + ogs_yaml_iter_t plmn_id_array, plmn_id_iter; + ogs_yaml_iter_recurse(&gummei_iter, &plmn_id_array); do { plmn_id_t *plmn_id = NULL; const char *mcc = NULL, *mnc = NULL; - d_assert(gummei->num_of_plmn_id <= - MAX_PLMN_ID, return CORE_ERROR,); + ogs_assert(gummei->num_of_plmn_id <= + MAX_PLMN_ID); plmn_id = &gummei->plmn_id[ gummei->num_of_plmn_id]; - d_assert(plmn_id, return CORE_ERROR,); + ogs_assert(plmn_id); - if (yaml_iter_type(&plmn_id_array) == + if (ogs_yaml_iter_type(&plmn_id_array) == YAML_MAPPING_NODE) { memcpy(&plmn_id_iter, &plmn_id_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&plmn_id_array) == + else if (ogs_yaml_iter_type(&plmn_id_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&plmn_id_array)) + if (!ogs_yaml_iter_next(&plmn_id_array)) break; - yaml_iter_recurse(&plmn_id_array, + ogs_yaml_iter_recurse(&plmn_id_array, &plmn_id_iter); } - else if (yaml_iter_type(&plmn_id_array) == + else if (ogs_yaml_iter_type(&plmn_id_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&plmn_id_iter)) + while(ogs_yaml_iter_next(&plmn_id_iter)) { const char *plmn_id_key = - yaml_iter_key(&plmn_id_iter); - d_assert(plmn_id_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&plmn_id_iter); + ogs_assert(plmn_id_key); if (!strcmp(plmn_id_key, "mcc")) { mcc = - yaml_iter_value(&plmn_id_iter); + ogs_yaml_iter_value(&plmn_id_iter); } else if (!strcmp(plmn_id_key, "mnc")) { mnc = - yaml_iter_value(&plmn_id_iter); + ogs_yaml_iter_value(&plmn_id_iter); } } @@ -865,81 +845,81 @@ status_t mme_context_parse_config() gummei->num_of_plmn_id++; } - } while(yaml_iter_type(&plmn_id_array) == + } while(ogs_yaml_iter_type(&plmn_id_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(gummei_key, "mme_gid")) { - yaml_iter_t mme_gid_iter; - yaml_iter_recurse(&gummei_iter, &mme_gid_iter); - d_assert(yaml_iter_type(&mme_gid_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t mme_gid_iter; + ogs_yaml_iter_recurse(&gummei_iter, &mme_gid_iter); + ogs_assert(ogs_yaml_iter_type(&mme_gid_iter) != + YAML_MAPPING_NODE); do { - c_uint16_t *mme_gid = NULL; + uint16_t *mme_gid = NULL; const char *v = NULL; - d_assert(gummei->num_of_mme_gid <= - GRP_PER_MME, return CORE_ERROR,); + ogs_assert(gummei->num_of_mme_gid <= + GRP_PER_MME); mme_gid = &gummei->mme_gid[ gummei->num_of_mme_gid]; - d_assert(mme_gid, return CORE_ERROR,); + ogs_assert(mme_gid); - if (yaml_iter_type(&mme_gid_iter) == + if (ogs_yaml_iter_type(&mme_gid_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&mme_gid_iter)) + if (!ogs_yaml_iter_next(&mme_gid_iter)) break; } - v = yaml_iter_value(&mme_gid_iter); + v = ogs_yaml_iter_value(&mme_gid_iter); if (v) { *mme_gid = atoi(v); gummei->num_of_mme_gid++; } } while( - yaml_iter_type(&mme_gid_iter) == + ogs_yaml_iter_type(&mme_gid_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gummei_key, "mme_code")) { - yaml_iter_t mme_code_iter; - yaml_iter_recurse(&gummei_iter, &mme_code_iter); - d_assert(yaml_iter_type(&mme_code_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t mme_code_iter; + ogs_yaml_iter_recurse(&gummei_iter, &mme_code_iter); + ogs_assert(ogs_yaml_iter_type(&mme_code_iter) != + YAML_MAPPING_NODE); do { - c_uint8_t *mme_code = NULL; + uint8_t *mme_code = NULL; const char *v = NULL; - d_assert(gummei->num_of_mme_code <= - CODE_PER_MME, return CORE_ERROR,); + ogs_assert(gummei->num_of_mme_code <= + CODE_PER_MME); mme_code = &gummei->mme_code[ gummei->num_of_mme_code]; - d_assert(mme_code, return CORE_ERROR,); + ogs_assert(mme_code); - if (yaml_iter_type(&mme_code_iter) == + if (ogs_yaml_iter_type(&mme_code_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&mme_code_iter)) + if (!ogs_yaml_iter_next(&mme_code_iter)) break; } - v = yaml_iter_value(&mme_code_iter); + v = ogs_yaml_iter_value(&mme_code_iter); if (v) { *mme_code = atoi(v); gummei->num_of_mme_code++; } } while( - yaml_iter_type(&mme_code_iter) == + ogs_yaml_iter_type(&mme_code_iter) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", gummei_key); + ogs_warn("unknown key `%s`", gummei_key); } if (gummei->num_of_plmn_id && @@ -949,7 +929,7 @@ status_t mme_context_parse_config() } else { - d_warn("Ignore gummei : " + ogs_warn("Ignore gummei : " "plmn_id(%d), mme_gid(%d), mme_code(%d)", gummei->num_of_plmn_id, gummei->num_of_mme_gid, gummei->num_of_mme_code); @@ -957,7 +937,7 @@ status_t mme_context_parse_config() gummei->num_of_mme_gid = 0; gummei->num_of_mme_code = 0; } - } while(yaml_iter_type(&gummei_array) == + } while(ogs_yaml_iter_type(&gummei_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(mme_key, "tai")) @@ -966,97 +946,96 @@ status_t mme_context_parse_config() tai0_list_t *list0 = NULL; tai2_list_t *list2 = NULL; - d_assert(self.num_of_served_tai <= - MAX_NUM_OF_SERVED_TAI, return CORE_ERROR,); + ogs_assert(self.num_of_served_tai <= + MAX_NUM_OF_SERVED_TAI); list0 = &self.served_tai[self.num_of_served_tai].list0; - d_assert(list0, return CORE_ERROR,); + ogs_assert(list0); list2 = &self.served_tai[self.num_of_served_tai].list2; - d_assert(list2, return CORE_ERROR,); + ogs_assert(list2); - yaml_iter_t tai_array, tai_iter; - yaml_iter_recurse(&mme_iter, &tai_array); + ogs_yaml_iter_t tai_array, tai_iter; + ogs_yaml_iter_recurse(&mme_iter, &tai_array); do { const char *mcc = NULL, *mnc = NULL; - c_uint16_t tac[MAX_NUM_OF_TAI]; + uint16_t tac[MAX_NUM_OF_TAI]; int num_of_tac = 0; - if (yaml_iter_type(&tai_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(&tai_array) == YAML_MAPPING_NODE) { - memcpy(&tai_iter, &tai_array, sizeof(yaml_iter_t)); + memcpy(&tai_iter, &tai_array, sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&tai_array) == + else if (ogs_yaml_iter_type(&tai_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&tai_array)) + if (!ogs_yaml_iter_next(&tai_array)) break; - yaml_iter_recurse(&tai_array, + ogs_yaml_iter_recurse(&tai_array, &tai_iter); } - else if (yaml_iter_type(&tai_array) == YAML_SCALAR_NODE) + else if (ogs_yaml_iter_type(&tai_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&tai_iter)) + while(ogs_yaml_iter_next(&tai_iter)) { - const char *tai_key = yaml_iter_key(&tai_iter); - d_assert(tai_key, return CORE_ERROR,); + const char *tai_key = ogs_yaml_iter_key(&tai_iter); + ogs_assert(tai_key); if (!strcmp(tai_key, "plmn_id")) { - yaml_iter_t plmn_id_iter; + ogs_yaml_iter_t plmn_id_iter; - yaml_iter_recurse(&tai_iter, &plmn_id_iter); - while(yaml_iter_next(&plmn_id_iter)) + ogs_yaml_iter_recurse(&tai_iter, &plmn_id_iter); + while(ogs_yaml_iter_next(&plmn_id_iter)) { const char *plmn_id_key = - yaml_iter_key(&plmn_id_iter); - d_assert(plmn_id_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&plmn_id_iter); + ogs_assert(plmn_id_key); if (!strcmp(plmn_id_key, "mcc")) { - mcc = yaml_iter_value(&plmn_id_iter); + mcc = ogs_yaml_iter_value(&plmn_id_iter); } else if (!strcmp(plmn_id_key, "mnc")) { - mnc = yaml_iter_value(&plmn_id_iter); + mnc = ogs_yaml_iter_value(&plmn_id_iter); } } } else if (!strcmp(tai_key, "tac")) { - yaml_iter_t tac_iter; - yaml_iter_recurse(&tai_iter, &tac_iter); - d_assert(yaml_iter_type(&tac_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t tac_iter; + ogs_yaml_iter_recurse(&tai_iter, &tac_iter); + ogs_assert(ogs_yaml_iter_type(&tac_iter) != + YAML_MAPPING_NODE); do { const char *v = NULL; - d_assert(num_of_tac <= - MAX_NUM_OF_TAI, return CORE_ERROR,); - if (yaml_iter_type(&tac_iter) == + ogs_assert(num_of_tac <= + MAX_NUM_OF_TAI); + if (ogs_yaml_iter_type(&tac_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&tac_iter)) + if (!ogs_yaml_iter_next(&tac_iter)) break; } - v = yaml_iter_value(&tac_iter); + v = ogs_yaml_iter_value(&tac_iter); if (v) { tac[num_of_tac] = atoi(v); num_of_tac++; } } while( - yaml_iter_type(&tac_iter) == + ogs_yaml_iter_type(&tac_iter) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", tai_key); + ogs_warn("unknown key `%s`", tai_key); } if (mcc && mnc && num_of_tac) @@ -1093,10 +1072,10 @@ status_t mme_context_parse_config() } else { - d_warn("Ignore tai : mcc(%p), mnc(%p), " + ogs_warn("Ignore tai : mcc(%p), mnc(%p), " "num_of_tac(%d)", mcc, mnc, num_of_tac); } - } while(yaml_iter_type(&tai_array) == + } while(ogs_yaml_iter_type(&tai_array) == YAML_SEQUENCE_NODE); if (list2->num || num_of_list0) @@ -1106,33 +1085,33 @@ status_t mme_context_parse_config() } else if (!strcmp(mme_key, "security")) { - yaml_iter_t security_iter; - yaml_iter_recurse(&mme_iter, &security_iter); - while(yaml_iter_next(&security_iter)) + ogs_yaml_iter_t security_iter; + ogs_yaml_iter_recurse(&mme_iter, &security_iter); + while(ogs_yaml_iter_next(&security_iter)) { const char *security_key = - yaml_iter_key(&security_iter); - d_assert(security_key, return CORE_ERROR,); + ogs_yaml_iter_key(&security_iter); + ogs_assert(security_key); if (!strcmp(security_key, "integrity_order")) { - yaml_iter_t integrity_order_iter; - yaml_iter_recurse(&security_iter, + ogs_yaml_iter_t integrity_order_iter; + ogs_yaml_iter_recurse(&security_iter, &integrity_order_iter); - d_assert(yaml_iter_type(&integrity_order_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_assert(ogs_yaml_iter_type(&integrity_order_iter) != + YAML_MAPPING_NODE); do { const char *v = NULL; - if (yaml_iter_type(&integrity_order_iter) == + if (ogs_yaml_iter_type(&integrity_order_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&integrity_order_iter)) + if (!ogs_yaml_iter_next(&integrity_order_iter)) break; } - v = yaml_iter_value(&integrity_order_iter); + v = ogs_yaml_iter_value(&integrity_order_iter); if (v) { int integrity_index = @@ -1163,29 +1142,29 @@ status_t mme_context_parse_config() } } } while( - yaml_iter_type(&integrity_order_iter) == + ogs_yaml_iter_type(&integrity_order_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(security_key, "ciphering_order")) { - yaml_iter_t ciphering_order_iter; - yaml_iter_recurse(&security_iter, + ogs_yaml_iter_t ciphering_order_iter; + ogs_yaml_iter_recurse(&security_iter, &ciphering_order_iter); - d_assert(yaml_iter_type(&ciphering_order_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_assert(ogs_yaml_iter_type(&ciphering_order_iter) != + YAML_MAPPING_NODE); do { const char *v = NULL; - if (yaml_iter_type(&ciphering_order_iter) == + if (ogs_yaml_iter_type(&ciphering_order_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&ciphering_order_iter)) + if (!ogs_yaml_iter_next(&ciphering_order_iter)) break; } - v = yaml_iter_value(&ciphering_order_iter); + v = ogs_yaml_iter_value(&ciphering_order_iter); if (v) { int ciphering_index = @@ -1216,30 +1195,29 @@ status_t mme_context_parse_config() } } } while( - yaml_iter_type(&ciphering_order_iter) == + ogs_yaml_iter_type(&ciphering_order_iter) == YAML_SEQUENCE_NODE); } } } else if(!strcmp(mme_key, "network_name")) { - yaml_iter_t network_name_iter; - yaml_iter_recurse(&mme_iter, &network_name_iter); + ogs_yaml_iter_t network_name_iter; + ogs_yaml_iter_recurse(&mme_iter, &network_name_iter); - while(yaml_iter_next(&network_name_iter)) + while(ogs_yaml_iter_next(&network_name_iter)) { const char *network_name_key = - yaml_iter_key(&network_name_iter); - d_assert(network_name_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&network_name_iter); + ogs_assert(network_name_key); if (!strcmp(network_name_key, "full")) { nas_network_name_t *network_full_name = &self.full_name; const char *c_network_name = - yaml_iter_value(&network_name_iter); - c_uint8_t size = strlen(c_network_name); - c_uint8_t i; + ogs_yaml_iter_value(&network_name_iter); + uint8_t size = strlen(c_network_name); + uint8_t i; for(i = 0;iparameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(sgw, return CORE_ERROR,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(sgw); sgw->num_of_tac = num_of_tac; if (num_of_tac != 0) memcpy(sgw->tac, tac, sizeof(sgw->tac)); - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); - } while(yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); } else if(!strcmp(mme_key, "selection_mode")) { const char *selection_mode = - yaml_iter_value(&mme_iter); + ogs_yaml_iter_value(&mme_iter); if (!strcmp(selection_mode, "rr")) self.sgw_selection = SGW_SELECT_RR; else if (!strcmp(selection_mode, "tac")) self.sgw_selection = SGW_SELECT_TAC; else - d_warn("unknown sgw_selection mode `%s`", + ogs_warn("unknown sgw_selection mode `%s`", selection_mode); } } } else if (!strcmp(root_key, "pgw")) { - yaml_iter_t mme_iter; - yaml_iter_recurse(&root_iter, &mme_iter); - while(yaml_iter_next(&mme_iter)) + ogs_yaml_iter_t mme_iter; + ogs_yaml_iter_recurse(&root_iter, &mme_iter); + while(ogs_yaml_iter_next(&mme_iter)) { - const char *mme_key = yaml_iter_key(&mme_iter); - d_assert(mme_key, return CORE_ERROR,); + const char *mme_key = ogs_yaml_iter_key(&mme_iter); + ogs_assert(mme_key); if (!strcmp(mme_key, "gtpc")) { - yaml_iter_t gtpc_array, gtpc_iter; - yaml_iter_recurse(&mme_iter, >pc_array); + ogs_yaml_iter_t gtpc_array, gtpc_iter; + ogs_yaml_iter_recurse(&mme_iter, >pc_array); do { mme_pgw_t *pgw = NULL; - c_sockaddr_t *list = NULL; + ogs_sockaddr_t *list = NULL; int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.gtpc_port; + uint16_t port = self.gtpc_port; - if (yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) { memcpy(>pc_iter, >pc_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(>pc_array)) + if (!ogs_yaml_iter_next(>pc_array)) break; - yaml_iter_recurse(>pc_array, >pc_iter); + ogs_yaml_iter_recurse(>pc_array, >pc_iter); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(>pc_iter)) + while(ogs_yaml_iter_next(>pc_iter)) { const char *gtpc_key = - yaml_iter_key(>pc_iter); - d_assert(gtpc_key, - return CORE_ERROR,); + ogs_yaml_iter_key(>pc_iter); + ogs_assert(gtpc_key); if (!strcmp(gtpc_key, "family")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -1502,417 +1477,303 @@ status_t mme_context_parse_config() else if (!strcmp(gtpc_key, "addr") || !strcmp(gtpc_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(>pc_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(>pc_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gtpc_key, "port")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) port = atoi(v); } else - d_warn("unknown key `%s`", gtpc_key); + ogs_warn("unknown key `%s`", gtpc_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } pgw = mme_pgw_add(list, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(pgw, return CORE_ERROR,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(pgw); - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); - } while(yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); } } } } rv = mme_context_validation(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; -} - -status_t mme_context_setup_trace_module() -{ - int app = context_self()->logger.trace.app; - int s1ap = context_self()->logger.trace.s1ap; - int nas = context_self()->logger.trace.nas; - int diameter = context_self()->logger.trace.diameter; - int gtpv2 = context_self()->logger.trace.gtpv2; - - if (app) - { - extern int _mme_context; - d_trace_level(&_mme_context, app); - extern int _mme_sm; - d_trace_level(&_mme_sm, app); - } - - if (s1ap) - { - extern int _s1ap_sm; - d_trace_level(&_s1ap_sm, s1ap); - extern int _s1ap_build; - d_trace_level(&_s1ap_build, s1ap); - extern int _s1ap_conv; - d_trace_level(&_s1ap_conv, s1ap); - extern int _s1ap_handler; - d_trace_level(&_s1ap_handler, s1ap); - extern int _s1ap_sctp; - d_trace_level(&_s1ap_sctp, s1ap); - extern int _s1ap_path; - d_trace_level(&_s1ap_path, s1ap); - extern int _s1ap_decoder; - d_trace_level(&_s1ap_decoder, s1ap); - extern int _s1ap_encoder; - d_trace_level(&_s1ap_encoder, s1ap); - } - - if (nas) - { - extern int _emm_sm; - d_trace_level(&_emm_sm, nas); - extern int _esm_sm; - d_trace_level(&_esm_sm, nas); - extern int _emm_build; - d_trace_level(&_emm_build, nas); - extern int _esm_build; - d_trace_level(&_esm_build, nas); - extern int _emm_handler; - d_trace_level(&_emm_handler, nas); - extern int _esm_handler; - d_trace_level(&_esm_handler, nas); - extern int _nas_path; - d_trace_level(&_nas_path, nas); - extern int _nas_decoder; - d_trace_level(&_nas_decoder, nas); - extern int _nas_encoder; - d_trace_level(&_nas_encoder, nas); - extern int _nas_ies; - d_trace_level(&_nas_ies, nas); - } - - if (diameter) - { - extern int _mme_fd_path; - d_trace_level(&_mme_fd_path, diameter); - extern int _fd_init; - d_trace_level(&_fd_init, diameter); - extern int _fd_logger; - d_trace_level(&_fd_logger, diameter); - } - - if (gtpv2) - { - extern int _mme_s11_handler; - d_trace_level(&_mme_s11_handler, gtpv2); - extern int _mme_gtp_path; - d_trace_level(&_mme_gtp_path, gtpv2); - - extern int _gtp_node; - d_trace_level(&_gtp_node, gtpv2); - extern int _gtp_message; - d_trace_level(&_gtp_message, gtpv2); - extern int _gtp_path; - d_trace_level(&_gtp_path, gtpv2); - extern int _gtp_xact; - d_trace_level(&_gtp_xact, gtpv2); - - extern int _tlv_msg; - d_trace_level(&_tlv_msg, gtpv2); - } - - return CORE_OK; + return OGS_OK; } mme_sgw_t *mme_sgw_add( - c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4) + ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4) { - status_t rv; + int rv; mme_sgw_t *sgw = NULL; - d_assert(all_list, return NULL, "Null param"); + ogs_assert(all_list); - pool_alloc_node(&mme_sgw_pool, &sgw); - d_assert(sgw, return NULL, "Null param"); + ogs_pool_alloc(&mme_sgw_pool, &sgw); + ogs_assert(sgw); memset(sgw, 0, sizeof *sgw); rv = gtp_create_node(&sgw->gnode, all_list, no_ipv4, no_ipv6, prefer_ipv4); - d_assert(rv == CORE_OK, return NULL,); + ogs_assert(rv == OGS_OK); if (sgw->gnode == NULL) { - d_error("Invalid Parameter : " + ogs_error("Invalid Parameter : " "no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]", no_ipv4, no_ipv6, prefer_ipv4); return NULL; } - list_append(&self.sgw_list, sgw); + ogs_list_add(&self.sgw_list, sgw); return sgw; } -status_t mme_sgw_remove(mme_sgw_t *sgw) +int mme_sgw_remove(mme_sgw_t *sgw) { - status_t rv; - d_assert(sgw, return CORE_ERROR, "Null param"); + int rv; + ogs_assert(sgw); - list_remove(&self.sgw_list, sgw); + ogs_list_remove(&self.sgw_list, sgw); rv = gtp_delete_node(sgw->gnode); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); - pool_free_node(&mme_sgw_pool, sgw); + ogs_pool_free(&mme_sgw_pool, sgw); - return CORE_OK; + return OGS_OK; } -status_t mme_sgw_remove_all() +void mme_sgw_remove_all() { mme_sgw_t *sgw = NULL, *next_sgw = NULL; - sgw = list_first(&self.sgw_list); - while (sgw) - { - next_sgw = list_next(sgw); - + ogs_list_for_each_safe(&self.sgw_list, next_sgw, sgw) mme_sgw_remove(sgw); - - sgw = next_sgw; - } - - return CORE_OK; } mme_pgw_t *mme_pgw_add( - c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4) + ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4) { - status_t rv; + int rv; mme_pgw_t *pgw = NULL; - d_assert(all_list, return NULL, "Null param"); + ogs_assert(all_list); - pool_alloc_node(&mme_pgw_pool, &pgw); - d_assert(pgw, return NULL, "Null param"); + ogs_pool_alloc(&mme_pgw_pool, &pgw); + ogs_assert(pgw); rv = gtp_create_node(&pgw->gnode, all_list, no_ipv4, no_ipv6, prefer_ipv4); - d_assert(rv == CORE_OK, return NULL,); + ogs_assert(rv == OGS_OK); if (pgw->gnode == NULL) { - d_error("Invalid Parameter : " + ogs_error("Invalid Parameter : " "no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]", no_ipv4, no_ipv6, prefer_ipv4); return NULL; } - list_append(&self.pgw_list, pgw); + ogs_list_add(&self.pgw_list, pgw); return pgw; } -status_t mme_pgw_remove(mme_pgw_t *pgw) +int mme_pgw_remove(mme_pgw_t *pgw) { - status_t rv; - d_assert(pgw, return CORE_ERROR, "Null param"); + int rv; + ogs_assert(pgw); - list_remove(&self.pgw_list, pgw); + ogs_list_remove(&self.pgw_list, pgw); rv = gtp_delete_node(pgw->gnode); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); - pool_free_node(&mme_pgw_pool, pgw); + ogs_pool_free(&mme_pgw_pool, pgw); - return CORE_OK; + return OGS_OK; } -status_t mme_pgw_remove_all() +void mme_pgw_remove_all() { mme_pgw_t *pgw = NULL, *next_pgw = NULL; - pgw = list_first(&self.pgw_list); - while (pgw) - { - next_pgw = list_next(pgw); - + ogs_list_for_each_safe(&self.pgw_list, next_pgw, pgw) mme_pgw_remove(pgw); - - pgw = next_pgw; - } - - return CORE_OK; } -mme_enb_t* mme_enb_add(sock_id sock, c_sockaddr_t *addr) +mme_enb_t *mme_enb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr) { mme_enb_t *enb = NULL; - event_t e; + mme_event_t e; - d_assert(sock, return NULL,); - d_assert(addr, return NULL,); + ogs_assert(sock); + ogs_assert(addr); - index_alloc(&mme_enb_pool, &enb); - d_assert(enb, return NULL, "Null param"); + ogs_pool_alloc(&mme_enb_pool, &enb); + ogs_assert(enb); enb->sock = sock; enb->addr = addr; enb->sock_type = mme_enb_sock_type(enb->sock); - enb->outbound_streams = context_self()->parameter.sctp_streams; + enb->outbound_streams = context_self()->config.parameter.sctp_streams; - list_init(&enb->enb_ue_list); + ogs_list_init(&enb->enb_ue_list); - hash_set(self.enb_sock_hash, &enb->sock, sizeof(enb->sock), enb); - hash_set(self.enb_addr_hash, enb->addr, sizeof(c_sockaddr_t), enb); + ogs_hash_set(self.enb_sock_hash, enb->sock, sizeof(ogs_sock_t), enb); + ogs_hash_set(self.enb_addr_hash, enb->addr, sizeof(ogs_sockaddr_t), enb); + +#if HAVE_USRSCTP != 1 + enb->poll = ogs_pollset_add(mme_self()->pollset, + OGS_POLLIN, sock->fd, s1ap_recv_handler, sock); + ogs_assert(enb->poll); +#endif - event_set_param1(&e, (c_uintptr_t)enb->index); - fsm_create(&enb->sm, s1ap_state_initial, s1ap_state_final); - fsm_init(&enb->sm, &e); + e.enb = enb; + ogs_fsm_create(&enb->sm, s1ap_state_initial, s1ap_state_final); + ogs_fsm_init(&enb->sm, &e); return enb; } -status_t mme_enb_remove(mme_enb_t *enb) +int mme_enb_remove(mme_enb_t *enb) { - event_t e; + mme_event_t e; - d_assert(enb, return CORE_ERROR, "Null param"); - d_assert(enb->sock, return CORE_ERROR, "Null param"); + ogs_assert(enb); + ogs_assert(enb->sock); - event_set_param1(&e, (c_uintptr_t)enb->index); - fsm_final(&enb->sm, &e); - fsm_clear(&enb->sm); + e.enb = enb; + ogs_fsm_fini(&enb->sm, &e); + ogs_fsm_delete(&enb->sm); - hash_set(self.enb_sock_hash, &enb->sock, sizeof(enb->sock), NULL); - hash_set(self.enb_addr_hash, enb->addr, sizeof(c_sockaddr_t), NULL); - hash_set(self.enb_id_hash, &enb->enb_id, sizeof(enb->enb_id), NULL); + ogs_hash_set(self.enb_sock_hash, enb->sock, sizeof(ogs_sock_t), NULL); + ogs_hash_set(self.enb_addr_hash, enb->addr, sizeof(ogs_sockaddr_t), NULL); + ogs_hash_set(self.enb_id_hash, &enb->enb_id, sizeof(enb->enb_id), NULL); enb_ue_remove_in_enb(enb); - CORE_FREE(enb->addr); +#if HAVE_USRSCTP != 1 + ogs_pollset_remove(enb->poll); +#endif - index_free(&mme_enb_pool, enb); + if (enb->sock_type == SOCK_STREAM) + s1ap_closesocket(enb->sock); - return CORE_OK; + ogs_free(enb->addr); + + ogs_pool_free(&mme_enb_pool, enb); + + return OGS_OK; } -status_t mme_enb_remove_all() +int mme_enb_remove_all() { - hash_index_t *hi = NULL; + ogs_hash_index_t *hi = NULL; mme_enb_t *enb = NULL; for (hi = mme_enb_first(); hi; hi = mme_enb_next(hi)) { enb = mme_enb_this(hi); - - if (enb->sock_type == SOCK_STREAM) - s1ap_delete(enb->sock); - mme_enb_remove(enb); } - return CORE_OK; + return OGS_OK; } -mme_enb_t* mme_enb_find(index_t index) +mme_enb_t* mme_enb_find_by_sock(ogs_sock_t *sock) { - d_assert(index, return NULL, "Invalid Index"); - return index_find(&mme_enb_pool, index); -} - -mme_enb_t* mme_enb_find_by_sock(sock_id sock) -{ - d_assert(sock, return NULL,"Invalid param"); - return (mme_enb_t *)hash_get(self.enb_sock_hash, &sock, sizeof(sock)); + ogs_assert(sock); + return (mme_enb_t *)ogs_hash_get(self.enb_sock_hash, sock, sizeof(ogs_sock_t)); return NULL; } -mme_enb_t* mme_enb_find_by_addr(c_sockaddr_t *addr) +mme_enb_t* mme_enb_find_by_addr(ogs_sockaddr_t *addr) { - d_assert(addr, return NULL,"Invalid param"); - return (mme_enb_t *)hash_get(self.enb_addr_hash, - addr, sizeof(c_sockaddr_t)); + ogs_assert(addr); + return (mme_enb_t *)ogs_hash_get(self.enb_addr_hash, + addr, sizeof(ogs_sockaddr_t)); return NULL; } -mme_enb_t* mme_enb_find_by_enb_id(c_uint32_t enb_id) +mme_enb_t* mme_enb_find_by_enb_id(uint32_t enb_id) { - return (mme_enb_t *)hash_get(self.enb_id_hash, &enb_id, sizeof(enb_id)); + return (mme_enb_t *)ogs_hash_get(self.enb_id_hash, &enb_id, sizeof(enb_id)); } -status_t mme_enb_set_enb_id(mme_enb_t *enb, c_uint32_t enb_id) +int mme_enb_set_enb_id(mme_enb_t *enb, uint32_t enb_id) { - d_assert(enb, return CORE_ERROR, "Invalid param"); + ogs_assert(enb); enb->enb_id = enb_id; - hash_set(self.enb_id_hash, &enb->enb_id, sizeof(enb->enb_id), enb); + ogs_hash_set(self.enb_id_hash, &enb->enb_id, sizeof(enb->enb_id), enb); - return CORE_OK; + return OGS_OK; } -hash_index_t* mme_enb_first() +ogs_hash_index_t* mme_enb_first() { - d_assert(self.enb_sock_hash, return NULL, "Null param"); - return hash_first(self.enb_sock_hash); + ogs_assert(self.enb_sock_hash); + return ogs_hash_first(self.enb_sock_hash); } -hash_index_t* mme_enb_next(hash_index_t *hi) +ogs_hash_index_t* mme_enb_next(ogs_hash_index_t *hi) { - return hash_next(hi); + return ogs_hash_next(hi); } -mme_enb_t *mme_enb_this(hash_index_t *hi) +mme_enb_t *mme_enb_this(ogs_hash_index_t *hi) { - d_assert(hi, return NULL, "Null param"); - return hash_this_val(hi); + ogs_assert(hi); + return ogs_hash_this_val(hi); } -int mme_enb_sock_type(sock_id sock) +int mme_enb_sock_type(ogs_sock_t *sock) { - sock_node_t *snode = NULL; + ogs_socknode_t *snode = NULL; - d_assert(sock, return SOCK_STREAM,); + ogs_assert(sock); - for (snode = list_first(&mme_self()->s1ap_list); - snode; snode = list_next(snode)) - { + ogs_list_for_each(&mme_self()->s1ap_list, snode) if (snode->sock == sock) return SOCK_SEQPACKET; - } - for (snode = list_first(&mme_self()->s1ap_list6); - snode; snode = list_next(snode)) - { + + ogs_list_for_each(&mme_self()->s1ap_list6, snode) if (snode->sock == sock) return SOCK_SEQPACKET; - } return SOCK_STREAM; } @@ -1922,61 +1783,51 @@ enb_ue_t* enb_ue_add(mme_enb_t *enb) { enb_ue_t *enb_ue = NULL; - d_assert(self.mme_ue_s1ap_id_hash, return NULL, "Null param"); - d_assert(enb, return NULL, "Null param"); + ogs_assert(self.mme_ue_s1ap_id_hash); + ogs_assert(enb); - index_alloc(&enb_ue_pool, &enb_ue); - d_assert(enb_ue, return NULL, "Null param"); + ogs_pool_alloc(&enb_ue_pool, &enb_ue); + ogs_assert(enb_ue); enb_ue->enb_ue_s1ap_id = INVALID_UE_S1AP_ID; enb_ue->mme_ue_s1ap_id = NEXT_ID(self.mme_ue_s1ap_id, 1, 0xffffffff); enb_ue->enb = enb; - hash_set(self.mme_ue_s1ap_id_hash, &enb_ue->mme_ue_s1ap_id, + ogs_hash_set(self.mme_ue_s1ap_id_hash, &enb_ue->mme_ue_s1ap_id, sizeof(enb_ue->mme_ue_s1ap_id), enb_ue); - list_append(&enb->enb_ue_list, enb_ue); - - /* Create S1 holding timer */ - enb_ue->holding_timer = timer_create(&self.tm_service, - MME_EVT_S1AP_S1_HOLDING_TIMER, self.s1_holding_timer_value * 1000); - d_assert(enb_ue->holding_timer, return NULL, "Null param"); - timer_set_param1(enb_ue->holding_timer, enb_ue->index); + ogs_list_add(&enb->enb_ue_list, enb_ue); return enb_ue; - } unsigned int enb_ue_count() { - d_assert(self.mme_ue_s1ap_id_hash, return 0, "Null param"); - return hash_count(self.mme_ue_s1ap_id_hash); + ogs_assert(self.mme_ue_s1ap_id_hash); + return ogs_hash_count(self.mme_ue_s1ap_id_hash); } -status_t enb_ue_remove(enb_ue_t *enb_ue) +int enb_ue_remove(enb_ue_t *enb_ue) { - status_t rv; + int rv; - d_assert(self.mme_ue_s1ap_id_hash, return CORE_ERROR, "Null param"); - d_assert(enb_ue, return CORE_ERROR, "Null param"); - d_assert(enb_ue->enb, return CORE_ERROR, "Null param"); + ogs_assert(self.mme_ue_s1ap_id_hash); + ogs_assert(enb_ue); + ogs_assert(enb_ue->enb); /* De-associate S1 with NAS/EMM */ rv = enb_ue_deassociate(enb_ue); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); - /* Delete All Timers */ - tm_delete(enb_ue->holding_timer); - - list_remove(&enb_ue->enb->enb_ue_list, enb_ue); - hash_set(self.mme_ue_s1ap_id_hash, &enb_ue->mme_ue_s1ap_id, + ogs_list_remove(&enb_ue->enb->enb_ue_list, enb_ue); + ogs_hash_set(self.mme_ue_s1ap_id_hash, &enb_ue->mme_ue_s1ap_id, sizeof(enb_ue->mme_ue_s1ap_id), NULL); - index_free(&enb_ue_pool, enb_ue); + ogs_pool_free(&enb_ue_pool, enb_ue); - return CORE_OK; + return OGS_OK; } -status_t enb_ue_remove_in_enb(mme_enb_t *enb) +int enb_ue_remove_in_enb(mme_enb_t *enb) { enb_ue_t *enb_ue = NULL, *next_enb_ue = NULL; @@ -1990,35 +1841,29 @@ status_t enb_ue_remove_in_enb(mme_enb_t *enb) enb_ue = next_enb_ue; } - return CORE_OK; + return OGS_OK; } -status_t enb_ue_switch_to_enb(enb_ue_t *enb_ue, mme_enb_t *new_enb) +int enb_ue_switch_to_enb(enb_ue_t *enb_ue, mme_enb_t *new_enb) { - d_assert(enb_ue, return CORE_ERROR, "Null param"); - d_assert(enb_ue->enb, return CORE_ERROR, "Null param"); - d_assert(new_enb, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); + ogs_assert(enb_ue->enb); + ogs_assert(new_enb); /* Remove from the old enb */ - list_remove(&enb_ue->enb->enb_ue_list, enb_ue); + ogs_list_remove(&enb_ue->enb->enb_ue_list, enb_ue); /* Add to the new enb */ - list_append(&new_enb->enb_ue_list, enb_ue); + ogs_list_add(&new_enb->enb_ue_list, enb_ue); /* Switch to enb */ enb_ue->enb = new_enb; - return CORE_OK; -} - -enb_ue_t* enb_ue_find(index_t index) -{ - d_assert(index, return NULL, "Invalid Index"); - return index_find(&enb_ue_pool, index); + return OGS_OK; } enb_ue_t* enb_ue_find_by_enb_ue_s1ap_id( - mme_enb_t *enb, c_uint32_t enb_ue_s1ap_id) + mme_enb_t *enb, uint32_t enb_ue_s1ap_id) { enb_ue_t *enb_ue = NULL; @@ -2034,46 +1879,42 @@ enb_ue_t* enb_ue_find_by_enb_ue_s1ap_id( return enb_ue; } -enb_ue_t* enb_ue_find_by_mme_ue_s1ap_id(c_uint32_t mme_ue_s1ap_id) +enb_ue_t* enb_ue_find_by_mme_ue_s1ap_id(uint32_t mme_ue_s1ap_id) { - d_assert(self.mme_ue_s1ap_id_hash, return NULL, "Null param"); - return hash_get(self.mme_ue_s1ap_id_hash, + ogs_assert(self.mme_ue_s1ap_id_hash); + return ogs_hash_get(self.mme_ue_s1ap_id_hash, &mme_ue_s1ap_id, sizeof(mme_ue_s1ap_id)); } enb_ue_t* enb_ue_first_in_enb(mme_enb_t *enb) { - return list_first(&enb->enb_ue_list); + return ogs_list_first(&enb->enb_ue_list); } enb_ue_t* enb_ue_next_in_enb(enb_ue_t *enb_ue) { - return list_next(enb_ue); + return ogs_list_next(enb_ue); } -static status_t mme_ue_new_guti(mme_ue_t *mme_ue) +static int mme_ue_new_guti(mme_ue_t *mme_ue) { served_gummei_t *served_gummei = NULL; - d_assert(mme_ue, return CORE_ERROR, "Invalid param"); - d_assert(mme_self()->max_num_of_served_gummei > 0, - return CORE_ERROR, "Invalid param"); + ogs_assert(mme_ue); + ogs_assert(mme_self()->max_num_of_served_gummei > 0); served_gummei = &mme_self()->served_gummei[0]; - d_assert(served_gummei->num_of_plmn_id > 0, - return CORE_ERROR, "Invalid param"); - d_assert(served_gummei->num_of_mme_gid > 0, - return CORE_ERROR, "Invalid param"); - d_assert(served_gummei->num_of_mme_code > 0, - return CORE_ERROR, "Invalid param"); + ogs_assert(served_gummei->num_of_plmn_id > 0); + ogs_assert(served_gummei->num_of_mme_gid > 0); + ogs_assert(served_gummei->num_of_mme_code > 0); if (mme_ue->m_tmsi) { /* MME has a VALID GUIT * As such, we need to remove previous GUTI in hash table */ - hash_set(self.guti_ue_hash, &mme_ue->guti, sizeof(guti_t), NULL); - d_assert(mme_m_tmsi_free(mme_ue->m_tmsi) == CORE_OK,,); + ogs_hash_set(self.guti_ue_hash, &mme_ue->guti, sizeof(guti_t), NULL); + ogs_assert(mme_m_tmsi_free(mme_ue->m_tmsi) == OGS_OK); } memset(&mme_ue->guti, 0, sizeof(guti_t)); @@ -2084,33 +1925,35 @@ static status_t mme_ue_new_guti(mme_ue_t *mme_ue) mme_ue->guti.mme_code = served_gummei->mme_code[0]; mme_ue->m_tmsi = mme_m_tmsi_alloc(); - d_assert(mme_ue->m_tmsi, return CORE_ERROR,); + ogs_assert(mme_ue->m_tmsi); mme_ue->guti.m_tmsi = *(mme_ue->m_tmsi); - hash_set(self.guti_ue_hash, &mme_ue->guti, sizeof(guti_t), mme_ue); + ogs_hash_set(self.guti_ue_hash, &mme_ue->guti, sizeof(guti_t), mme_ue); - return CORE_OK; + return OGS_OK; } mme_ue_t* mme_ue_add(enb_ue_t *enb_ue) { mme_enb_t *enb = NULL; mme_ue_t *mme_ue = NULL; - event_t e; + mme_event_t e; - d_assert(enb_ue, return NULL,); + ogs_assert(enb_ue); enb = enb_ue->enb; - d_assert(enb, return NULL,); + ogs_assert(enb); - index_alloc(&mme_ue_pool, &mme_ue); - d_assert(mme_ue, return NULL, "Null param"); + ogs_pool_alloc(&mme_ue_pool, &mme_ue); + ogs_assert(mme_ue); - list_init(&mme_ue->sess_list); + ogs_list_init(&mme_ue->sess_list); - mme_ue->mme_s11_teid = mme_ue->index; + mme_ue->mme_s11_teid = ogs_pool_index(&mme_ue_pool, mme_ue); + ogs_assert(mme_ue->mme_s11_teid > 0 && + mme_ue->mme_s11_teid <= MAX_POOL_OF_UE); /* * SCTP output stream identification - * Default context_self()->parameter.sctp_streams : 30 + * Default context_self()->config.parameter.sctp_streams : 30 * 0 : Non UE signalling * 1-29 : UE specific association */ @@ -2123,68 +1966,65 @@ mme_ue_t* mme_ue_add(enb_ue_t *enb_ue) { /* Setup SGW with round-robin manner */ if (mme_self()->sgw == NULL) - mme_self()->sgw = list_first(&mme_self()->sgw_list); + mme_self()->sgw = ogs_list_first(&mme_self()->sgw_list); - d_assert(mme_self()->sgw, return NULL,); + ogs_assert(mme_self()->sgw); SETUP_GTP_NODE(mme_ue, mme_self()->sgw->gnode); - mme_self()->sgw = list_next(mme_self()->sgw); + mme_self()->sgw = ogs_list_next(mme_self()->sgw); } else if (mme_self()->sgw_selection == SGW_SELECT_TAC) { /* Select SGW by eNB TAC */ int i, found = 0; - mme_self()->sgw = list_first(&mme_self()->sgw_list); + mme_self()->sgw = ogs_list_first(&mme_self()->sgw_list); while(mme_self()->sgw && !found) { for (i = 0; i < mme_self()->sgw->num_of_tac && !found; i++) found = mme_self()->sgw->tac[i] == enb_ue->nas.tai.tac ? 1: 0; if (!found) - mme_self()->sgw = list_next(mme_self()->sgw); + mme_self()->sgw = ogs_list_next(mme_self()->sgw); } - d_assert(mme_self()->sgw, return NULL,); + ogs_assert(mme_self()->sgw); SETUP_GTP_NODE(mme_ue, mme_self()->sgw->gnode); } else - d_assert(0, return NULL, "Invalid Selection Mode: %d", - mme_self()->sgw_selection); + ogs_assert_if_reached(); /* Create paging retry timer */ - mme_ue->t3413 = timer_create(&self.tm_service, MME_EVT_EMM_T3413, - self.t3413_value * 1000); - d_assert(mme_ue->t3413, return NULL, "Null param"); - timer_set_param1(mme_ue->t3413, mme_ue->index); + mme_ue->t3413 = ogs_timer_add(self.timer_mgr, s1ap_t3413_timeout, mme_ue); + ogs_assert(mme_ue->t3413); - event_set_param1(&e, (c_uintptr_t)mme_ue->index); - fsm_create(&mme_ue->sm, emm_state_initial, emm_state_final); - fsm_init(&mme_ue->sm, &e); + e.mme_ue = mme_ue; + ogs_fsm_create(&mme_ue->sm, emm_state_initial, emm_state_final); + ogs_fsm_init(&mme_ue->sm, &e); return mme_ue; } -status_t mme_ue_remove(mme_ue_t *mme_ue) +int mme_ue_remove(mme_ue_t *mme_ue) { - status_t rv; - event_t e; + int rv; + mme_event_t e; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - event_set_param1(&e, (c_uintptr_t)mme_ue->index); - fsm_final(&mme_ue->sm, &e); - fsm_clear(&mme_ue->sm); + e.mme_ue = mme_ue; + ogs_fsm_fini(&mme_ue->sm, &e); + ogs_fsm_delete(&mme_ue->sm); /* Clear hash table */ if (mme_ue->m_tmsi) { - hash_set(self.guti_ue_hash, &mme_ue->guti, sizeof(guti_t), NULL); - d_assert(mme_m_tmsi_free(mme_ue->m_tmsi) == CORE_OK,,); + ogs_hash_set(self.guti_ue_hash, &mme_ue->guti, sizeof(guti_t), NULL); + ogs_assert(mme_m_tmsi_free(mme_ue->m_tmsi) == OGS_OK); } if (mme_ue->imsi_len != 0) - hash_set(self.imsi_ue_hash, mme_ue->imsi, mme_ue->imsi_len, NULL); + ogs_hash_set(self.imsi_ue_hash, mme_ue->imsi, mme_ue->imsi_len, NULL); /* Clear the saved PDN Connectivity Request */ NAS_CLEAR_DATA(&mme_ue->pdn_connectivity_request); @@ -2199,22 +2039,22 @@ status_t mme_ue_remove(mme_ue_t *mme_ue) S1AP_CLEAR_DATA(&mme_ue->container); /* Delete All Timers */ - tm_delete(mme_ue->t3413); + ogs_timer_delete(mme_ue->t3413); rv = mme_ue_deassociate(mme_ue); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); mme_sess_remove_all(mme_ue); mme_pdn_remove_all(mme_ue); - index_free(&mme_ue_pool, mme_ue); + ogs_pool_free(&mme_ue_pool, mme_ue); - return CORE_OK; + return OGS_OK; } -status_t mme_ue_remove_all() +int mme_ue_remove_all() { - hash_index_t *hi = NULL; + ogs_hash_index_t *hi = NULL; mme_ue_t *mme_ue = NULL; for (hi = mme_ue_first(); hi; hi = mme_ue_next(hi)) @@ -2223,61 +2063,55 @@ status_t mme_ue_remove_all() mme_ue_remove(mme_ue); } - return CORE_OK; + return OGS_OK; } -mme_ue_t* mme_ue_find(index_t index) +mme_ue_t* mme_ue_find_by_imsi_bcd(char *imsi_bcd) { - d_assert(index, return NULL, "Invalid Index"); - return index_find(&mme_ue_pool, index); -} - -mme_ue_t* mme_ue_find_by_imsi_bcd(c_int8_t *imsi_bcd) -{ - c_uint8_t imsi[MAX_IMSI_LEN]; + uint8_t imsi[MAX_IMSI_LEN]; int imsi_len = 0; - d_assert(imsi_bcd, return NULL,"Invalid param"); + ogs_assert(imsi_bcd); - core_bcd_to_buffer(imsi_bcd, imsi, &imsi_len); + ogs_bcd_to_buffer(imsi_bcd, imsi, &imsi_len); return mme_ue_find_by_imsi(imsi, imsi_len); } -mme_ue_t* mme_ue_find_by_imsi(c_uint8_t *imsi, int imsi_len) +mme_ue_t* mme_ue_find_by_imsi(uint8_t *imsi, int imsi_len) { - d_assert(imsi && imsi_len, return NULL,"Invalid param"); + ogs_assert(imsi && imsi_len); - return (mme_ue_t *)hash_get(self.imsi_ue_hash, imsi, imsi_len); + return (mme_ue_t *)ogs_hash_get(self.imsi_ue_hash, imsi, imsi_len); } mme_ue_t* mme_ue_find_by_guti(guti_t *guti) { - d_assert(guti, return NULL,"Invalid param"); + ogs_assert(guti); - return (mme_ue_t *)hash_get(self.guti_ue_hash, guti, sizeof(guti_t)); + return (mme_ue_t *)ogs_hash_get(self.guti_ue_hash, guti, sizeof(guti_t)); } -mme_ue_t* mme_ue_find_by_teid(c_uint32_t teid) +mme_ue_t* mme_ue_find_by_teid(uint32_t teid) { - return mme_ue_find(teid); + return ogs_pool_find(&mme_ue_pool, teid); } -hash_index_t *mme_ue_first() +ogs_hash_index_t *mme_ue_first() { - d_assert(self.imsi_ue_hash, return NULL, "Null param"); - return hash_first(self.imsi_ue_hash); + ogs_assert(self.imsi_ue_hash); + return ogs_hash_first(self.imsi_ue_hash); } -hash_index_t *mme_ue_next(hash_index_t *hi) +ogs_hash_index_t *mme_ue_next(ogs_hash_index_t *hi) { - return hash_next(hi); + return ogs_hash_next(hi); } -mme_ue_t *mme_ue_this(hash_index_t *hi) +mme_ue_t *mme_ue_this(ogs_hash_index_t *hi) { - d_assert(hi, return NULL, "Null param"); - return hash_this_val(hi); + ogs_assert(hi); + return ogs_hash_this_val(hi); } mme_ue_t* mme_ue_find_by_message(nas_message_t *message) @@ -2298,7 +2132,7 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) { case NAS_EPS_MOBILE_IDENTITY_IMSI: { - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; nas_imsi_to_bcd( &eps_mobile_identity->imsi, eps_mobile_identity->length, @@ -2308,11 +2142,11 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) mme_ue = mme_ue_find_by_imsi_bcd(imsi_bcd); if (mme_ue) { - d_trace(9, "known UE by IMSI[%s]\n", imsi_bcd); + ogs_trace("known UE by IMSI[%s]", imsi_bcd); } else { - d_trace(9, "Unknown UE by IMSI[%s]\n", imsi_bcd); + ogs_trace("Unknown UE by IMSI[%s]", imsi_bcd); } break; } @@ -2330,14 +2164,14 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) mme_ue = mme_ue_find_by_guti(&guti); if (mme_ue) { - d_trace(9, "Known UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]\n", + ogs_trace("Known UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]", guti.mme_gid, guti.mme_code, guti.m_tmsi); } else { - d_warn("Unknown UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]", + ogs_warn("Unknown UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]", guti.mme_gid, guti.mme_code, guti.m_tmsi); @@ -2346,7 +2180,7 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) } default: { - d_error("Uknown message imsi type =%d\n", + ogs_error("Uknown message imsi type =%d", eps_mobile_identity->imsi.type); break; } @@ -2382,14 +2216,14 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) mme_ue = mme_ue_find_by_guti(&guti); if (mme_ue) { - d_trace(9, "Known UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]\n", + ogs_trace("Known UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]", guti.mme_gid, guti.mme_code, guti.m_tmsi); } else { - d_warn("Unknown UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]", + ogs_warn("Unknown UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]", guti.mme_gid, guti.mme_code, guti.m_tmsi); @@ -2398,7 +2232,7 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) } default: { - d_error("Uknown message imsi type =%d\n", + ogs_error("Uknown message imsi type =%d", eps_mobile_identity->imsi.type); break; } @@ -2414,18 +2248,18 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message) return mme_ue; } -status_t mme_ue_set_imsi(mme_ue_t *mme_ue, c_int8_t *imsi_bcd) +int mme_ue_set_imsi(mme_ue_t *mme_ue, char *imsi_bcd) { - d_assert(mme_ue && imsi_bcd, return CORE_ERROR, "Invalid param"); + ogs_assert(mme_ue && imsi_bcd); - core_cpystrn(mme_ue->imsi_bcd, imsi_bcd, MAX_IMSI_BCD_LEN+1); - core_bcd_to_buffer(mme_ue->imsi_bcd, mme_ue->imsi, &mme_ue->imsi_len); + ogs_cpystrn(mme_ue->imsi_bcd, imsi_bcd, MAX_IMSI_BCD_LEN+1); + ogs_bcd_to_buffer(mme_ue->imsi_bcd, mme_ue->imsi, &mme_ue->imsi_len); - hash_set(self.imsi_ue_hash, mme_ue->imsi, mme_ue->imsi_len, mme_ue); + ogs_hash_set(self.imsi_ue_hash, mme_ue->imsi, mme_ue->imsi_len, mme_ue); mme_ue->guti_present = 1; - return CORE_OK; + return OGS_OK; } int mme_ue_have_indirect_tunnel(mme_ue_t *mme_ue) @@ -2454,11 +2288,11 @@ int mme_ue_have_indirect_tunnel(mme_ue_t *mme_ue) return 0; } -status_t mme_ue_clear_indirect_tunnel(mme_ue_t *mme_ue) +int mme_ue_clear_indirect_tunnel(mme_ue_t *mme_ue) { mme_sess_t *sess = NULL; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); sess = mme_sess_first(mme_ue); while(sess) @@ -2473,66 +2307,66 @@ status_t mme_ue_clear_indirect_tunnel(mme_ue_t *mme_ue) sess = mme_sess_next(sess); } - return CORE_OK; + return OGS_OK; } -status_t mme_ue_associate_enb_ue(mme_ue_t *mme_ue, enb_ue_t *enb_ue) +int mme_ue_associate_enb_ue(mme_ue_t *mme_ue, enb_ue_t *enb_ue) { - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(enb_ue); mme_ue->enb_ue = enb_ue; enb_ue->mme_ue = mme_ue; - return CORE_OK; + return OGS_OK; } -status_t enb_ue_deassociate(enb_ue_t *enb_ue) +int enb_ue_deassociate(enb_ue_t *enb_ue) { - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); enb_ue->mme_ue = NULL; - return CORE_OK; + return OGS_OK; } -status_t mme_ue_deassociate(mme_ue_t *mme_ue) +int mme_ue_deassociate(mme_ue_t *mme_ue) { - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); mme_ue->enb_ue = NULL; - return CORE_OK; + return OGS_OK; } -status_t source_ue_associate_target_ue( +int source_ue_associate_target_ue( enb_ue_t *source_ue, enb_ue_t *target_ue) { mme_ue_t *mme_ue = NULL; - d_assert(source_ue, return CORE_ERROR, "Null param"); - d_assert(target_ue, return CORE_ERROR, "Null param"); + ogs_assert(source_ue); + ogs_assert(target_ue); mme_ue = source_ue->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); target_ue->mme_ue = mme_ue; target_ue->source_ue = source_ue; source_ue->target_ue = target_ue; - return CORE_OK; + return OGS_OK; } -status_t source_ue_deassociate_target_ue(enb_ue_t *enb_ue) +int source_ue_deassociate_target_ue(enb_ue_t *enb_ue) { enb_ue_t *source_ue = NULL; enb_ue_t *target_ue = NULL; - d_assert(enb_ue, return CORE_ERROR,); + ogs_assert(enb_ue); if (enb_ue->target_ue) { source_ue = enb_ue; target_ue = enb_ue->target_ue; - d_assert(source_ue->target_ue, return CORE_ERROR,); - d_assert(target_ue->source_ue, return CORE_ERROR,); + ogs_assert(source_ue->target_ue); + ogs_assert(target_ue->source_ue); source_ue->target_ue = NULL; target_ue->source_ue = NULL; } @@ -2541,59 +2375,57 @@ status_t source_ue_deassociate_target_ue(enb_ue_t *enb_ue) target_ue = enb_ue; source_ue = enb_ue->source_ue; - d_assert(source_ue->target_ue, return CORE_ERROR,); - d_assert(target_ue->source_ue, return CORE_ERROR,); + ogs_assert(source_ue->target_ue); + ogs_assert(target_ue->source_ue); source_ue->target_ue = NULL; target_ue->source_ue = NULL; } - return CORE_OK; + return OGS_OK; } -mme_sess_t *mme_sess_add(mme_ue_t *mme_ue, c_uint8_t pti) +mme_sess_t *mme_sess_add(mme_ue_t *mme_ue, uint8_t pti) { mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - d_assert(mme_ue, return NULL, "Null param"); - d_assert(pti != NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED, - return NULL, "Invalid PTI(%d)", pti); + ogs_assert(mme_ue); + ogs_assert(pti != NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED); - index_alloc(&mme_sess_pool, &sess); - d_assert(sess, return NULL, "Null param"); + ogs_pool_alloc(&mme_sess_pool, &sess); + ogs_assert(sess); - list_init(&sess->bearer_list); + ogs_list_init(&sess->bearer_list); sess->mme_ue = mme_ue; sess->pti = pti; bearer = mme_bearer_add(sess); - d_assert(bearer, mme_sess_remove(sess); return NULL, - "Can't add default bearer context"); + ogs_assert(bearer); - list_append(&mme_ue->sess_list, sess); + ogs_list_add(&mme_ue->sess_list, sess); return sess; } -status_t mme_sess_remove(mme_sess_t *sess) +int mme_sess_remove(mme_sess_t *sess) { - d_assert(sess, return CORE_ERROR, "Null param"); - d_assert(sess->mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(sess); + ogs_assert(sess->mme_ue); - list_remove(&sess->mme_ue->sess_list, sess); + ogs_list_remove(&sess->mme_ue->sess_list, sess); mme_bearer_remove_all(sess); NAS_CLEAR_DATA(&sess->ue_pco); TLV_CLEAR_DATA(&sess->pgw_pco); - index_free(&mme_sess_pool, sess); + ogs_pool_free(&mme_sess_pool, sess); - return CORE_OK; + return OGS_OK; } -status_t mme_sess_remove_all(mme_ue_t *mme_ue) +int mme_sess_remove_all(mme_ue_t *mme_ue) { mme_sess_t *sess = NULL, *next_sess = NULL; @@ -2607,16 +2439,10 @@ status_t mme_sess_remove_all(mme_ue_t *mme_ue) sess = next_sess; } - return CORE_OK; + return OGS_OK; } -mme_sess_t* mme_sess_find(index_t index) -{ - d_assert(index, return NULL, "Invalid Index"); - return index_find(&mme_sess_pool, index); -} - -mme_sess_t* mme_sess_find_by_pti(mme_ue_t *mme_ue, c_uint8_t pti) +mme_sess_t* mme_sess_find_by_pti(mme_ue_t *mme_ue, uint8_t pti) { mme_sess_t *sess = NULL; @@ -2632,7 +2458,7 @@ mme_sess_t* mme_sess_find_by_pti(mme_ue_t *mme_ue, c_uint8_t pti) return NULL; } -mme_sess_t* mme_sess_find_by_ebi(mme_ue_t *mme_ue, c_uint8_t ebi) +mme_sess_t* mme_sess_find_by_ebi(mme_ue_t *mme_ue, uint8_t ebi) { mme_bearer_t *bearer = NULL; @@ -2643,7 +2469,7 @@ mme_sess_t* mme_sess_find_by_ebi(mme_ue_t *mme_ue, c_uint8_t ebi) return NULL; } -mme_sess_t* mme_sess_find_by_apn(mme_ue_t *mme_ue, c_int8_t *apn) +mme_sess_t* mme_sess_find_by_apn(mme_ue_t *mme_ue, char *apn) { mme_sess_t *sess = NULL; @@ -2661,12 +2487,12 @@ mme_sess_t* mme_sess_find_by_apn(mme_ue_t *mme_ue, c_int8_t *apn) mme_sess_t* mme_sess_first(mme_ue_t *mme_ue) { - return list_first(&mme_ue->sess_list); + return ogs_list_first(&mme_ue->sess_list); } mme_sess_t* mme_sess_next(mme_sess_t *sess) { - return list_next(sess); + return ogs_list_next(sess); } unsigned int mme_sess_count(mme_ue_t *mme_ue) @@ -2686,57 +2512,57 @@ unsigned int mme_sess_count(mme_ue_t *mme_ue) mme_bearer_t* mme_bearer_add(mme_sess_t *sess) { - event_t e; + mme_event_t e; mme_bearer_t *bearer = NULL; mme_ue_t *mme_ue = NULL; - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return NULL, "Null param"); + ogs_assert(mme_ue); - index_alloc(&mme_bearer_pool, &bearer); - d_assert(bearer, return NULL, "Null param"); + ogs_pool_alloc(&mme_bearer_pool, &bearer); + ogs_assert(bearer); bearer->ebi = NEXT_ID(mme_ue->ebi, MIN_EPS_BEARER_ID, MAX_EPS_BEARER_ID); bearer->mme_ue = mme_ue; bearer->sess = sess; - list_append(&sess->bearer_list, bearer); + ogs_list_add(&sess->bearer_list, bearer); - event_set_param1(&e, (c_uintptr_t)bearer->index); - fsm_create(&bearer->sm, esm_state_initial, esm_state_final); - fsm_init(&bearer->sm, &e); + e.bearer = bearer; + ogs_fsm_create(&bearer->sm, esm_state_initial, esm_state_final); + ogs_fsm_init(&bearer->sm, &e); return bearer; } -status_t mme_bearer_remove(mme_bearer_t *bearer) +int mme_bearer_remove(mme_bearer_t *bearer) { - event_t e; + mme_event_t e; - d_assert(bearer, return CORE_ERROR, "Null param"); - d_assert(bearer->sess, return CORE_ERROR, "Null param"); + ogs_assert(bearer); + ogs_assert(bearer->sess); - event_set_param1(&e, (c_uintptr_t)bearer->index); - fsm_final(&bearer->sm, &e); - fsm_clear(&bearer->sm); + e.bearer = bearer; + ogs_fsm_fini(&bearer->sm, &e); + ogs_fsm_delete(&bearer->sm); - list_remove(&bearer->sess->bearer_list, bearer); + ogs_list_remove(&bearer->sess->bearer_list, bearer); TLV_CLEAR_DATA(&bearer->tft); - index_free(&mme_bearer_pool, bearer); + ogs_pool_free(&mme_bearer_pool, bearer); - return CORE_OK; + return OGS_OK; } -status_t mme_bearer_remove_all(mme_sess_t *sess) +int mme_bearer_remove_all(mme_sess_t *sess) { mme_bearer_t *bearer = NULL, *next_bearer = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); bearer = mme_bearer_first(sess); while (bearer) @@ -2748,16 +2574,10 @@ status_t mme_bearer_remove_all(mme_sess_t *sess) bearer = next_bearer; } - return CORE_OK; + return OGS_OK; } -mme_bearer_t* mme_bearer_find(index_t index) -{ - d_assert(index, return NULL, "Invalid Index"); - return index_find(&mme_bearer_pool, index); -} - -mme_bearer_t* mme_bearer_find_by_sess_ebi(mme_sess_t *sess, c_uint8_t ebi) +mme_bearer_t* mme_bearer_find_by_sess_ebi(mme_sess_t *sess, uint8_t ebi) { mme_bearer_t *bearer = NULL; @@ -2773,7 +2593,7 @@ mme_bearer_t* mme_bearer_find_by_sess_ebi(mme_sess_t *sess, c_uint8_t ebi) return NULL; } -mme_bearer_t* mme_bearer_find_by_ue_ebi(mme_ue_t *mme_ue, c_uint8_t ebi) +mme_bearer_t* mme_bearer_find_by_ue_ebi(mme_ue_t *mme_ue, uint8_t ebi) { mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; @@ -2796,30 +2616,29 @@ mme_bearer_t* mme_bearer_find_by_ue_ebi(mme_ue_t *mme_ue, c_uint8_t ebi) mme_bearer_t* mme_bearer_find_or_add_by_message( mme_ue_t *mme_ue, nas_message_t *message) { - c_uint8_t pti = NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; - c_uint8_t ebi = NAS_EPS_BEARER_IDENTITY_UNASSIGNED; + uint8_t pti = NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; + uint8_t ebi = NAS_EPS_BEARER_IDENTITY_UNASSIGNED; mme_bearer_t *bearer = NULL; mme_sess_t *sess = NULL; - d_assert(mme_ue, return NULL,); - d_assert(message, return NULL,); + ogs_assert(mme_ue); + ogs_assert(message); pti = message->esm.h.procedure_transaction_identity; ebi = message->esm.h.eps_bearer_identity; - d_trace(9, "mme_bearer_find_or_add_by_message() [PTI:%d, EBI:%d]\n", + ogs_trace("mme_bearer_find_or_add_by_message() [PTI:%d, EBI:%d]", pti, ebi); if (ebi != NAS_EPS_BEARER_IDENTITY_UNASSIGNED) { bearer = mme_bearer_find_by_ue_ebi(mme_ue, ebi); - d_assert(bearer, return NULL, "No Bearer : [EBI:%d]", ebi); + ogs_assert(bearer); return bearer; } - d_assert(pti != NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED, - return NULL, "Invalid param : [PTI:%d, EBI:%d]", pti, ebi); + ogs_assert(pti != NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED); if (message->esm.h.message_type == NAS_PDN_CONNECTIVITY_REQUEST) { @@ -2837,7 +2656,7 @@ mme_bearer_t* mme_bearer_find_or_add_by_message( else sess->pti = pti; - d_assert(sess, return NULL, "No Session : [PTI:%d]", pti); + ogs_assert(sess); } else if (message->esm.h.message_type == NAS_PDN_DISCONNECT_REQUEST) { @@ -2848,12 +2667,9 @@ mme_bearer_t* mme_bearer_find_or_add_by_message( bearer = mme_bearer_find_by_ue_ebi(mme_ue, linked_eps_bearer_identity->eps_bearer_identity); - d_assert(bearer, return NULL, - "No Bearer : [Linked-EBI:%d, PTI:%d, EBI:%d]", - linked_eps_bearer_identity->eps_bearer_identity, - pti, ebi); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return NULL, "No Session : [PTI:%d]", pti); + ogs_assert(sess); sess->pti = pti; return bearer; @@ -2861,11 +2677,11 @@ mme_bearer_t* mme_bearer_find_or_add_by_message( else { sess = mme_sess_find_by_pti(mme_ue, pti); - d_assert(sess, return NULL, "No Session : [PTI:%d]", pti); + ogs_assert(sess); } bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, return NULL, "No Bearer : [EBI:%d]", ebi); + ogs_assert(bearer); return bearer; } @@ -2878,29 +2694,29 @@ mme_bearer_t* mme_linked_bearer(mme_bearer_t *bearer) { mme_sess_t *sess = NULL; - d_assert(bearer, return NULL, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); return mme_default_bearer_in_sess(sess); } mme_bearer_t* mme_bearer_first(mme_sess_t *sess) { - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); - return list_first(&sess->bearer_list); + return ogs_list_first(&sess->bearer_list); } mme_bearer_t* mme_bearer_next(mme_bearer_t *bearer) { - return list_next(bearer); + return ogs_list_next(bearer); } int mme_bearer_is_inactive(mme_ue_t *mme_ue) { mme_sess_t *sess = NULL; - d_assert(mme_ue, return 1,); + ogs_assert(mme_ue); sess = mme_sess_first(mme_ue); while(sess) @@ -2921,10 +2737,10 @@ int mme_bearer_is_inactive(mme_ue_t *mme_ue) return 1; } -status_t mme_bearer_set_inactive(mme_ue_t *mme_ue) +int mme_bearer_set_inactive(mme_ue_t *mme_ue) { mme_sess_t *sess = NULL; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); sess = mme_sess_first(mme_ue); while(sess) @@ -2939,31 +2755,31 @@ status_t mme_bearer_set_inactive(mme_ue_t *mme_ue) sess = mme_sess_next(sess); } - return CORE_OK; + return OGS_OK; } -status_t mme_pdn_remove_all(mme_ue_t *mme_ue) +int mme_pdn_remove_all(mme_ue_t *mme_ue) { s6a_subscription_data_t *subscription_data = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); subscription_data = &mme_ue->subscription_data; - d_assert(subscription_data, return CORE_ERROR, "Null param"); + ogs_assert(subscription_data); subscription_data->num_of_pdn = 0; - return CORE_OK; + return OGS_OK; } -pdn_t* mme_pdn_find_by_apn(mme_ue_t *mme_ue, c_int8_t *apn) +pdn_t* mme_pdn_find_by_apn(mme_ue_t *mme_ue, char *apn) { s6a_subscription_data_t *subscription_data = NULL; pdn_t *pdn = NULL; int i = 0; - d_assert(mme_ue, return NULL, "Null param"); + ogs_assert(mme_ue); subscription_data = &mme_ue->subscription_data; - d_assert(subscription_data, return NULL, "Null param"); + ogs_assert(subscription_data); for (i = 0; i < subscription_data->num_of_pdn; i++) { @@ -2981,9 +2797,9 @@ pdn_t* mme_default_pdn(mme_ue_t *mme_ue) pdn_t *pdn = NULL; int i = 0; - d_assert(mme_ue, return NULL, "Null param"); + ogs_assert(mme_ue); subscription_data = &mme_ue->subscription_data; - d_assert(subscription_data, return NULL, "Null param"); + ogs_assert(subscription_data); for (i = 0; i < subscription_data->num_of_pdn; i++) { @@ -2999,21 +2815,19 @@ int mme_find_served_tai(tai_t *tai) { int i = 0, j = 0, k = 0; - d_assert(tai, return -1,); + ogs_assert(tai); for (i = 0; i < self.num_of_served_tai; i++) { tai0_list_t *list0 = &self.served_tai[i].list0; - d_assert(list0, return -1,); + ogs_assert(list0); tai2_list_t *list2 = &self.served_tai[i].list2; - d_assert(list2, return -1,); + ogs_assert(list2); for (j = 0; list0->tai[j].num; j++) { - d_assert(list0->tai[j].type == TAI0_TYPE, - return -1, "type = %d", list0->tai[j].type); - d_assert(list0->tai[j].num < MAX_NUM_OF_TAI, - return -1, "num = %d", list0->tai[j].num); + ogs_assert(list0->tai[j].type == TAI0_TYPE); + ogs_assert(list0->tai[j].num < MAX_NUM_OF_TAI); for (k = 0; k < list0->tai[j].num; k++) { @@ -3028,10 +2842,8 @@ int mme_find_served_tai(tai_t *tai) if (list2->num) { - d_assert(list2->type == TAI1_TYPE || list2->type == TAI2_TYPE, - return -1, "type = %d", list2->type); - d_assert(list2->num < MAX_NUM_OF_TAI, - return -1, "num = %d", list2->num); + ogs_assert(list2->type == TAI1_TYPE || list2->type == TAI2_TYPE); + ogs_assert(list2->num < MAX_NUM_OF_TAI); for (j = 0; j < list2->num; j++) { @@ -3048,21 +2860,20 @@ int mme_find_served_tai(tai_t *tai) return -1; } -status_t mme_m_tmsi_pool_generate() +int mme_m_tmsi_pool_generate() { - status_t rv; int i, j; int index = 0; - d_trace(9, "M-TMSI Pool try to generate...\n"); + ogs_trace("M-TMSI Pool try to generate..."); for (i = 0; index < MAX_POOL_OF_UE; i++) { mme_m_tmsi_t *m_tmsi = NULL; int conflict = 0; - m_tmsi = &self.m_tmsi.pool[index]; - rv = core_generate_random_bytes((c_uint8_t *)m_tmsi, sizeof(*m_tmsi)); - d_assert(rv == CORE_OK, return CORE_ERROR, "Cannot generate random"); + m_tmsi = &self.m_tmsi.array[index]; + ogs_assert(m_tmsi); + *m_tmsi = ogs_random32(); /* for mapped-GUTI */ *m_tmsi |= 0xc0000000; @@ -3070,39 +2881,42 @@ status_t mme_m_tmsi_pool_generate() for (j = 0; j < index; j++) { - if (*m_tmsi == self.m_tmsi.pool[j]) + if (*m_tmsi == self.m_tmsi.array[j]) { conflict = 1; - d_trace(11, "[M-TMSI CONFLICT] %d:0x%x == %d:0x%x\n", - index, *m_tmsi, j, self.m_tmsi.pool[j]); + ogs_trace("[M-TMSI CONFLICT] %d:0x%x == %d:0x%x", + index, *m_tmsi, j, self.m_tmsi.array[j]); break; } } - if (conflict == 1) continue; + if (conflict == 1) + { + continue; + } index++; } self.m_tmsi.size = index; - d_trace(9, "M-TMSI Pool generate...done\n"); + ogs_trace("M-TMSI Pool generate...done"); - return CORE_OK; + return OGS_OK; } mme_m_tmsi_t *mme_m_tmsi_alloc() { mme_m_tmsi_t *m_tmsi = NULL; - pool_alloc_node(&self.m_tmsi, &m_tmsi); - d_assert(m_tmsi, return NULL,); + ogs_pool_alloc(&self.m_tmsi, &m_tmsi); + ogs_assert(m_tmsi); return m_tmsi; } -status_t mme_m_tmsi_free(mme_m_tmsi_t *m_tmsi) +int mme_m_tmsi_free(mme_m_tmsi_t *m_tmsi) { - d_assert(m_tmsi, return CORE_ERROR,); - pool_free_node(&self.m_tmsi, m_tmsi); + ogs_assert(m_tmsi); + ogs_pool_free(&self.m_tmsi, m_tmsi); - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/mme_context.h b/src/mme/mme_context.h index f52f0dffe..30d4289b7 100644 --- a/src/mme/mme_context.h +++ b/src/mme/mme_context.h @@ -1,21 +1,13 @@ #ifndef __MME_CONTEXT__ #define __MME_CONTEXT__ -#include "core_list.h" -#include "core_index.h" -#include "core_errno.h" -#include "core_sha2.h" -#include "core_hash.h" -#include "core_network.h" -#include "core_tlv_msg.h" -#include "core_fsm.h" -#include "core_msgq.h" -#include "core_timer.h" +#include "ogs-crypt.h" +#include "base/types.h" -#include "3gpp_types.h" -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #include "nas/nas_message.h" #include "fd/s6a/s6a_message.h" +#include "gtp/gtp_tlv.h" /* S1AP */ #include "S1AP_Cause.h" @@ -34,6 +26,13 @@ extern "C" { #define MAX_NUM_OF_BPLMN 6 +extern int __mme_log_domain; +extern int __emm_log_domain; +extern int __esm_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __mme_log_domain + typedef struct _mme_sgw_t mme_sgw_t; typedef struct _mme_pgw_t mme_pgw_t; @@ -45,7 +44,7 @@ typedef struct _gtp_xact_t gtp_xact_t; typedef struct _fd_config_t fd_config_t; -typedef c_uint32_t mme_m_tmsi_t; +typedef uint32_t mme_m_tmsi_t; typedef enum { SGW_SELECT_RR = 0, /* Default SGW Selection Method */ @@ -53,45 +52,45 @@ typedef enum { } sgw_select_e; typedef struct _served_gummei { - c_uint32_t num_of_plmn_id; + uint32_t num_of_plmn_id; plmn_id_t plmn_id[MAX_PLMN_ID]; - c_uint32_t num_of_mme_gid; - c_uint16_t mme_gid[GRP_PER_MME]; - c_uint32_t num_of_mme_code; - c_uint8_t mme_code[CODE_PER_MME]; + uint32_t num_of_mme_gid; + uint16_t mme_gid[GRP_PER_MME]; + uint32_t num_of_mme_code; + uint8_t mme_code[CODE_PER_MME]; } served_gummei_t; typedef struct _mme_context_t { const char *fd_conf_path; /* MME freeDiameter conf path */ fd_config_t *fd_config; /* MME freeDiameter config */ - c_uint16_t s1ap_port; /* Default S1AP Port */ - c_uint16_t gtpc_port; /* Default GTPC Port */ + uint16_t s1ap_port; /* Default S1AP Port */ + uint16_t gtpc_port; /* Default GTPC Port */ - list_t s1ap_list; /* MME S1AP IPv4 Server List */ - list_t s1ap_list6; /* MME S1AP IPv6 Server List */ + ogs_list_t s1ap_list; /* MME S1AP IPv4 Server List */ + ogs_list_t s1ap_list6; /* MME S1AP IPv6 Server List */ - list_t gtpc_list; /* MME GTPC IPv4 Server List */ - list_t gtpc_list6; /* MME GTPC IPv6 Server List */ - sock_id gtpc_sock; /* MME GTPC IPv4 Socket */ - sock_id gtpc_sock6; /* MME GTPC IPv6 Socket */ - c_sockaddr_t *gtpc_addr; /* MME GTPC IPv4 Address */ - c_sockaddr_t *gtpc_addr6; /* MME GTPC IPv6 Address */ + ogs_list_t gtpc_list; /* MME GTPC IPv4 Server List */ + ogs_list_t gtpc_list6; /* MME GTPC IPv6 Server List */ + ogs_sock_t *gtpc_sock; /* MME GTPC IPv4 Socket */ + ogs_sock_t *gtpc_sock6; /* MME GTPC IPv6 Socket */ + ogs_sockaddr_t *gtpc_addr; /* MME GTPC IPv4 Address */ + ogs_sockaddr_t *gtpc_addr6; /* MME GTPC IPv6 Address */ - list_t sgw_list; /* SGW GTPC Client List */ + ogs_list_t sgw_list; /* SGW GTPC Client List */ mme_sgw_t *sgw; /* Iterator for SGW round-robin */ - list_t pgw_list; /* PGW GTPC Client List */ - c_sockaddr_t *pgw_addr; /* First IPv4 Address Selected */ - c_sockaddr_t *pgw_addr6; /* First IPv6 Address Selected */ + ogs_list_t pgw_list; /* PGW GTPC Client List */ + ogs_sockaddr_t *pgw_addr; /* First IPv4 Address Selected */ + ogs_sockaddr_t *pgw_addr6; /* First IPv6 Address Selected */ /* Served GUMME */ - c_uint8_t max_num_of_served_gummei; + uint8_t max_num_of_served_gummei; served_gummei_t served_gummei[MAX_NUM_OF_SERVED_GUMMEI]; /* Served TAI */ - c_uint8_t num_of_served_tai; + uint8_t num_of_served_tai; struct { tai0_list_t list0; tai2_list_t list2; @@ -102,45 +101,40 @@ typedef struct _mme_context_t { * #define NAS_SECURITY_ALGORITHMS_128_EEA1 1 * #define NAS_SECURITY_ALGORITHMS_128_EEA2 2 * #define NAS_SECURITY_ALGORITHMS_128_EEA3 3 */ - c_uint8_t num_of_ciphering_order; - c_uint8_t ciphering_order[MAX_NUM_OF_ALGORITHM]; + uint8_t num_of_ciphering_order; + uint8_t ciphering_order[MAX_NUM_OF_ALGORITHM]; /* defined in 'nas_ies.h' * #define NAS_SECURITY_ALGORITHMS_EIA0 0 * #define NAS_SECURITY_ALGORITHMS_128_EIA1 1 * #define NAS_SECURITY_ALGORITHMS_128_EIA1 2 * #define NAS_SECURITY_ALGORITHMS_128_EIA3 3 */ - c_uint8_t num_of_integrity_order; - c_uint8_t integrity_order[MAX_NUM_OF_ALGORITHM]; + uint8_t num_of_integrity_order; + uint8_t integrity_order[MAX_NUM_OF_ALGORITHM]; /* S1SetupResponse */ - c_uint8_t relative_capacity; + uint8_t relative_capacity; /* Timer value */ - c_uint32_t t3413_value; /* Paging retry timer value */ - c_uint32_t s1_holding_timer_value; /* S1 holding timer value */ + ogs_time_t t3413_value; /* Paging retry timer value */ /* Generator for unique identification */ - c_uint32_t mme_ue_s1ap_id; /* mme_ue_s1ap_id generator */ - c_uint16_t ostream_id; /* ostream_id generator */ + uint32_t mme_ue_s1ap_id; /* mme_ue_s1ap_id generator */ + uint16_t ostream_id; /* ostream_id generator */ /* M-TMSI Pool */ - struct { - int head, tail; - int size, avail; - mutex_id mut; - mme_m_tmsi_t *free[MAX_POOL_OF_SESS], pool[MAX_POOL_OF_SESS]; - } m_tmsi; + OGS_POOL(m_tmsi, mme_m_tmsi_t); - hash_t *enb_sock_hash; /* hash table for ENB Socket */ - hash_t *enb_addr_hash; /* hash table for ENB Address */ - hash_t *enb_id_hash; /* hash table for ENB-ID */ - hash_t *mme_ue_s1ap_id_hash; /* hash table for MME-UE-S1AP-ID */ - hash_t *imsi_ue_hash; /* hash table (IMSI : MME_UE) */ - hash_t *guti_ue_hash; /* hash table (GUTI : MME_UE) */ + ogs_hash_t *enb_sock_hash; /* hash table for ENB Socket */ + ogs_hash_t *enb_addr_hash; /* hash table for ENB Address */ + ogs_hash_t *enb_id_hash; /* hash table for ENB-ID */ + ogs_hash_t *mme_ue_s1ap_id_hash; /* hash table for MME-UE-S1AP-ID */ + ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : MME_UE) */ + ogs_hash_t *guti_ue_hash; /* hash table (GUTI : MME_UE) */ /* System */ - msgq_id queue_id; /* Queue for processing MME control plane */ - tm_service_t tm_service; /* Timer Service */ + ogs_queue_t *queue; /* Queue for processing MME control */ + ogs_timer_mgr_t *timer_mgr; /* Timer Manager */ + ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */ /* Network Name */ nas_network_name_t short_name; /* Network short name */ @@ -152,46 +146,45 @@ typedef struct _mme_context_t { } mme_context_t; typedef struct _mme_sgw_t { - lnode_t node; + ogs_lnode_t node; - c_uint16_t tac[MAX_NUM_OF_TAI]; - c_uint8_t num_of_tac; + uint16_t tac[MAX_NUM_OF_TAI]; + uint8_t num_of_tac; gtp_node_t *gnode; } mme_sgw_t; typedef struct _mme_pgw_t { - lnode_t node; + ogs_lnode_t node; gtp_node_t *gnode; } mme_pgw_t; typedef struct _mme_enb_t { - index_t index; /* An index of this node */ - fsm_t sm; /* A state machine */ + ogs_fsm_t sm; /* A state machine */ - c_uint32_t enb_id; /* eNB_ID received from eNB */ + uint32_t enb_id; /* eNB_ID received from eNB */ int sock_type; /* SOCK_STREAM or SOCK_SEQPACKET */ - sock_id sock; /* eNB S1AP Socket */ - c_sockaddr_t *addr; /* eNB S1AP Address */ + ogs_sock_t *sock; /* eNB S1AP Socket */ + ogs_sockaddr_t *addr; /* eNB S1AP Address */ + ogs_poll_t *poll; /* eNB S1AP Poll */ - c_uint16_t outbound_streams; /* SCTP Max number of outbound streams */ + uint16_t outbound_streams; /* SCTP Max number of outbound streams */ - c_uint8_t num_of_supported_ta_list; + uint8_t num_of_supported_ta_list; tai_t supported_ta_list[MAX_NUM_OF_TAI * MAX_NUM_OF_BPLMN]; - list_t enb_ue_list; + ogs_list_t enb_ue_list; } mme_enb_t; struct _enb_ue_t { - lnode_t node; /* A node of list_t */ - index_t index; /* An index of this node */ + ogs_lnode_t node; /* A node of list_t */ /* UE identity */ #define INVALID_UE_S1AP_ID 0xffffffff /* Initial value of enb_ue_s1ap_id */ - c_uint32_t enb_ue_s1ap_id; /* eNB-UE-S1AP-ID received from eNB */ - c_uint32_t mme_ue_s1ap_id; /* MME-UE-S1AP-ID received from MME */ + uint32_t enb_ue_s1ap_id; /* eNB-UE-S1AP-ID received from eNB */ + uint32_t mme_ue_s1ap_id; /* MME-UE-S1AP-ID received from MME */ /* Handover Info */ S1AP_HandoverType_t handover_type; @@ -214,25 +207,7 @@ struct _enb_ue_t { #define S1AP_UE_CTX_REL_S1_NORMAL_RELEASE 2 #define S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE 3 #define S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL 4 - c_uint8_t ue_ctx_rel_action; - - /* - * S1 holding timer - * - * When eNodeB sends Attach Request, TAU Request, Service Request repeatly, - * S1(enb_ue_t) context is repeatly created. - * - * NAS(mme_ue_t) context is associated with last created S1(enb_ue_t) - * context, and older S1(enb_ue_t) context might not be freed. - * - * If NAS(mme_ue_t) has already been associated with - * older S1(enb_ue_t) context, the holding timer(30secs) is started. - * Newly associated S1(enb_ue_t) context holding timer is stopped. - * - * If the holding timer expires, - * S1(enb_ue_t) context will be implicitly deleted. - */ - tm_block_id holding_timer; + uint8_t ue_ctx_rel_action; /* Related Context */ mme_enb_t *enb; @@ -240,8 +215,7 @@ struct _enb_ue_t { }; struct _mme_ue_t { - index_t index; /* An index of this node */ - fsm_t sm; /* A state machine */ + ogs_fsm_t sm; /* A state machine */ struct { #define MME_EPS_TYPE_ATTACH_REQUEST 1 @@ -249,31 +223,31 @@ struct _mme_ue_t { #define MME_EPS_TYPE_SERVICE_REQUEST 3 #define MME_EPS_TYPE_DETACH_REQUEST_FROM_UE 4 #define MME_EPS_TYPE_DETACH_REQUEST_TO_UE 5 - c_uint8_t type; - c_uint8_t ksi; + uint8_t type; + uint8_t ksi; union { nas_eps_attach_type_t attach; nas_eps_update_type_t update; nas_detach_type_t detach; - c_uint8_t data; + uint8_t data; }; } nas_eps; /* UE identity */ #define MME_UE_HAVE_IMSI(__mME) \ ((__mME) && ((__mME)->imsi_len)) - c_uint8_t imsi[MAX_IMSI_LEN]; + uint8_t imsi[MAX_IMSI_LEN]; int imsi_len; - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; mme_m_tmsi_t *m_tmsi; guti_t guti; int guti_present; - c_uint32_t mme_s11_teid; /* MME-S11-TEID is derived from INDEX */ - c_uint32_t sgw_s11_teid; /* SGW-S11-TEID is received from SGW */ + uint32_t mme_s11_teid; /* MME-S11-TEID is derived from INDEX */ + uint32_t sgw_s11_teid; /* SGW-S11-TEID is received from SGW */ - c_uint16_t ostream_id; /* SCTP output stream identification */ + uint16_t ostream_id; /* SCTP output stream identification */ /* UE Info */ tai_t tai; @@ -287,7 +261,7 @@ struct _mme_ue_t { ((__mME)->nas_eps.ksi != NAS_KSI_NO_KEY_IS_AVAILABLE)) #define CLEAR_SECURITY_CONTEXT(__mME) \ do { \ - d_assert((__mME), break, "Null param"); \ + ogs_assert((__mME)); \ (__mME)->security_context_available = 0; \ (__mME)->mac_failed = 0; \ (__mME)->nas_eps.ksi = 0; \ @@ -298,41 +272,41 @@ struct _mme_ue_t { /* Security Context */ nas_ue_network_capability_t ue_network_capability; nas_ms_network_capability_t ms_network_capability; - c_uint8_t xres[MAX_RES_LEN]; - c_uint8_t xres_len; - c_uint8_t kasme[SHA256_DIGEST_SIZE]; - c_uint8_t rand[RAND_LEN]; - c_uint8_t knas_int[SHA256_DIGEST_SIZE/2]; - c_uint8_t knas_enc[SHA256_DIGEST_SIZE/2]; - c_uint32_t dl_count; + uint8_t xres[MAX_RES_LEN]; + uint8_t xres_len; + uint8_t kasme[OGS_SHA256_DIGEST_SIZE]; + uint8_t rand[RAND_LEN]; + uint8_t knas_int[OGS_SHA256_DIGEST_SIZE/2]; + uint8_t knas_enc[OGS_SHA256_DIGEST_SIZE/2]; + uint32_t dl_count; union { struct { - ED3(c_uint8_t spare;, - c_uint16_t overflow;, - c_uint8_t sqn;) + ED3(uint8_t spare;, + uint16_t overflow;, + uint8_t sqn;) } __attribute__ ((packed)); - c_uint32_t i32; + uint32_t i32; } ul_count; - c_uint8_t kenb[SHA256_DIGEST_SIZE]; + uint8_t kenb[OGS_SHA256_DIGEST_SIZE]; struct { - ED2(c_uint8_t nhcc_spare:5;, - c_uint8_t nhcc:3;) /* Next Hop Channing Counter */ + ED2(uint8_t nhcc_spare:5;, + uint8_t nhcc:3;) /* Next Hop Channing Counter */ }; - c_uint8_t nh[SHA256_DIGEST_SIZE]; /* NH Security Key */ + uint8_t nh[OGS_SHA256_DIGEST_SIZE]; /* NH Security Key */ /* defined in 'nas_ies.h' * #define NAS_SECURITY_ALGORITHMS_EIA0 0 * #define NAS_SECURITY_ALGORITHMS_128_EEA1 1 * #define NAS_SECURITY_ALGORITHMS_128_EEA2 2 * #define NAS_SECURITY_ALGORITHMS_128_EEA3 3 */ - c_uint8_t selected_enc_algorithm; + uint8_t selected_enc_algorithm; /* defined in 'nas_ies.h' * #define NAS_SECURITY_ALGORITHMS_EIA0 0 * #define NAS_SECURITY_ALGORITHMS_128_EIA1 1 * #define NAS_SECURITY_ALGORITHMS_128_EIA1 2 * #define NAS_SECURITY_ALGORITHMS_128_EIA3 3 */ - c_uint8_t selected_int_algorithm; + uint8_t selected_int_algorithm; /* HSS Info */ s6a_subscription_data_t subscription_data; @@ -343,15 +317,14 @@ struct _mme_ue_t { #define CLEAR_EPS_BEARER_ID(__mME) \ do { \ - d_assert((__mME), break, "Null param"); \ + ogs_assert((__mME)); \ (__mME)->ebi = MIN_EPS_BEARER_ID - 1; \ } while(0) - c_uint8_t ebi; /* EPS Bearer ID generator */ - list_t sess_list; + uint8_t ebi; /* EPS Bearer ID generator */ + ogs_list_t sess_list; #define ECM_CONNECTED(__mME) \ - ((__mME) && ((__mME)->enb_ue != NULL) && \ - enb_ue_find((__mME)->enb_ue->index)) + ((__mME) && ((__mME)->enb_ue != NULL)) #define ECM_IDLE(__mME) (!ECM_CONNECTED(__mME)) /* S1 UE context */ enb_ue_t *enb_ue; @@ -362,37 +335,37 @@ struct _mme_ue_t { /* Paging */ #define CLEAR_PAGING_INFO(__mME) \ do { \ - d_assert((__mME), break, "Null param"); \ + ogs_assert((__mME)); \ \ - tm_stop((__mME)->t3413); \ + ogs_timer_stop((__mME)->t3413); \ if ((__mME)->last_paging_msg) \ { \ - pkbuf_free((__mME)->last_paging_msg); \ + ogs_pkbuf_free((__mME)->last_paging_msg); \ (__mME)->last_paging_msg = NULL; \ } \ (__mME)->max_paging_retry = 0; \ } while(0); - pkbuf_t *last_paging_msg; - tm_block_id t3413; + ogs_pkbuf_t *last_paging_msg; + ogs_timer_t *t3413; #define MAX_NUM_OF_PAGING 2 - c_uint32_t max_paging_retry; + uint32_t max_paging_retry; /* UE Radio Capability */ OCTET_STRING_t ueRadioCapability; /* S1AP Transparent Container */ - OCTET_STRING_t container; + OCTET_STRING_t container; /* GTP Request/Response Counter */ #define GTP_COUNTER_INCREMENT(__mME, __tYPE) \ do { \ - d_assert((__mME), break,); \ + ogs_assert((__mME)); \ ((__mME)->gtp_counter[__tYPE].request)++; \ } while(0); #define GTP_COUNTER_CHECK(__mME, __tYPE, __eXPR) \ do { \ - d_assert((__mME), break,); \ + ogs_assert((__mME)); \ if ((__mME)->gtp_counter[__tYPE].request == 0) break; \ ((__mME)->gtp_counter[__tYPE].response)++; \ if (((__mME)->gtp_counter[__tYPE].request) == \ @@ -409,8 +382,8 @@ struct _mme_ue_t { #define GTP_COUNTER_MODIFY_BEARER_BY_PATH_SWITCH 1 #define GTP_COUNTER_MODIFY_BEARER_BY_HANDOVER_NOTIFY 2 struct { - c_uint8_t request; - c_uint8_t response; + uint8_t request; + uint8_t response; } gtp_counter[MAX_NUM_OF_GTP_COUNTER]; gtp_node_t *gnode; @@ -422,7 +395,7 @@ struct _mme_ue_t { #define CLEAR_SGW_S1U_PATH(__sESS) \ do { \ mme_bearer_t *__bEARER = NULL; \ - d_assert((__sESS), break, "Null param"); \ + ogs_assert((__sESS)); \ __bEARER = mme_default_bearer_in_sess(__sESS); \ __bEARER->sgw_s1u_teid = 0; \ } while(0) @@ -432,20 +405,19 @@ struct _mme_ue_t { #define CLEAR_SESSION_CONTEXT(__mME) \ do { \ - d_assert((__mME), break, "Null param"); \ + ogs_assert((__mME)); \ (__mME)->sgw_s11_teid = 0; \ } while(0) typedef struct _mme_sess_t { - lnode_t node; /* A node of list_t */ - index_t index; /* An index of this node */ + ogs_lnode_t node; /* A node of list_t */ - c_uint8_t pti; /* Procedure Trasaction Identity */ + uint8_t pti; /* Procedure Trasaction Identity */ /* PDN Connectivity Request */ nas_request_type_t request_type; /* mme_bearer_first(sess) : Default Bearer Context */ - list_t bearer_list; + ogs_list_t bearer_list; /* Related Context */ mme_ue_t *mme_ue; @@ -457,8 +429,8 @@ typedef struct _mme_sess_t { /* Save Protocol Configuration Options from UE */ struct { - c_uint8_t length; - c_uint8_t *buffer; + uint8_t length; + uint8_t *buffer; } ue_pco; /* Save Protocol Configuration Options from PGW */ @@ -474,7 +446,7 @@ typedef struct _mme_sess_t { ((__bEARER) && ((__bEARER)->enb_s1u_teid)) #define CLEAR_ENB_S1U_PATH(__bEARER) \ do { \ - d_assert((__bEARER), break, "Null param"); \ + ogs_assert((__bEARER)); \ (__bEARER)->enb_s1u_teid = 0; \ } while(0) @@ -488,35 +460,34 @@ typedef struct _mme_sess_t { ((__bEARER) && ((__bEARER)->sgw_ul_teid)) #define CLEAR_INDIRECT_TUNNEL(__bEARER) \ do { \ - d_assert((__bEARER), break, "Null param"); \ + ogs_assert((__bEARER)); \ (__bEARER)->enb_dl_teid = 0; \ (__bEARER)->enb_ul_teid = 0; \ (__bEARER)->sgw_dl_teid = 0; \ (__bEARER)->sgw_ul_teid = 0; \ } while(0) typedef struct _mme_bearer_t { - lnode_t node; /* A node of list_t */ - index_t index; /* An index of this node */ - fsm_t sm; /* State Machine */ + ogs_lnode_t node; /* A node of list_t */ + ogs_fsm_t sm; /* State Machine */ - c_uint8_t ebi; /* EPS Bearer ID */ + uint8_t ebi; /* EPS Bearer ID */ - c_uint32_t enb_s1u_teid; + uint32_t enb_s1u_teid; ip_t enb_s1u_ip; - c_uint32_t sgw_s1u_teid; + uint32_t sgw_s1u_teid; ip_t sgw_s1u_ip; - c_uint32_t target_s1u_teid; /* Target S1U TEID from HO-Req-Ack */ + uint32_t target_s1u_teid; /* Target S1U TEID from HO-Req-Ack */ ip_t target_s1u_ip; /* Target S1U ADDR from HO-Req-Ack */ - c_uint32_t enb_dl_teid; + uint32_t enb_dl_teid; ip_t enb_dl_ip; - c_uint32_t enb_ul_teid; + uint32_t enb_ul_teid; ip_t enb_ul_ip; - c_uint32_t sgw_dl_teid; + uint32_t sgw_dl_teid; ip_t sgw_dl_ip; - c_uint32_t sgw_ul_teid; + uint32_t sgw_ul_teid; ip_t sgw_ul_ip; qos_t qos; @@ -528,67 +499,59 @@ typedef struct _mme_bearer_t { gtp_xact_t *xact; } mme_bearer_t; -CORE_DECLARE(status_t) mme_context_init(void); -CORE_DECLARE(status_t) mme_context_final(void); -CORE_DECLARE(mme_context_t*) mme_self(void); +int mme_context_init(void); +int mme_context_final(void); +mme_context_t *mme_self(void); -CORE_DECLARE(status_t) mme_context_parse_config(void); -CORE_DECLARE(status_t) mme_context_setup_trace_module(void); +int mme_context_parse_config(void); -CORE_DECLARE(mme_sgw_t*) mme_sgw_add( - c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4); -CORE_DECLARE(status_t ) mme_sgw_remove(mme_sgw_t *sgw); -CORE_DECLARE(status_t ) mme_sgw_remove_all(); +mme_sgw_t *mme_sgw_add( + ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4); +int mme_sgw_remove(mme_sgw_t *sgw); +void mme_sgw_remove_all(); -CORE_DECLARE(mme_pgw_t*) mme_pgw_add( - c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4); -CORE_DECLARE(status_t ) mme_pgw_remove(mme_pgw_t *pgw); -CORE_DECLARE(status_t ) mme_pgw_remove_all(); +mme_pgw_t *mme_pgw_add( + ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4); +int mme_pgw_remove(mme_pgw_t *pgw); +void mme_pgw_remove_all(); -CORE_DECLARE(mme_enb_t*) mme_enb_add(sock_id sock, c_sockaddr_t *addr); -CORE_DECLARE(status_t) mme_enb_remove(mme_enb_t *enb); -CORE_DECLARE(status_t) mme_enb_remove_all(void); -CORE_DECLARE(mme_enb_t*) mme_enb_find(index_t index); -CORE_DECLARE(mme_enb_t*) mme_enb_find_by_sock(sock_id sock); -CORE_DECLARE(mme_enb_t*) mme_enb_find_by_addr(c_sockaddr_t *addr); -CORE_DECLARE(mme_enb_t*) mme_enb_find_by_enb_id(c_uint32_t enb_id); -CORE_DECLARE(status_t) mme_enb_set_enb_id( - mme_enb_t *enb, c_uint32_t enb_id); -CORE_DECLARE(hash_index_t *) mme_enb_first(); -CORE_DECLARE(hash_index_t *) mme_enb_next(hash_index_t *hi); -CORE_DECLARE(mme_enb_t *) mme_enb_this(hash_index_t *hi); -CORE_DECLARE(int) mme_enb_sock_type(sock_id sock); +mme_enb_t *mme_enb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr); +int mme_enb_remove(mme_enb_t *enb); +int mme_enb_remove_all(void); +mme_enb_t *mme_enb_find_by_sock(ogs_sock_t *sock); +mme_enb_t *mme_enb_find_by_addr(ogs_sockaddr_t *addr); +mme_enb_t *mme_enb_find_by_enb_id(uint32_t enb_id); +int mme_enb_set_enb_id(mme_enb_t *enb, uint32_t enb_id); +ogs_hash_index_t *mme_enb_first(); +ogs_hash_index_t *mme_enb_next(ogs_hash_index_t *hi); +mme_enb_t *mme_enb_this(ogs_hash_index_t *hi); +int mme_enb_sock_type(ogs_sock_t *sock); -CORE_DECLARE(enb_ue_t*) enb_ue_add(mme_enb_t *enb); -CORE_DECLARE(unsigned int) enb_ue_count(); -CORE_DECLARE(status_t) enb_ue_remove(enb_ue_t *enb_ue); -CORE_DECLARE(status_t) enb_ue_remove_in_enb(mme_enb_t *enb); -CORE_DECLARE(status_t) enb_ue_switch_to_enb(enb_ue_t *enb_ue, - mme_enb_t *new_enb); -CORE_DECLARE(enb_ue_t*) enb_ue_find(index_t index); -CORE_DECLARE(enb_ue_t*) enb_ue_find_by_enb_ue_s1ap_id(mme_enb_t *enb, - c_uint32_t enb_ue_s1ap_id); -CORE_DECLARE(enb_ue_t*) enb_ue_find_by_mme_ue_s1ap_id( - c_uint32_t mme_ue_s1ap_id); -CORE_DECLARE(enb_ue_t*) enb_ue_first_in_enb(mme_enb_t *enb); -CORE_DECLARE(enb_ue_t*) enb_ue_next_in_enb(enb_ue_t *enb_ue); +enb_ue_t *enb_ue_add(mme_enb_t *enb); +unsigned int enb_ue_count(); +int enb_ue_remove(enb_ue_t *enb_ue); +int enb_ue_remove_in_enb(mme_enb_t *enb); +int enb_ue_switch_to_enb(enb_ue_t *enb_ue, mme_enb_t *new_enb); +enb_ue_t *enb_ue_find_by_enb_ue_s1ap_id( + mme_enb_t *enb, uint32_t enb_ue_s1ap_id); +enb_ue_t *enb_ue_find_by_mme_ue_s1ap_id(uint32_t mme_ue_s1ap_id); +enb_ue_t *enb_ue_first_in_enb(mme_enb_t *enb); +enb_ue_t *enb_ue_next_in_enb(enb_ue_t *enb_ue); -CORE_DECLARE(mme_ue_t*) mme_ue_add(enb_ue_t *enb_ue); -CORE_DECLARE(status_t) mme_ue_remove(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_ue_remove_all(); +mme_ue_t *mme_ue_add(enb_ue_t *enb_ue); +int mme_ue_remove(mme_ue_t *mme_ue); +int mme_ue_remove_all(); -CORE_DECLARE(mme_ue_t*) mme_ue_find(index_t index); -CORE_DECLARE(mme_ue_t*) mme_ue_find_by_imsi(c_uint8_t *imsi, int imsi_len); -CORE_DECLARE(mme_ue_t*) mme_ue_find_by_imsi_bcd(c_int8_t *imsi_bcd); -CORE_DECLARE(mme_ue_t*) mme_ue_find_by_guti(guti_t *guti); -CORE_DECLARE(mme_ue_t*) mme_ue_find_by_teid(c_uint32_t teid); +mme_ue_t *mme_ue_find_by_imsi(uint8_t *imsi, int imsi_len); +mme_ue_t *mme_ue_find_by_imsi_bcd(char *imsi_bcd); +mme_ue_t *mme_ue_find_by_guti(guti_t *guti); +mme_ue_t *mme_ue_find_by_teid(uint32_t teid); -CORE_DECLARE(mme_ue_t*) mme_ue_find_by_message(nas_message_t *message); -CORE_DECLARE(status_t) mme_ue_set_imsi( - mme_ue_t *mme_ue, c_int8_t *imsi_bcd); +mme_ue_t *mme_ue_find_by_message(nas_message_t *message); +int mme_ue_set_imsi(mme_ue_t *mme_ue, char *imsi_bcd); -CORE_DECLARE(int) mme_ue_have_indirect_tunnel(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_ue_clear_indirect_tunnel(mme_ue_t *mme_ue); +int mme_ue_have_indirect_tunnel(mme_ue_t *mme_ue); +int mme_ue_clear_indirect_tunnel(mme_ue_t *mme_ue); /* * o RECV Initial UE-Message : S-TMSI @@ -638,61 +601,53 @@ CORE_DECLARE(status_t) mme_ue_clear_indirect_tunnel(mme_ue_t *mme_ue); * ### ENB_UE_REMOVE() #### * - Delete Indirect Data Forwarding Tunnel Request/Response */ -CORE_DECLARE(status_t) mme_ue_associate_enb_ue( - mme_ue_t *mme_ue, enb_ue_t *enb_ue); -CORE_DECLARE(status_t) enb_ue_deassociate(enb_ue_t *enb_ue); -CORE_DECLARE(status_t) mme_ue_deassociate(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) source_ue_associate_target_ue( - enb_ue_t *source_ue, enb_ue_t *target_ue); -CORE_DECLARE(status_t) source_ue_deassociate_target_ue(enb_ue_t *enb_ue); +int mme_ue_associate_enb_ue( + mme_ue_t *mme_ue, enb_ue_t *enb_ue); +int enb_ue_deassociate(enb_ue_t *enb_ue); +int mme_ue_deassociate(mme_ue_t *mme_ue); +int source_ue_associate_target_ue( + enb_ue_t *source_ue, enb_ue_t *target_ue); +int source_ue_deassociate_target_ue(enb_ue_t *enb_ue); -CORE_DECLARE(hash_index_t *) mme_ue_first(); -CORE_DECLARE(hash_index_t *) mme_ue_next(hash_index_t *hi); -CORE_DECLARE(mme_ue_t *) mme_ue_this(hash_index_t *hi); +ogs_hash_index_t *mme_ue_first(); +ogs_hash_index_t *mme_ue_next(ogs_hash_index_t *hi); +mme_ue_t *mme_ue_this(ogs_hash_index_t *hi); -CORE_DECLARE(mme_sess_t*) mme_sess_add(mme_ue_t *mme_ue, c_uint8_t pti); -CORE_DECLARE(status_t ) mme_sess_remove(mme_sess_t *sess); -CORE_DECLARE(status_t ) mme_sess_remove_all(mme_ue_t *mme_ue); -CORE_DECLARE(mme_sess_t*) mme_sess_find(index_t index); -CORE_DECLARE(mme_sess_t*) mme_sess_find_by_pti( - mme_ue_t *mme_ue, c_uint8_t pti); -CORE_DECLARE(mme_sess_t*) mme_sess_find_by_ebi( - mme_ue_t *mme_ue, c_uint8_t ebi); -CORE_DECLARE(mme_sess_t*) mme_sess_find_by_apn( - mme_ue_t *mme_ue, c_int8_t *apn); -CORE_DECLARE(mme_sess_t*) mme_sess_first(mme_ue_t *mme_ue); -CORE_DECLARE(mme_sess_t*) mme_sess_next(mme_sess_t *sess); -CORE_DECLARE(unsigned int) mme_sess_count(mme_ue_t *mme_ue); +mme_sess_t *mme_sess_add(mme_ue_t *mme_ue, uint8_t pti); +int mme_sess_remove(mme_sess_t *sess); +int mme_sess_remove_all(mme_ue_t *mme_ue); +mme_sess_t *mme_sess_find_by_pti(mme_ue_t *mme_ue, uint8_t pti); +mme_sess_t *mme_sess_find_by_ebi(mme_ue_t *mme_ue, uint8_t ebi); +mme_sess_t *mme_sess_find_by_apn(mme_ue_t *mme_ue, char *apn); +mme_sess_t *mme_sess_first(mme_ue_t *mme_ue); +mme_sess_t *mme_sess_next(mme_sess_t *sess); +unsigned int mme_sess_count(mme_ue_t *mme_ue); -CORE_DECLARE(mme_bearer_t*) mme_bearer_add(mme_sess_t *sess); -CORE_DECLARE(status_t) mme_bearer_remove(mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_bearer_remove_all(mme_sess_t *sess); -CORE_DECLARE(mme_bearer_t*) mme_bearer_find(index_t index); -CORE_DECLARE(mme_bearer_t*) mme_bearer_find_by_sess_ebi( - mme_sess_t *sess, c_uint8_t ebi); -CORE_DECLARE(mme_bearer_t*) mme_bearer_find_by_ue_ebi( - mme_ue_t *mme_ue, c_uint8_t ebi); -CORE_DECLARE(mme_bearer_t*) mme_bearer_find_or_add_by_message( +mme_bearer_t *mme_bearer_add(mme_sess_t *sess); +int mme_bearer_remove(mme_bearer_t *bearer); +int mme_bearer_remove_all(mme_sess_t *sess); +mme_bearer_t *mme_bearer_find_by_sess_ebi(mme_sess_t *sess, uint8_t ebi); +mme_bearer_t *mme_bearer_find_by_ue_ebi(mme_ue_t *mme_ue, uint8_t ebi); +mme_bearer_t *mme_bearer_find_or_add_by_message( mme_ue_t *mme_ue, nas_message_t *message); -CORE_DECLARE(mme_bearer_t*) mme_default_bearer_in_sess(mme_sess_t *sess); -CORE_DECLARE(mme_bearer_t*) mme_linked_bearer(mme_bearer_t *bearer); -CORE_DECLARE(mme_bearer_t*) mme_bearer_first(mme_sess_t *sess); -CORE_DECLARE(mme_bearer_t*) mme_bearer_next(mme_bearer_t *bearer); +mme_bearer_t *mme_default_bearer_in_sess(mme_sess_t *sess); +mme_bearer_t *mme_linked_bearer(mme_bearer_t *bearer); +mme_bearer_t *mme_bearer_first(mme_sess_t *sess); +mme_bearer_t *mme_bearer_next(mme_bearer_t *bearer); -CORE_DECLARE(int) mme_bearer_is_inactive(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_bearer_set_inactive(mme_ue_t *mme_ue); +int mme_bearer_is_inactive(mme_ue_t *mme_ue); +int mme_bearer_set_inactive(mme_ue_t *mme_ue); -CORE_DECLARE(pdn_t*) mme_pdn_add(mme_ue_t *mme_ue, c_int8_t *apn); -CORE_DECLARE(status_t) mme_pdn_remove_all(mme_ue_t *mme_ue); -CORE_DECLARE(pdn_t*) mme_pdn_find_by_apn( - mme_ue_t *mme_ue, c_int8_t *apn); -CORE_DECLARE(pdn_t*) mme_default_pdn(mme_ue_t *mme_ue); +pdn_t *mme_pdn_add(mme_ue_t *mme_ue, char *apn); +int mme_pdn_remove_all(mme_ue_t *mme_ue); +pdn_t *mme_pdn_find_by_apn(mme_ue_t *mme_ue, char *apn); +pdn_t *mme_default_pdn(mme_ue_t *mme_ue); -CORE_DECLARE(int) mme_find_served_tai(tai_t *tai); +int mme_find_served_tai(tai_t *tai); -CORE_DECLARE(status_t) mme_m_tmsi_pool_generate(); -CORE_DECLARE(mme_m_tmsi_t *) mme_m_tmsi_alloc(); -CORE_DECLARE(status_t) mme_m_tmsi_free(mme_m_tmsi_t *tmsi); +int mme_m_tmsi_pool_generate(); +mme_m_tmsi_t *mme_m_tmsi_alloc(); +int mme_m_tmsi_free(mme_m_tmsi_t *tmsi); #ifdef __cplusplus } diff --git a/src/mme/mme_event.c b/src/mme/mme_event.c index d62d81f76..c035e1f51 100644 --- a/src/mme/mme_event.c +++ b/src/mme/mme_event.c @@ -1,20 +1,83 @@ -#define TRACE_MODULE _mme_event - -#include "core_debug.h" - #include "mme_event.h" +#include "mme_context.h" -char* mme_event_get_name(event_t *e) +#include "s1ap_path.h" + +#define EVENT_POOL 32 /* FIXME : 32 */ +void mme_event_init(void) +{ + mme_self()->queue = ogs_queue_create(EVENT_POOL); + ogs_assert(mme_self()->queue); + mme_self()->timer_mgr = ogs_timer_mgr_create(); + ogs_assert(mme_self()->timer_mgr); + mme_self()->pollset = ogs_pollset_create(); + ogs_assert(mme_self()->pollset); +} + +void mme_event_term(void) +{ + ogs_queue_term(mme_self()->queue); + ogs_pollset_notify(mme_self()->pollset); +} + +void mme_event_final(void) +{ + if (mme_self()->pollset) + ogs_pollset_destroy(mme_self()->pollset); + if (mme_self()->timer_mgr) + ogs_timer_mgr_destroy(mme_self()->timer_mgr); + if (mme_self()->queue) + ogs_queue_destroy(mme_self()->queue); +} + +mme_event_t *mme_event_new(mme_event_e id) +{ + mme_event_t *e = NULL; + + e = ogs_calloc(1, sizeof *e); + ogs_assert(e); + e->id = id; + + return e; +} + +void mme_event_free(mme_event_t *e) +{ + ogs_assert(e); + ogs_free(e); +} + +void mme_event_timeout(void *data) +{ + int rc; + mme_event_t *e = data; + enb_ue_t *enb_ue = NULL; + ogs_pkbuf_t *pkbuf = NULL; + ogs_assert(e); + + enb_ue = e->enb_ue; + ogs_assert(enb_ue); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); + + rc = s1ap_send_to_enb_ue(enb_ue, pkbuf); + ogs_assert(rc == OGS_OK); + + ogs_timer_delete(e->timer); + mme_event_free(e); +} + +const char *mme_event_get_name(mme_event_t *e) { if (e == NULL) - return FSM_NAME_INIT_SIG; + return OGS_FSM_NAME_INIT_SIG; - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: - return FSM_NAME_ENTRY_SIG; - case FSM_EXIT_SIG: - return FSM_NAME_EXIT_SIG; + case OGS_FSM_ENTRY_SIG: + return OGS_FSM_NAME_ENTRY_SIG; + case OGS_FSM_EXIT_SIG: + return OGS_FSM_NAME_EXIT_SIG; case MME_EVT_S1AP_MESSAGE: return "MME_EVT_S1AP_MESSAGE"; @@ -26,23 +89,15 @@ char* mme_event_get_name(event_t *e) return "MME_EVT_S1AP_LO_SCTP_COMM_UP"; case MME_EVT_S1AP_LO_CONNREFUSED: return "MME_EVT_S1AP_LO_CONNREFUSED"; - case MME_EVT_S1AP_S1_HOLDING_TIMER: - return "MME_EVT_S1AP_S1_HOLDING_TIMER"; case MME_EVT_EMM_MESSAGE: return "MME_EVT_EMM_MESSAGE"; - case MME_EVT_EMM_T3413: - return "MME_EVT_EMM_T3413"; case MME_EVT_ESM_MESSAGE: return "MME_EVT_ESM_MESSAGE"; case MME_EVT_S11_MESSAGE: return "MME_EVT_S11_MESSAGE"; - case MME_EVT_S11_T3_RESPONSE: - return "MME_EVT_S11_T3_RESPONSE"; - case MME_EVT_S11_T3_HOLDING: - return "MME_EVT_S11_T3_HOLDING"; case MME_EVT_S6A_MESSAGE: return "MME_EVT_S6A_MESSAGE"; @@ -51,5 +106,5 @@ char* mme_event_get_name(event_t *e) break; } - return EVT_NAME_UNKNOWN; + return "UNKNOWN_EVENT"; } diff --git a/src/mme/mme_event.h b/src/mme/mme_event.h index e76456490..9654ba09e 100644 --- a/src/mme/mme_event.h +++ b/src/mme/mme_event.h @@ -1,9 +1,7 @@ #ifndef __MME_EVENT_H__ #define __MME_EVENT_H__ -#include "core_event.h" -#include "core_fsm.h" -#include "core_pkbuf.h" +#include "ogs-core.h" #ifdef __cplusplus extern "C" { @@ -11,33 +9,69 @@ extern "C" { /* forward declaration */ typedef enum { - MME_EVT_BASE = FSM_USER_SIG, + MME_EVT_BASE = OGS_FSM_USER_SIG, MME_EVT_S1AP_MESSAGE, MME_EVT_S1AP_DELAYED_SEND, MME_EVT_S1AP_LO_ACCEPT, MME_EVT_S1AP_LO_SCTP_COMM_UP, MME_EVT_S1AP_LO_CONNREFUSED, - MME_EVT_S1AP_S1_HOLDING_TIMER, MME_EVT_EMM_MESSAGE, - MME_EVT_EMM_T3413, - MME_EVT_ESM_MESSAGE, - MME_EVT_S11_MESSAGE, - MME_EVT_S11_T3_RESPONSE, - MME_EVT_S11_T3_HOLDING, - MME_EVT_S6A_MESSAGE, MME_EVT_TOP, -} event_e; +} mme_event_e; -#define mme_event_send(__ptr_e) event_send(mme_self()->queue_id, (__ptr_e)) +typedef long S1AP_ProcedureCode_t; +typedef struct S1AP_S1AP_PDU s1ap_message_t; +typedef struct _nas_message_t nas_message_t; +typedef struct _mme_enb_t mme_enb_t; +typedef struct _enb_ue_t enb_ue_t; +typedef struct _mme_ue_t mme_ue_t; +typedef struct _mme_sess_t mme_sess_t; +typedef struct _mme_bearer_t mme_bearer_t; -CORE_DECLARE(char*) mme_event_get_name(event_t *e); +typedef struct mme_event_s { + int id; + void *pkbuf; + + ogs_sock_t *enb_sock; + ogs_sockaddr_t *enb_addr; + uint16_t inbound_streams; + uint16_t outbound_streams; + + S1AP_ProcedureCode_t s1ap_code; + s1ap_message_t *s1ap_message; + + uint8_t nas_type; + nas_message_t *nas_message; + + mme_enb_t *enb; + enb_ue_t *enb_ue; + mme_ue_t *mme_ue; + mme_sess_t *sess; + mme_bearer_t *bearer; + + ogs_timer_t *timer; +} mme_event_t; + +void mme_event_init(void); +void mme_event_term(void); +void mme_event_final(void); + +mme_event_t *mme_event_new(mme_event_e id); +void mme_event_free(mme_event_t *e); + +void mme_event_timeout(void *data); + +#define mme_event_send(__ptr_e) \ + ogs_assert(ogs_queue_push(mme_self()->queue, ((__ptr_e))) == OGS_OK) + +const char *mme_event_get_name(mme_event_t *e); #ifdef __cplusplus } diff --git a/src/mme/mme_fd_path.c b/src/mme/mme_fd_path.c index 2caf16089..5d3f70ca5 100644 --- a/src/mme/mme_fd_path.c +++ b/src/mme/mme_fd_path.c @@ -1,9 +1,3 @@ -#define TRACE_MODULE _mme_fd_path - -#include "core_debug.h" -#include "core_pool.h" -#include "core_lib.h" - #include "fd/fd_lib.h" #include "fd/s6a/s6a_dict.h" #include "fd/s6a/s6a_message.h" @@ -18,14 +12,12 @@ struct sess_state { struct timespec ts; /* Time of sending the message */ }; -pool_declare(mme_s6a_sess_pool, struct sess_state, MAX_POOL_OF_DIAMETER_SESS); - static void mme_s6a_aia_cb(void *data, struct msg **msg); static void mme_s6a_ula_cb(void *data, struct msg **msg); static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque) { - pool_free_node(&mme_s6a_sess_pool, sess_data); + ogs_free(sess_data); } /* MME Sends Authentication Information Request to HSS */ @@ -40,120 +32,121 @@ void mme_s6a_send_air(mme_ue_t *mme_ue, union avp_value val; struct sess_state *sess_data = NULL, *svg; struct session *session = NULL; + nas_plmn_id_t nas_plmn_id; - c_uint8_t resync[AUTS_LEN + RAND_LEN]; + uint8_t resync[AUTS_LEN + RAND_LEN]; - d_assert(mme_ue, return, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Authentication-Information-Request\n"); + ogs_debug("[MME] Authentication-Information-Request"); /* Clear Security Context */ CLEAR_SECURITY_CONTEXT(mme_ue); /* Create the random value to store with the session */ - pool_alloc_node(&mme_s6a_sess_pool, &sess_data); - d_assert(sess_data, return,); + sess_data = ogs_calloc(1, sizeof (*sess_data)); + ogs_assert(sess_data); sess_data->mme_ue = mme_ue; /* Create the request */ ret = fd_msg_new(s6a_cmd_air, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Create a new session */ #define S6A_APP_SID_OPT "app_s6a" ret = fd_msg_new_session(req, (os0_t)S6A_APP_SID_OPT, CONSTSTRLEN(S6A_APP_SID_OPT)); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_sess_get(fd_g_config->cnf_dict, req, &session, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Auth-Session-State AVP */ ret = fd_msg_avp_new(fd_auth_session_state, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the User-Name AVP */ ret = fd_msg_avp_new(fd_user_name, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t *)mme_ue->imsi_bcd; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)mme_ue->imsi_bcd; val.os.len = strlen(mme_ue->imsi_bcd); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Add the Authentication-Info */ ret = fd_msg_avp_new(s6a_req_eutran_auth_info, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_number_of_requested_vectors, 0, &avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = 1; ret = fd_msg_avp_setvalue (avpch, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(s6a_immediate_response_preferred, 0, &avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = 1; ret = fd_msg_avp_setvalue(avpch, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (authentication_failure_parameter) { ret = fd_msg_avp_new(s6a_re_synchronization_info, 0, &avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); memcpy(resync, mme_ue->rand, RAND_LEN); memcpy(resync+RAND_LEN, authentication_failure_parameter->auts, AUTS_LEN); val.os.len = RAND_LEN+AUTS_LEN; val.os.data = resync; ret = fd_msg_avp_setvalue(avpch, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Visited-PLMN-Id AVP */ ret = fd_msg_avp_new(s6a_visited_plmn_id, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t *)&mme_ue->visited_plmn_id; + ogs_assert(ret == 0); + val.os.data = nas_from_plmn_id(&nas_plmn_id, &mme_ue->visited_plmn_id); val.os.len = PLMN_ID_LEN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = fd_message_vendor_specific_appid_set(req, S6A_APPLICATION_ID); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = clock_gettime(CLOCK_REALTIME, &sess_data->ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ @@ -161,17 +154,17 @@ void mme_s6a_send_air(mme_ue_t *mme_ue, /* Store this value in the session */ ret = fd_sess_state_store(mme_s6a_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == 0, return,); + ogs_assert(ret == 0); + ogs_assert(sess_data == 0); /* Send the request */ ret = fd_msg_send(&req, mme_s6a_aia_cb, svg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); } /* MME received Authentication Information Answer from HSS */ @@ -189,172 +182,172 @@ static void mme_s6a_aia_cb(void *data, struct msg **msg) int error = 0; int new; - event_t e; + mme_event_t *e = NULL; mme_ue_t *mme_ue = NULL; - pkbuf_t *s6abuf = NULL; + ogs_pkbuf_t *s6abuf = NULL; s6a_message_t *s6a_message = NULL; s6a_aia_message_t *aia_message = NULL; - c_uint16_t s6abuf_len = 0; + uint16_t s6abuf_len = 0; e_utran_vector_t *e_utran_vector = NULL; - d_trace(3, "[MME] Authentication-Information-Answer\n"); + ogs_debug("[MME] Authentication-Information-Answer"); ret = clock_gettime(CLOCK_REALTIME, &ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); ret = fd_sess_state_retrieve(mme_s6a_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data && (void *)sess_data == data, return, ); + ogs_assert(ret == 0); + ogs_assert(sess_data && (void *)sess_data == data); mme_ue = sess_data->mme_ue; - d_assert(mme_ue, return, ); + ogs_assert(mme_ue); s6abuf_len = sizeof(s6a_message_t); - d_assert(s6abuf_len < 8192, return, "Not supported size:%d", s6abuf_len); - s6abuf = pkbuf_alloc(0, s6abuf_len); - d_assert(s6abuf, return, "Null param"); - s6a_message = s6abuf->payload; - d_assert(s6a_message, return, "Null param"); + ogs_assert(s6abuf_len < 8192); + s6abuf = ogs_pkbuf_alloc(NULL, s6abuf_len); + ogs_pkbuf_put(s6abuf, s6abuf_len); + s6a_message = s6abuf->data; + ogs_assert(s6a_message); /* Set Authentication-Information Command */ memset(s6a_message, 0, s6abuf_len); s6a_message->cmd_code = S6A_CMD_CODE_AUTHENTICATION_INFORMATION; aia_message = &s6a_message->aia_message; - d_assert(aia_message, return, "Null param"); + ogs_assert(aia_message); e_utran_vector = &aia_message->e_utran_vector; - d_assert(e_utran_vector, return, "Null param"); + ogs_assert(e_utran_vector); /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); s6a_message->result_code = hdr->avp_value->i32; - d_trace(5, " Result Code: %d\n", hdr->avp_value->i32); + ogs_debug(" Result Code: %d", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch) { ret = fd_msg_avp_hdr(avpch, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); s6a_message->result_code = hdr->avp_value->i32; - d_trace(5, " Experimental Result Code: %d\n", + ogs_debug(" Experimental Result Code: %d", s6a_message->result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); error++; } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " From '%.*s'\n", + ogs_assert(ret == 0); + ogs_debug(" From '%.*s'", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host "); + ogs_error("no_Origin-Host "); error++; } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " ('%.*s')\n", + ogs_assert(ret == 0); + ogs_debug(" ('%.*s')", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm "); + ogs_error("no_Origin-Realm "); error++; } if (s6a_message->result_code != ER_DIAMETER_SUCCESS) { - d_warn("ERROR DIAMETER Result Code(%d)", s6a_message->result_code); + ogs_warn("ERROR DIAMETER Result Code(%d)", s6a_message->result_code); goto out; } ret = fd_msg_search_avp(*msg, s6a_authentication_info, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } else { - d_error("no_Authentication-Info "); + ogs_error("no_Authentication-Info "); error++; } ret = fd_avp_search_avp(avp, s6a_e_utran_vector, &avp_e_utran_vector); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp_e_utran_vector, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } else { - d_error("no_E-UTRAN-Vector-Info "); + ogs_error("no_E-UTRAN-Vector-Info "); error++; } ret = fd_avp_search_avp(avp_e_utran_vector, s6a_xres, &avp_xres); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp_xres, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); memcpy(e_utran_vector->xres, hdr->avp_value->os.data, hdr->avp_value->os.len); e_utran_vector->xres_len = hdr->avp_value->os.len; } else { - d_error("no_XRES"); + ogs_error("no_XRES"); error++; } ret = fd_avp_search_avp(avp_e_utran_vector, s6a_kasme, &avp_kasme); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp_kasme, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); memcpy(e_utran_vector->kasme, hdr->avp_value->os.data, hdr->avp_value->os.len); } else { - d_error("no_KASME"); + ogs_error("no_KASME"); error++; } @@ -368,36 +361,38 @@ static void mme_s6a_aia_cb(void *data, struct msg **msg) } else { - d_error("no_RAND"); + ogs_error("no_RAND"); error++; } ret = fd_avp_search_avp(avp_e_utran_vector, s6a_autn, &avp_autn); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp_autn, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); memcpy(e_utran_vector->autn, hdr->avp_value->os.data, hdr->avp_value->os.len); } else { - d_error("no_AUTN"); + ogs_error("no_AUTN"); error++; } out: if (!error) { - event_set(&e, MME_EVT_S6A_MESSAGE); - event_set_param1(&e, (c_uintptr_t)mme_ue->index); - event_set_param2(&e, (c_uintptr_t)s6abuf); - mme_event_send(&e); + e = mme_event_new(MME_EVT_S6A_MESSAGE); + ogs_assert(e); + e->mme_ue = mme_ue; + e->pkbuf = s6abuf; + mme_event_send(e); + ogs_pollset_notify(mme_self()->pollset); } /* Free the message */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (fd_logger_self()->stats.nb_recv) @@ -423,20 +418,20 @@ out: else fd_logger_self()->stats.nb_recv++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - d_trace(9, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - d_trace(9, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; state_cleanup(sess_data, NULL, NULL); @@ -453,105 +448,104 @@ void mme_s6a_send_ulr(mme_ue_t *mme_ue) union avp_value val; struct sess_state *sess_data = NULL, *svg; struct session *session = NULL; + nas_plmn_id_t nas_plmn_id; - d_assert(mme_ue, return, "Null Param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Update-Location-Request\n"); + ogs_debug("[MME] Update-Location-Request"); /* Create the random value to store with the session */ - pool_alloc_node(&mme_s6a_sess_pool, &sess_data); - d_assert(sess_data, return,); - + sess_data = ogs_calloc(1, sizeof(*sess_data)); sess_data->mme_ue = mme_ue; /* Create the request */ ret = fd_msg_new(s6a_cmd_ulr, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Create a new session */ #define S6A_APP_SID_OPT "app_s6a" ret = fd_msg_new_session(req, (os0_t)S6A_APP_SID_OPT, CONSTSTRLEN(S6A_APP_SID_OPT)); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_sess_get(fd_g_config->cnf_dict, req, &session, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Auth-Session-State AVP */ ret = fd_msg_avp_new(fd_auth_session_state, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the User-Name AVP */ ret = fd_msg_avp_new(fd_user_name, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t *)mme_ue->imsi_bcd; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)mme_ue->imsi_bcd; val.os.len = strlen(mme_ue->imsi_bcd); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the RAT-Type */ ret = fd_msg_avp_new(s6a_rat_type, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = S6A_RAT_TYPE_EUTRAN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the ULR-Flags */ ret = fd_msg_avp_new(s6a_ulr_flags, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = S6A_ULR_S6A_S6D_INDICATOR; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Visited-PLMN-Id */ ret = fd_msg_avp_new(s6a_visited_plmn_id, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t *)&mme_ue->visited_plmn_id; + ogs_assert(ret == 0); + val.os.data = nas_from_plmn_id(&nas_plmn_id, &mme_ue->visited_plmn_id); val.os.len = PLMN_ID_LEN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the UE-SRVCC Capability */ ret = fd_msg_avp_new(s6a_ue_srvcc_capability, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = S6A_UE_SRVCC_NOT_SUPPORTED; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = fd_message_vendor_specific_appid_set( req, S6A_APPLICATION_ID); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = clock_gettime(CLOCK_REALTIME, &sess_data->ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ @@ -559,17 +553,17 @@ void mme_s6a_send_ulr(mme_ue_t *mme_ue) /* Store this value in the session */ ret = fd_sess_state_store(mme_s6a_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == 0, return,); + ogs_assert(ret == 0); + ogs_assert(sess_data == 0); /* Send the request */ ret = fd_msg_send(&req, mme_s6a_ula_cb, svg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); } /* MME received Update Location Answer from HSS */ @@ -587,179 +581,179 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) int error = 0; int new; - event_t e; + mme_event_t *e = NULL; mme_ue_t *mme_ue = NULL; - pkbuf_t *s6abuf = NULL; + ogs_pkbuf_t *s6abuf = NULL; s6a_message_t *s6a_message = NULL; s6a_ula_message_t *ula_message = NULL; s6a_subscription_data_t *subscription_data = NULL; - c_uint16_t s6abuf_len = 0; + uint16_t s6abuf_len = 0; - d_trace(3, "[MME] Update-Location-Answer\n"); + ogs_debug("[MME] Update-Location-Answer"); ret = clock_gettime(CLOCK_REALTIME, &ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); ret = fd_sess_state_retrieve(mme_s6a_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data && (void *)sess_data == data, return, ); + ogs_assert(ret == 0); + ogs_assert(sess_data && (void *)sess_data == data); mme_ue = sess_data->mme_ue; - d_assert(mme_ue, return, ); + ogs_assert(mme_ue); s6abuf_len = sizeof(s6a_message_t); - d_assert(s6abuf_len < 8192, return, "Not supported size:%d", s6abuf_len); - s6abuf = pkbuf_alloc(0, s6abuf_len); - d_assert(s6abuf, return, "Null param"); - s6a_message = s6abuf->payload; - d_assert(s6a_message, return, "Null param"); + ogs_assert(s6abuf_len < 8192); + s6abuf = ogs_pkbuf_alloc(NULL, s6abuf_len); + ogs_pkbuf_put(s6abuf, s6abuf_len); + s6a_message = s6abuf->data; + ogs_assert(s6a_message); /* Set Authentication-Information Command */ memset(s6a_message, 0, s6abuf_len); s6a_message->cmd_code = S6A_CMD_CODE_UPDATE_LOCATION; ula_message = &s6a_message->ula_message; - d_assert(ula_message, return, "Null param"); + ogs_assert(ula_message); subscription_data = &ula_message->subscription_data; - d_assert(subscription_data, return, "Null param"); + ogs_assert(subscription_data); /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); s6a_message->result_code = hdr->avp_value->i32; - d_trace(5, " Result Code: %d\n", hdr->avp_value->i32); + ogs_debug(" Result Code: %d", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch) { ret = fd_msg_avp_hdr(avpch, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); s6a_message->result_code = hdr->avp_value->i32; - d_trace(5, " Experimental Result Code: %d\n", + ogs_debug(" Experimental Result Code: %d", s6a_message->result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); error++; } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " From '%.*s'\n", + ogs_assert(ret == 0); + ogs_debug(" From '%.*s'", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host"); + ogs_error("no_Origin-Host"); error++; } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " ('%.*s')\n", + ogs_assert(ret == 0); + ogs_debug(" ('%.*s')", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm"); + ogs_error("no_Origin-Realm"); error++; } ret = fd_msg_search_avp(*msg, s6a_ula_flags, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ula_message->ula_flags = hdr->avp_value->i32; } else { - d_error("no_ULA-Flags"); + ogs_error("no_ULA-Flags"); error++; } ret = fd_msg_search_avp(*msg, s6a_subscription_data, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, s6a_ambr, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_avp_search_avp( avpch1, s6a_max_bandwidth_ul, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); subscription_data->ambr.uplink = hdr->avp_value->u32; } else { - d_error("no_Max-Bandwidth-UL"); + ogs_error("no_Max-Bandwidth-UL"); error++; } ret = fd_avp_search_avp(avpch1, s6a_max_bandwidth_dl, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); subscription_data->ambr.downlink = hdr->avp_value->u32; } else { - d_error("no_Max-Bandwidth-DL"); + ogs_error("no_Max-Bandwidth-DL"); error++; } } else { - d_error("no_AMBR"); + ogs_error("no_AMBR"); error++; } ret = fd_avp_search_avp(avp, s6a_apn_configuration_profile, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_browse(avpch1, MSG_BRW_FIRST_CHILD, &avpch2, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); while(avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case S6A_AVP_CODE_CONTEXT_IDENTIFIER: @@ -774,26 +768,26 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) { pdn_t *pdn = &subscription_data->pdn[ subscription_data->num_of_pdn]; - d_assert(pdn, return, ); + ogs_assert(pdn); ret = fd_avp_search_avp( avpch2, s6a_service_selection, &avpch3); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - core_cpystrn(pdn->apn, + ogs_cpystrn(pdn->apn, (char*)hdr->avp_value->os.data, - c_min(hdr->avp_value->os.len, MAX_APN_LEN)+1); + ogs_min(hdr->avp_value->os.len, MAX_APN_LEN)+1); } else { - d_error("no_Service-Selection"); + ogs_error("no_Service-Selection"); error++; } ret = fd_avp_search_avp(avpch2, s6a_context_identifier, &avpch3); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); @@ -801,12 +795,12 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } else { - d_error("no_Context-Identifier"); + ogs_error("no_Context-Identifier"); error++; } ret = fd_avp_search_avp(avpch2, s6a_pdn_type, &avpch3); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); @@ -814,105 +808,105 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } else { - d_error("no_PDN-Type"); + ogs_error("no_PDN-Type"); error++; } ret = fd_avp_search_avp(avpch2, s6a_eps_subscribed_qos_profile, &avpch3); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_avp_search_avp(avpch3, s6a_qos_class_identifier, &avpch4); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); pdn->qos.qci = hdr->avp_value->i32; } else { - d_error("no_QoS-Class-Identifier"); + ogs_error("no_QoS-Class-Identifier"); error++; } ret = fd_avp_search_avp(avpch3, s6a_allocation_retention_priority, &avpch4); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_avp_search_avp(avpch4, s6a_priority_level, &avpch5); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch5) { ret = fd_msg_avp_hdr(avpch5, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); pdn->qos.arp.priority_level = hdr->avp_value->i32; } else { - d_error("no_ARP"); + ogs_error("no_ARP"); error++; } ret = fd_avp_search_avp(avpch4, s6a_pre_emption_capability, &avpch5); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch5) { ret = fd_msg_avp_hdr(avpch5, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); pdn->qos.arp.pre_emption_capability = hdr->avp_value->i32; } else { - d_error("no_Preemption-Capability"); + ogs_error("no_Preemption-Capability"); error++; } ret = fd_avp_search_avp(avpch4, s6a_pre_emption_vulnerability, &avpch5); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch5) { ret = fd_msg_avp_hdr(avpch5, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); pdn->qos.arp.pre_emption_vulnerability = hdr->avp_value->i32; } else { - d_error("no_Preemption-Vulnerability"); + ogs_error("no_Preemption-Vulnerability"); error++; } } else { - d_error("no_QCI"); + ogs_error("no_QCI"); error++; } } else { - d_error("no_EPS-Subscribed-QoS-Profile"); + ogs_error("no_EPS-Subscribed-QoS-Profile"); error++; } ret = fd_avp_search_avp(avpch2, fd_mip6_agent_info, &avpch3); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_browse(avpch3, MSG_BRW_FIRST_CHILD, &avpch4, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); while(avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); @@ -920,11 +914,11 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) { case S6A_AVP_CODE_MIP_HOME_AGENT_ADDRESS: { - c_sockaddr_t addr; + ogs_sockaddr_t addr; ret = fd_msg_avp_value_interpret(avpch4, &addr.sa); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (addr.c_sa_family == AF_INET) { pdn->pgw_ip.ipv4 = 1; @@ -940,7 +934,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } else { - d_error("Invald family:%d", + ogs_error("Invald family:%d", addr.c_sa_family); error++; } @@ -948,7 +942,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } default: { - d_error("Unknown AVP-Code:%d", + ogs_error("Unknown AVP-Code:%d", hdr->avp_code); error++; break; @@ -960,36 +954,36 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } ret = fd_avp_search_avp(avpch2, s6a_ambr, &avpch3); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_avp_search_avp(avpch3, s6a_max_bandwidth_ul, &avpch4); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); pdn->ambr.uplink = hdr->avp_value->u32; } else { - d_error("no_Max-Bandwidth-UL"); + ogs_error("no_Max-Bandwidth-UL"); error++; } ret = fd_avp_search_avp(avpch3, s6a_max_bandwidth_dl, &avpch4); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); pdn->ambr.downlink = hdr->avp_value->u32; } else { - d_error("no_Max-Bandwidth-DL"); + ogs_error("no_Max-Bandwidth-DL"); error++; } } @@ -999,7 +993,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } default: { - d_warn("Unknown AVP-code:%d", hdr->avp_code); + ogs_warn("Unknown AVP-code:%d", hdr->avp_code); break; } } @@ -1009,40 +1003,42 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } else { - d_error("no_APN-Configuration-Profile"); + ogs_error("no_APN-Configuration-Profile"); error++; } } else { - d_error("no_Subscription-Data"); + ogs_error("no_Subscription-Data"); error++; } ret = fd_msg_search_avp(*msg, s6a_subscribed_rau_tau_timer, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); subscription_data->subscribed_rau_tau_timer = hdr->avp_value->i32; } else { - d_error("no_Subscribed_RAU-TAU-Timer"); + ogs_error("no_Subscribed_RAU-TAU-Timer"); error++; } if (!error) { - event_set(&e, MME_EVT_S6A_MESSAGE); - event_set_param1(&e, (c_uintptr_t)mme_ue->index); - event_set_param2(&e, (c_uintptr_t)s6abuf); - mme_event_send(&e); + e = mme_event_new(MME_EVT_S6A_MESSAGE); + ogs_assert(e); + e->mme_ue = mme_ue; + e->pkbuf = s6abuf; + mme_event_send(e); + ogs_pollset_notify(mme_self()->pollset); } /* Free the message */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (fd_logger_self()->stats.nb_recv) @@ -1068,20 +1064,20 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) else fd_logger_self()->stats.nb_recv++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - d_trace(9, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - d_trace(9, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; state_cleanup(sess_data, NULL, NULL); @@ -1089,28 +1085,26 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) } -status_t mme_fd_init(void) +int mme_fd_init(void) { int ret; - pool_init(&mme_s6a_sess_pool, MAX_POOL_OF_DIAMETER_SESS); - ret = fd_init(FD_MODE_CLIENT, mme_self()->fd_conf_path, mme_self()->fd_config); - d_assert(ret == CORE_OK, return CORE_ERROR,); + ogs_assert(ret == OGS_OK); /* Install objects definitions for this application */ ret = s6a_dict_init(); - d_assert(ret == CORE_OK, return CORE_ERROR,); + ogs_assert(ret == OGS_OK); /* Create handler for sessions */ ret = fd_sess_handler_create(&mme_s6a_reg, &state_cleanup, NULL, NULL); - d_assert(ret == CORE_OK, return CORE_ERROR,); + ogs_assert(ret == OGS_OK); /* Advertise the support for the application in the peer */ ret = fd_disp_app_support(s6a_application, fd_vendor, 1, 0); - d_assert(ret == CORE_OK, return CORE_ERROR,); + ogs_assert(ret == OGS_OK); return 0; } @@ -1120,15 +1114,7 @@ void mme_fd_final(void) int ret; ret = fd_sess_handler_destroy(&mme_s6a_reg, NULL); - d_assert(ret == CORE_OK,,); + ogs_assert(ret == OGS_OK); fd_final(); - - if (pool_used(&mme_s6a_sess_pool)) - d_error("%d not freed in mme_s6a_sess_pool[%d] of GX-SM", - pool_used(&mme_s6a_sess_pool), pool_size(&mme_s6a_sess_pool)); - d_trace(9, "%d not freed in mme_s6a_sess_pool[%d] of GX-SM\n", - pool_used(&mme_s6a_sess_pool), pool_size(&mme_s6a_sess_pool)); - - pool_final(&mme_s6a_sess_pool); } diff --git a/src/mme/mme_fd_path.h b/src/mme/mme_fd_path.h index ef1ece236..f8a6338ba 100644 --- a/src/mme/mme_fd_path.h +++ b/src/mme/mme_fd_path.h @@ -1,22 +1,20 @@ #ifndef __MME_FD_PATH_H__ #define __MME_FD_PATH_H__ -#include "core_errno.h" - #include "mme_context.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) mme_fd_init(void); -CORE_DECLARE(void) mme_fd_final(void); +int mme_fd_init(void); +void mme_fd_final(void); /* MME Sends Authentication Information Request to HSS */ -CORE_DECLARE(void) mme_s6a_send_air(mme_ue_t *mme_ue, +void mme_s6a_send_air(mme_ue_t *mme_ue, nas_authentication_failure_parameter_t *authentication_failure_parameter); /* MME Sends Update Location Request to HSS */ -CORE_DECLARE(void) mme_s6a_send_ulr(mme_ue_t *mme_ue); +void mme_s6a_send_ulr(mme_ue_t *mme_ue); #ifdef __cplusplus } diff --git a/src/mme/mme_gtp_path.c b/src/mme/mme_gtp_path.c index ec2e26098..4baf8f3a9 100644 --- a/src/mme/mme_gtp_path.c +++ b/src/mme/mme_gtp_path.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _mme_gtp_path -#include "core_debug.h" -#include "core_pkbuf.h" - #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" #include "gtp/gtp_xact.h" @@ -11,47 +7,36 @@ #include "mme_s11_build.h" #include "mme_sm.h" -static int _gtpv2_c_recv_cb(sock_id sock, void *data) +static void _gtpv2_c_recv_cb(short when, ogs_socket_t fd, void *data) { - status_t rv; - event_t e; - pkbuf_t *pkbuf = NULL; + int rv; + mme_event_t *e = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(sock, return -1, "Null param"); + ogs_assert(fd != INVALID_SOCKET); - rv = gtp_recv(sock, &pkbuf); - if (rv != CORE_OK) + rv = gtp_recv(fd, &pkbuf); + if (rv != OGS_OK) { - if (errno == EAGAIN) - return 0; - - return -1; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, "gtp_recv() failed"); + return; } - d_trace(50, "[GTPv2] RECV : "); - d_trace_hex(50, pkbuf->payload, pkbuf->len); - - event_set(&e, MME_EVT_S11_MESSAGE); - event_set_param1(&e, (c_uintptr_t)pkbuf); - rv = mme_event_send(&e); - if (rv != CORE_OK) - { - d_error("mme_event_send error"); - pkbuf_free(pkbuf); - return -1; - } - return 0; + e = mme_event_new(MME_EVT_S11_MESSAGE); + ogs_assert(e); + e->pkbuf = pkbuf; + mme_event_send(e); } -static c_sockaddr_t *pgw_addr_find_by_family(list_t *list, int family) +static ogs_sockaddr_t *pgw_addr_find_by_family(ogs_list_t *list, int family) { mme_pgw_t *pgw = NULL; - d_assert(list, return NULL,); + ogs_assert(list); - for (pgw = list_first(list); pgw; pgw = list_next(pgw)) + ogs_list_for_each(list, pgw) { - d_assert(pgw->gnode, return NULL,); - c_sockaddr_t *addr = pgw->gnode->sa_list; + ogs_assert(pgw->gnode); + ogs_sockaddr_t *addr = pgw->gnode->sa_list; while(addr) { if (addr->c_sa_family == family) @@ -65,91 +50,121 @@ static c_sockaddr_t *pgw_addr_find_by_family(list_t *list, int family) return NULL; } -status_t mme_gtp_open() +int mme_gtp_open() { - status_t rv; + int rv; + ogs_socknode_t *snode = NULL; + ogs_sock_t *sock = NULL; mme_sgw_t *sgw = NULL; - rv = gtp_server_list(&mme_self()->gtpc_list, _gtpv2_c_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = gtp_server_list(&mme_self()->gtpc_list6, _gtpv2_c_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_list_for_each(&mme_self()->gtpc_list, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(mme_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, NULL); + ogs_assert(snode->poll); + } + ogs_list_for_each(&mme_self()->gtpc_list6, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(mme_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, NULL); + ogs_assert(snode->poll); + } mme_self()->gtpc_sock = gtp_local_sock_first(&mme_self()->gtpc_list); mme_self()->gtpc_sock6 = gtp_local_sock_first(&mme_self()->gtpc_list6); mme_self()->gtpc_addr = gtp_local_addr_first(&mme_self()->gtpc_list); mme_self()->gtpc_addr6 = gtp_local_addr_first(&mme_self()->gtpc_list6); - d_assert(mme_self()->gtpc_addr || mme_self()->gtpc_addr6, - return CORE_ERROR, "No GTP Server"); + ogs_assert(mme_self()->gtpc_addr || mme_self()->gtpc_addr6); mme_self()->pgw_addr = pgw_addr_find_by_family( &mme_self()->pgw_list, AF_INET); mme_self()->pgw_addr6 = pgw_addr_find_by_family( &mme_self()->pgw_list, AF_INET6); - d_assert(mme_self()->pgw_addr || mme_self()->pgw_addr6, - return CORE_ERROR,); + ogs_assert(mme_self()->pgw_addr || mme_self()->pgw_addr6); - for (sgw = list_first(&mme_self()->sgw_list); sgw; sgw = list_next(sgw)) + ogs_list_for_each(&mme_self()->sgw_list, sgw) { - rv = gtp_client(sgw->gnode); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = gtp_connect( + mme_self()->gtpc_sock, mme_self()->gtpc_sock6, sgw->gnode); + ogs_assert(rv == OGS_OK); } - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_close() +int mme_gtp_close() { - sock_delete_list(&mme_self()->gtpc_list); - sock_delete_list(&mme_self()->gtpc_list6); + ogs_socknode_t *snode = NULL; - return CORE_OK; + ogs_list_for_each(&mme_self()->gtpc_list, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + ogs_list_for_each(&mme_self()->gtpc_list6, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + + return OGS_OK; } -status_t mme_gtp_send_create_session_request(mme_sess_t *sess) +int mme_gtp_send_create_session_request(mme_sess_t *sess) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; mme_ue_t *mme_ue = NULL; mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_CREATE_SESSION_REQUEST_TYPE; h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_create_session_request(&pkbuf, h.type, sess); - d_assert(rv == CORE_OK, return CORE_ERROR, - "S11 build error"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(mme_ue->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_modify_bearer_request( +int mme_gtp_send_modify_bearer_request( mme_bearer_t *bearer, int uli_presence) { - status_t rv; + int rv; gtp_xact_t *xact = NULL; mme_ue_t *mme_ue = NULL; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_MODIFY_BEARER_REQUEST_TYPE; @@ -157,53 +172,53 @@ status_t mme_gtp_send_modify_bearer_request( rv = mme_s11_build_modify_bearer_request( &pkbuf, h.type, bearer, uli_presence); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(mme_ue->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_delete_session_request(mme_sess_t *sess) +int mme_gtp_send_delete_session_request(mme_sess_t *sess) { - status_t rv; - pkbuf_t *s11buf = NULL; + int rv; + ogs_pkbuf_t *s11buf = NULL; gtp_header_t h; gtp_xact_t *xact = NULL; mme_ue_t *mme_ue = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_DELETE_SESSION_REQUEST_TYPE; h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_delete_session_request(&s11buf, h.type, sess); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(mme_ue->gnode, &h, s11buf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); GTP_XACT_STORE_SESSION(xact, sess); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_delete_all_sessions(mme_ue_t *mme_ue) +int mme_gtp_send_delete_all_sessions(mme_ue_t *mme_ue) { - status_t rv; + int rv; mme_sess_t *sess = NULL, *next_sess = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); sess = mme_sess_first(mme_ue); while (sess != NULL) { @@ -212,17 +227,17 @@ status_t mme_gtp_send_delete_all_sessions(mme_ue_t *mme_ue) if (MME_HAVE_SGW_S1U_PATH(sess)) { mme_bearer_t *bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer,, "Null param"); + ogs_assert(bearer); - if (bearer && FSM_CHECK(&bearer->sm, esm_state_pdn_will_disconnect)) + if (bearer && + OGS_FSM_CHECK(&bearer->sm, esm_state_pdn_will_disconnect)) { - d_warn("PDN will disconnect[EBI:%d]", bearer->ebi); + ogs_warn("PDN will disconnect[EBI:%d]", bearer->ebi); } else { rv = mme_gtp_send_delete_session_request(sess); - d_assert(rv == CORE_OK, return CORE_ERROR, - "mme_gtp_send_delete_session_request error"); + ogs_assert(rv == OGS_OK); } } else @@ -233,139 +248,139 @@ status_t mme_gtp_send_delete_all_sessions(mme_ue_t *mme_ue) sess = next_sess; } - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_create_bearer_response(mme_bearer_t *bearer) +int mme_gtp_send_create_bearer_response(mme_bearer_t *bearer) { - status_t rv; + int rv; gtp_xact_t *xact = NULL; mme_ue_t *mme_ue = NULL; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); xact = bearer->xact; - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_CREATE_BEARER_RESPONSE_TYPE; h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_create_bearer_response(&pkbuf, h.type, bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(xact, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_update_bearer_response(mme_bearer_t *bearer) +int mme_gtp_send_update_bearer_response(mme_bearer_t *bearer) { - status_t rv; + int rv; gtp_xact_t *xact = NULL; mme_ue_t *mme_ue = NULL; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); xact = bearer->xact; - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_UPDATE_BEARER_RESPONSE_TYPE; h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_update_bearer_response(&pkbuf, h.type, bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(xact, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_delete_bearer_response(mme_bearer_t *bearer) +int mme_gtp_send_delete_bearer_response(mme_bearer_t *bearer) { - status_t rv; + int rv; gtp_xact_t *xact = NULL; mme_ue_t *mme_ue = NULL; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); xact = bearer->xact; - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_DELETE_BEARER_RESPONSE_TYPE; h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_delete_bearer_response(&pkbuf, h.type, bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(xact, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_release_access_bearers_request(mme_ue_t *mme_ue) +int mme_gtp_send_release_access_bearers_request(mme_ue_t *mme_ue) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_RELEASE_ACCESS_BEARERS_REQUEST_TYPE; h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_release_access_bearers_request(&pkbuf, h.type); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(mme_ue->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_create_indirect_data_forwarding_tunnel_request( +int mme_gtp_send_create_indirect_data_forwarding_tunnel_request( mme_ue_t *mme_ue) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE; @@ -373,39 +388,39 @@ status_t mme_gtp_send_create_indirect_data_forwarding_tunnel_request( rv = mme_s11_build_create_indirect_data_forwarding_tunnel_request( &pkbuf, h.type, mme_ue); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(mme_ue->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_gtp_send_delete_indirect_data_forwarding_tunnel_request( +int mme_gtp_send_delete_indirect_data_forwarding_tunnel_request( mme_ue_t *mme_ue) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE; h.teid = mme_ue->sgw_s11_teid; - pkbuf = pkbuf_alloc(TLV_MAX_HEADROOM, 0); - d_assert(pkbuf, return CORE_ERROR, "S11 build error"); + pkbuf = ogs_pkbuf_alloc(NULL, TLV_MAX_HEADROOM); + ogs_pkbuf_reserve(pkbuf, TLV_MAX_HEADROOM); xact = gtp_xact_local_create(mme_ue->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/mme_gtp_path.h b/src/mme/mme_gtp_path.h index 115be3978..f425dc67a 100644 --- a/src/mme/mme_gtp_path.h +++ b/src/mme/mme_gtp_path.h @@ -1,30 +1,28 @@ #ifndef __MME_S11_PATH_H__ #define __MME_S11_PATH_H__ -#include "core_pkbuf.h" - #include "mme_context.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) mme_gtp_open(); -CORE_DECLARE(status_t) mme_gtp_close(); +int mme_gtp_open(); +int mme_gtp_close(); -CORE_DECLARE(status_t) mme_gtp_send_create_session_request(mme_sess_t *sess); -CORE_DECLARE(status_t) mme_gtp_send_modify_bearer_request( +int mme_gtp_send_create_session_request(mme_sess_t *sess); +int mme_gtp_send_modify_bearer_request( mme_bearer_t *bearer, int uli_presence); -CORE_DECLARE(status_t) mme_gtp_send_delete_session_request(mme_sess_t *sess); -CORE_DECLARE(status_t) mme_gtp_send_delete_all_sessions(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_gtp_send_create_bearer_response(mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_gtp_send_update_bearer_response(mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_gtp_send_delete_bearer_response(mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_gtp_send_release_access_bearers_request(mme_ue_t *mme_ue); +int mme_gtp_send_delete_session_request(mme_sess_t *sess); +int mme_gtp_send_delete_all_sessions(mme_ue_t *mme_ue); +int mme_gtp_send_create_bearer_response(mme_bearer_t *bearer); +int mme_gtp_send_update_bearer_response(mme_bearer_t *bearer); +int mme_gtp_send_delete_bearer_response(mme_bearer_t *bearer); +int mme_gtp_send_release_access_bearers_request(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_gtp_send_create_indirect_data_forwarding_tunnel_request( +int mme_gtp_send_create_indirect_data_forwarding_tunnel_request( mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_gtp_send_delete_indirect_data_forwarding_tunnel_request( +int mme_gtp_send_delete_indirect_data_forwarding_tunnel_request( mme_ue_t *mme_ue); #ifdef __cplusplus diff --git a/src/mme/mme_init.c b/src/mme/mme_init.c index a456d6a8a..08ffe1067 100644 --- a/src/mme/mme_init.c +++ b/src/mme/mme_init.c @@ -1,69 +1,59 @@ -#define TRACE_MODULE _mme_init - -#include "core_debug.h" -#include "core_thread.h" -#include "core_msgq.h" -#include "core_fsm.h" - #include "gtp/gtp_xact.h" -#include "common/context.h" +#include "app/context.h" + +#include "mme_context.h" +#include "mme_sm.h" #include "mme_event.h" #include "mme_fd_path.h" #include "s1ap_path.h" -#include "mme_sm.h" - -static thread_id sm_thread; -static void *THREAD_FUNC sm_main(thread_id id, void *data); - -static thread_id net_thread; -static void *THREAD_FUNC net_main(thread_id id, void *data); +static ogs_thread_t *thread; +static void mme_main(void *data); static int initialized = 0; -status_t mme_initialize() +int mme_initialize() { - status_t rv; + int rv; rv = mme_context_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = mme_context_parse_config(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - rv = mme_context_setup_trace_module(); - if (rv != CORE_OK) return rv; + rv = context_setup_log_module(); + if (rv != OGS_OK) return rv; rv = mme_m_tmsi_pool_generate(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = mme_fd_init(); - if (rv != CORE_OK) return CORE_ERROR; + if (rv != OGS_OK) return OGS_ERROR; #define USRSCTP_LOCAL_UDP_PORT 9899 rv = s1ap_init( - context_self()->parameter.sctp_streams, + context_self()->config.parameter.sctp_streams, USRSCTP_LOCAL_UDP_PORT); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - rv = thread_create(&sm_thread, NULL, sm_main, NULL); - if (rv != CORE_OK) return rv; - rv = thread_create(&net_thread, NULL, net_main, NULL); - if (rv != CORE_OK) return rv; + thread = ogs_thread_create(mme_main, NULL); + if (!thread) return OGS_ERROR; initialized = 1; - return CORE_OK; + return OGS_OK; } void mme_terminate(void) { if (!initialized) return; - thread_delete(net_thread); - thread_delete(sm_thread); + mme_event_term(); + + ogs_thread_destroy(thread); mme_fd_final(); @@ -72,70 +62,48 @@ void mme_terminate(void) s1ap_final(); gtp_xact_final(); + + mme_event_final(); } -static void *THREAD_FUNC sm_main(thread_id id, void *data) +static void mme_main(void *data) { - event_t event; - fsm_t mme_sm; - c_time_t prev_tm, now_tm; - status_t rv; + ogs_fsm_t mme_sm; + int rv; - memset(&event, 0, sizeof(event_t)); + mme_event_init(); + gtp_xact_init(mme_self()->timer_mgr); - mme_self()->queue_id = event_create(MSGQ_O_BLOCK); - d_assert(mme_self()->queue_id, return NULL, - "MME event queue creation failed"); - tm_service_init(&mme_self()->tm_service); - gtp_xact_init(&mme_self()->tm_service, - MME_EVT_S11_T3_RESPONSE, MME_EVT_S11_T3_HOLDING); + ogs_fsm_create(&mme_sm, mme_state_initial, mme_state_final); + ogs_fsm_init(&mme_sm, 0); - fsm_create(&mme_sm, mme_state_initial, mme_state_final); - fsm_init(&mme_sm, 0); - - prev_tm = time_now(); - -#define EVENT_LOOP_TIMEOUT 50 /* 50ms */ - while ((!thread_should_stop())) + for ( ;; ) { - rv = event_timedrecv(mme_self()->queue_id, &event, EVENT_LOOP_TIMEOUT); + ogs_pollset_poll(mme_self()->pollset, + ogs_timer_mgr_next(mme_self()->timer_mgr)); - d_assert(rv != CORE_ERROR, continue, - "While receiving a event message, error occurs"); + ogs_timer_mgr_expire(mme_self()->timer_mgr); - now_tm = time_now(); - - /* if the gap is over 10 ms, execute preriodic jobs */ - if (now_tm - prev_tm > EVENT_LOOP_TIMEOUT * 1000) + for ( ;; ) { - tm_execute_tm_service( - &mme_self()->tm_service, mme_self()->queue_id); + mme_event_t *e = NULL; - prev_tm = now_tm; + rv = ogs_queue_trypop(mme_self()->queue, (void**)&e); + ogs_assert(rv != OGS_ERROR); + + if (rv == OGS_DONE) + goto done; + + if (rv == OGS_RETRY) + break; + + ogs_assert(e); + ogs_fsm_dispatch(&mme_sm, e); + mme_event_free(e); } - - if (rv == CORE_TIMEUP) - { - continue; - } - - fsm_dispatch(&mme_sm, (fsm_event_t*)&event); } +done: - fsm_final(&mme_sm, 0); - fsm_clear(&mme_sm); - - event_delete(mme_self()->queue_id); - - return NULL; -} - -static void *THREAD_FUNC net_main(thread_id id, void *data) -{ - while (!thread_should_stop()) - { - sock_select_loop(EVENT_LOOP_TIMEOUT); - } - - return NULL; + ogs_fsm_fini(&mme_sm, 0); + ogs_fsm_delete(&mme_sm); } diff --git a/src/mme/mme_kdf.c b/src/mme/mme_kdf.c index 80ff830df..f62dc53a6 100644 --- a/src/mme/mme_kdf.c +++ b/src/mme/mme_kdf.c @@ -1,12 +1,10 @@ -#define TRACE_MODULE _mme_kdf +#include "ogs-crypt.h" -#include "core_sha2_hmac.h" - -void mme_kdf_nas(c_uint8_t algorithm_type_distinguishers, - c_uint8_t algorithm_identity, c_uint8_t *kasme, c_uint8_t *knas) +void mme_kdf_nas(uint8_t algorithm_type_distinguishers, + uint8_t algorithm_identity, uint8_t *kasme, uint8_t *knas) { - c_uint8_t s[7]; - c_uint8_t out[32]; + uint8_t s[7]; + uint8_t out[32]; s[0] = 0x15; /* FC Value */ @@ -18,13 +16,13 @@ void mme_kdf_nas(c_uint8_t algorithm_type_distinguishers, s[5] = 0x00; s[6] = 0x01; - hmac_sha256(kasme, 32, s, 7, out, 32); + ogs_hmac_sha256(kasme, 32, s, 7, out, 32); memcpy(knas, out+16, 16); } -void mme_kdf_enb(c_uint8_t *kasme, c_uint32_t ul_count, c_uint8_t *kenb) +void mme_kdf_enb(uint8_t *kasme, uint32_t ul_count, uint8_t *kenb) { - c_uint8_t s[7]; + uint8_t s[7]; s[0] = 0x11; /* FC Value */ @@ -34,12 +32,12 @@ void mme_kdf_enb(c_uint8_t *kasme, c_uint32_t ul_count, c_uint8_t *kenb) s[5] = 0x00; s[6] = 0x04; - hmac_sha256(kasme, 32, s, 7, kenb, 32); + ogs_hmac_sha256(kasme, 32, s, 7, kenb, 32); } -void mme_kdf_nh(c_uint8_t *kasme, c_uint8_t *sync_input, c_uint8_t *kenb) +void mme_kdf_nh(uint8_t *kasme, uint8_t *sync_input, uint8_t *kenb) { - c_uint8_t s[35]; + uint8_t s[35]; s[0] = 0x12; /* FC Value */ @@ -48,5 +46,5 @@ void mme_kdf_nh(c_uint8_t *kasme, c_uint8_t *sync_input, c_uint8_t *kenb) s[33] = 0x00; s[34] = 0x20; - hmac_sha256(kasme, 32, s, 35, kenb, 32); + ogs_hmac_sha256(kasme, 32, s, 35, kenb, 32); } diff --git a/src/mme/mme_kdf.h b/src/mme/mme_kdf.h index 3ec6577ac..463f2486f 100644 --- a/src/mme/mme_kdf.h +++ b/src/mme/mme_kdf.h @@ -1,8 +1,6 @@ #ifndef __MME_KDF_H__ #define __MME_KDF_H__ -#include "core.h" - #include "nas/nas_ies.h" /* Algorithm Type Distinguishers */ @@ -16,13 +14,11 @@ #define NAS_SECURITY_ALGORITHMS_128_EIA3_EEA3 3 */ -CORE_DECLARE(void) mme_kdf_nas(c_uint8_t algorithm_type_distinguishers, - c_uint8_t algorithm_identity, c_uint8_t *kasme, c_uint8_t *knas); +void mme_kdf_nas(uint8_t algorithm_type_distinguishers, + uint8_t algorithm_identity, uint8_t *kasme, uint8_t *knas); -CORE_DECLARE(void) mme_kdf_enb( - c_uint8_t *kasme, c_uint32_t ul_count, c_uint8_t *kenb); +void mme_kdf_enb(uint8_t *kasme, uint32_t ul_count, uint8_t *kenb); -CORE_DECLARE(void) mme_kdf_nh( - c_uint8_t *kasme, c_uint8_t *sync_input, c_uint8_t *kenb); +void mme_kdf_nh(uint8_t *kasme, uint8_t *sync_input, uint8_t *kenb); #endif /* __MME_KDF_H__ */ diff --git a/src/mme/mme_path.c b/src/mme/mme_path.c index 1d578f5aa..09ef3a90a 100644 --- a/src/mme/mme_path.c +++ b/src/mme/mme_path.c @@ -1,74 +1,69 @@ -#define TRACE_MODULE _mme_path - #include "s1ap_path.h" #include "nas_path.h" #include "mme_gtp_path.h" #include "mme_path.h" -status_t mme_send_delete_session_or_detach(mme_ue_t *mme_ue) +int mme_send_delete_session_or_detach(mme_ue_t *mme_ue) { - status_t rv; + int rv; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) { rv = mme_gtp_send_delete_all_sessions(mme_ue); - d_assert(rv == CORE_OK,, - "mme_gtp_send_delete_all_sessions failed"); + ogs_assert(rv == OGS_OK); } else { rv = nas_send_detach_accept(mme_ue); - d_assert(rv == CORE_OK,, - "nas_send_detach_accept failed"); + ogs_assert(rv == OGS_OK); } return rv; } -status_t mme_send_delete_session_or_ue_context_release( +int mme_send_delete_session_or_ue_context_release( mme_ue_t *mme_ue, enb_ue_t *enb_ue) { - status_t rv; + int rv; - d_assert(enb_ue, return CORE_ERROR,); + ogs_assert(enb_ue); if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) { rv = mme_gtp_send_delete_all_sessions(mme_ue); - d_assert(rv == CORE_OK,, - "mme_gtp_send_delete_all_sessions failed"); + ogs_assert(rv == OGS_OK); } else { rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } return rv; } -status_t mme_send_release_access_bearer_or_ue_context_release( +int mme_send_release_access_bearer_or_ue_context_release( mme_ue_t *mme_ue, enb_ue_t *enb_ue) { - status_t rv; + int rv; - d_assert(enb_ue, return CORE_ERROR,); + ogs_assert(enb_ue); if (BEARER_CONTEXT_IS_ACTIVE(mme_ue)) { rv = mme_gtp_send_release_access_bearers_request(mme_ue); - d_assert(rv == CORE_OK,, "gtp send failed"); + ogs_assert(rv == OGS_OK); } else { rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_S1_NORMAL_RELEASE, 0); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } return rv; diff --git a/src/mme/mme_path.h b/src/mme/mme_path.h index 6fe8285bb..a2c62e6e9 100644 --- a/src/mme/mme_path.h +++ b/src/mme/mme_path.h @@ -1,18 +1,16 @@ #ifndef __MME_PATH_H__ #define __MME_PATH_H__ -#include "core_errno.h" - #include "mme_context.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) mme_send_delete_session_or_detach(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) mme_send_delete_session_or_ue_context_release( +int mme_send_delete_session_or_detach(mme_ue_t *mme_ue); +int mme_send_delete_session_or_ue_context_release( mme_ue_t *mme_ue, enb_ue_t *enb_ue); -CORE_DECLARE(status_t) mme_send_release_access_bearer_or_ue_context_release( +int mme_send_release_access_bearer_or_ue_context_release( mme_ue_t *mme_ue, enb_ue_t *enb_ue); #ifdef __cplusplus diff --git a/src/mme/mme_s11_build.c b/src/mme/mme_s11_build.c index f0e23e133..759ebc3f7 100644 --- a/src/mme/mme_s11_build.c +++ b/src/mme/mme_s11_build.c @@ -1,8 +1,3 @@ -#define TRACE_MODULE _mme_s11_build - -#include "core_debug.h" -#include "3gpp_types.h" - #include "gtp/gtp_types.h" #include "gtp/gtp_conv.h" #include "gtp/gtp_message.h" @@ -12,10 +7,10 @@ #include "mme_s11_build.h" -status_t mme_s11_build_create_session_request( - pkbuf_t **pkbuf, c_uint8_t type, mme_sess_t *sess) +int mme_s11_build_create_session_request( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_sess_t *sess) { - status_t rv; + int rv; pdn_t *pdn = NULL; mme_ue_t *mme_ue = NULL; mme_bearer_t *bearer = NULL; @@ -30,23 +25,24 @@ status_t mme_s11_build_create_session_request( gtp_bearer_qos_t bearer_qos; char bearer_qos_buf[GTP_BEARER_QOS_LEN]; gtp_ue_timezone_t ue_timezone; - time_exp_t time_exp; - c_int8_t apn[MAX_APN_LEN]; + struct timeval now; + struct tm time_exp; + char apn[MAX_APN_LEN]; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); pdn = sess->pdn; - d_assert(pdn, return CORE_ERROR, "Null param"); + ogs_assert(pdn); bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Create Session Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Create Session Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); memset(>p_message, 0, sizeof(gtp_message_t)); - d_assert(mme_ue->imsi_len, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue->imsi_len); req->imsi.presence = 1; req->imsi.data = mme_ue->imsi; req->imsi.len = mme_ue->imsi_len; @@ -75,7 +71,7 @@ status_t mme_s11_build_create_session_request( mme_s11_teid.teid = htonl(mme_ue->mme_s11_teid); rv = gtp_sockaddr_to_f_teid( mme_self()->gtpc_addr, mme_self()->gtpc_addr6, &mme_s11_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); req->sender_f_teid_for_control_plane.presence = 1; req->sender_f_teid_for_control_plane.data = &mme_s11_teid; req->sender_f_teid_for_control_plane.len = len; @@ -117,7 +113,7 @@ status_t mme_s11_build_create_session_request( { rv = gtp_sockaddr_to_f_teid( mme_self()->pgw_addr, mme_self()->pgw_addr6, &pgw_s5c_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); req->pgw_s5_s8_address_for_control_plane_or_pmip.presence = 1; req->pgw_s5_s8_address_for_control_plane_or_pmip.data = &pgw_s5c_teid; req->pgw_s5_s8_address_for_control_plane_or_pmip.len = len; @@ -131,29 +127,25 @@ status_t mme_s11_build_create_session_request( req->selection_mode.u8 = GTP_SELECTION_MODE_MS_OR_NETWORK_PROVIDED_APN | 0xfc; - d_assert(sess->request_type.pdn_type == + ogs_assert(sess->request_type.pdn_type == NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV4 || sess->request_type.pdn_type == NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV6 || sess->request_type.pdn_type == - NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV4V6, return CORE_ERROR, - "UE PDN Configuration Error(%d)", sess->request_type.pdn_type); + NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV4V6); if (pdn->pdn_type == HSS_PDN_TYPE_IPV4 || pdn->pdn_type == HSS_PDN_TYPE_IPV6 || pdn->pdn_type == HSS_PDN_TYPE_IPV4V6) { req->pdn_type.u8 = ((pdn->pdn_type + 1) & sess->request_type.pdn_type); - d_assert(req->pdn_type.u8 != 0, return CORE_ERROR, - "PDN Configuration Error:(%d, %d)", - pdn->pdn_type, sess->request_type.pdn_type); + ogs_assert(req->pdn_type.u8 != 0); } else if (pdn->pdn_type == HSS_PDN_TYPE_IPV4_OR_IPV6) { req->pdn_type.u8 = sess->request_type.pdn_type; } else - d_assert(0, return CORE_ERROR, - "HSS PDN Confiugration Error(%d)", pdn->pdn_type); + ogs_assert_if_reached(); req->pdn_type.presence = 1; pdn->paa.pdn_type = req->pdn_type.u8; @@ -165,7 +157,7 @@ status_t mme_s11_build_create_session_request( else if (req->pdn_type.u8 == GTP_PDN_TYPE_IPV4V6) req->pdn_address_allocation.len = PAA_IPV4V6_LEN; else - d_assert(0, return CORE_ERROR, "Not supported(%d)", req->pdn_type.u8); + ogs_assert_if_reached(); req->pdn_address_allocation.presence = 1; req->maximum_apn_restriction.presence = 1; @@ -204,7 +196,8 @@ status_t mme_s11_build_create_session_request( /* UE Time Zone */ memset(&ue_timezone, 0, sizeof(ue_timezone)); - time_exp_lt(&time_exp, time_now()); + ogs_gettimeofday(&now); + ogs_localtime(now.tv_sec, &time_exp); if (time_exp.tm_gmtoff >= 0) { ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900); @@ -222,20 +215,20 @@ status_t mme_s11_build_create_session_request( req->ue_time_zone.len = sizeof(ue_timezone); req->charging_characteristics.presence = 1; - req->charging_characteristics.data = (c_uint8_t *)"\x54\x00"; + req->charging_characteristics.data = (uint8_t *)"\x54\x00"; req->charging_characteristics.len = 2; gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_modify_bearer_request(pkbuf_t **pkbuf, - c_uint8_t type, mme_bearer_t *bearer, int uli_presence) +int mme_s11_build_modify_bearer_request(ogs_pkbuf_t **pkbuf, + uint8_t type, mme_bearer_t *bearer, int uli_presence) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_modify_bearer_request_t *req = >p_message.modify_bearer_request; @@ -246,14 +239,14 @@ status_t mme_s11_build_modify_bearer_request(pkbuf_t **pkbuf, mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Modifty Bearer Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Modifty Bearer Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); - d_trace(5, " ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]\n", + ogs_debug(" ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]", bearer->enb_s1u_teid, bearer->sgw_s1u_teid); memset(>p_message, 0, sizeof(gtp_message_t)); @@ -268,7 +261,7 @@ status_t mme_s11_build_modify_bearer_request(pkbuf_t **pkbuf, enb_s1u_teid.interface_type = GTP_F_TEID_S1_U_ENODEB_GTP_U; enb_s1u_teid.teid = htonl(bearer->enb_s1u_teid); rv = gtp_ip_to_f_teid(&bearer->enb_s1u_ip, &enb_s1u_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.presence = 1; req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.data = &enb_s1u_teid; req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.len = len; @@ -291,15 +284,15 @@ status_t mme_s11_build_modify_bearer_request(pkbuf_t **pkbuf, gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_delete_session_request( - pkbuf_t **pkbuf, c_uint8_t type, mme_sess_t *sess) +int mme_s11_build_delete_session_request( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_sess_t *sess) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_delete_session_request_t *req = >p_message.delete_session_request; @@ -310,14 +303,14 @@ status_t mme_s11_build_delete_session_request( mme_bearer_t *bearer = NULL; mme_ue_t *mme_ue = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); - d_trace(3, "[MME] Delete Session Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Delete Session Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); memset(>p_message, 0, sizeof(gtp_message_t)); @@ -345,15 +338,15 @@ status_t mme_s11_build_delete_session_request( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_create_bearer_response( - pkbuf_t **pkbuf, c_uint8_t type, mme_bearer_t *bearer) +int mme_s11_build_create_bearer_response( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_bearer_t *bearer) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_create_bearer_response_t *rsp = >p_message.create_bearer_response; @@ -363,16 +356,17 @@ status_t mme_s11_build_create_bearer_response( gtp_uli_t uli; char uli_buf[GTP_MAX_ULI_LEN]; gtp_ue_timezone_t ue_timezone; - time_exp_t time_exp; + struct timeval now; + struct tm time_exp; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Create Bearer Response\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Create Bearer Response"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); memset(>p_message, 0, sizeof(gtp_message_t)); @@ -394,7 +388,7 @@ status_t mme_s11_build_create_bearer_response( enb_s1u_teid.interface_type = GTP_F_TEID_S1_U_ENODEB_GTP_U; enb_s1u_teid.teid = htonl(bearer->enb_s1u_teid); rv = gtp_ip_to_f_teid(&bearer->enb_s1u_ip, &enb_s1u_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rsp->bearer_contexts.s1_u_enodeb_f_teid.presence = 1; rsp->bearer_contexts.s1_u_enodeb_f_teid.data = &enb_s1u_teid; rsp->bearer_contexts.s1_u_enodeb_f_teid.len = len; @@ -404,7 +398,7 @@ status_t mme_s11_build_create_bearer_response( sgw_s1u_teid.interface_type = GTP_F_TEID_S1_U_SGW_GTP_U; sgw_s1u_teid.teid = htonl(bearer->sgw_s1u_teid); rv = gtp_ip_to_f_teid(&bearer->sgw_s1u_ip, &sgw_s1u_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rsp->bearer_contexts.s4_u_sgsn_f_teid.presence = 1; rsp->bearer_contexts.s4_u_sgsn_f_teid.data = &sgw_s1u_teid; rsp->bearer_contexts.s4_u_sgsn_f_teid.len = GTP_F_TEID_IPV4_LEN; @@ -429,7 +423,8 @@ status_t mme_s11_build_create_bearer_response( /* UE Time Zone */ memset(&ue_timezone, 0, sizeof(ue_timezone)); - time_exp_lt(&time_exp, time_now()); + ogs_gettimeofday(&now); + ogs_localtime(now.tv_sec, &time_exp); if (time_exp.tm_gmtoff >= 0) { ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900); @@ -447,15 +442,15 @@ status_t mme_s11_build_create_bearer_response( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_update_bearer_response( - pkbuf_t **pkbuf, c_uint8_t type, mme_bearer_t *bearer) +int mme_s11_build_update_bearer_response( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_bearer_t *bearer) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_update_bearer_response_t *rsp = >p_message.update_bearer_response; @@ -463,16 +458,17 @@ status_t mme_s11_build_update_bearer_response( gtp_uli_t uli; char uli_buf[GTP_MAX_ULI_LEN]; gtp_ue_timezone_t ue_timezone; - time_exp_t time_exp; + struct timeval now; + struct tm time_exp; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Update Bearer Response\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Update Bearer Response"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); memset(>p_message, 0, sizeof(gtp_message_t)); @@ -509,7 +505,8 @@ status_t mme_s11_build_update_bearer_response( /* UE Time Zone */ memset(&ue_timezone, 0, sizeof(ue_timezone)); - time_exp_lt(&time_exp, time_now()); + ogs_gettimeofday(&now); + ogs_localtime(now.tv_sec, &time_exp); if (time_exp.tm_gmtoff >= 0) { ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900); @@ -527,15 +524,15 @@ status_t mme_s11_build_update_bearer_response( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_delete_bearer_response( - pkbuf_t **pkbuf, c_uint8_t type, mme_bearer_t *bearer) +int mme_s11_build_delete_bearer_response( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_bearer_t *bearer) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_delete_bearer_response_t *rsp = >p_message.delete_bearer_response; @@ -543,16 +540,17 @@ status_t mme_s11_build_delete_bearer_response( gtp_uli_t uli; char uli_buf[GTP_MAX_ULI_LEN]; gtp_ue_timezone_t ue_timezone; - time_exp_t time_exp; + struct timeval now; + struct tm time_exp; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Delete Bearer Response\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Delete Bearer Response"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); memset(>p_message, 0, sizeof(gtp_message_t)); @@ -589,7 +587,8 @@ status_t mme_s11_build_delete_bearer_response( /* UE Time Zone */ memset(&ue_timezone, 0, sizeof(ue_timezone)); - time_exp_lt(&time_exp, time_now()); + ogs_gettimeofday(&now); + ogs_localtime(now.tv_sec, &time_exp); if (time_exp.tm_gmtoff >= 0) { ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900); @@ -607,20 +606,20 @@ status_t mme_s11_build_delete_bearer_response( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_release_access_bearers_request( - pkbuf_t **pkbuf, c_uint8_t type) +int mme_s11_build_release_access_bearers_request( + ogs_pkbuf_t **pkbuf, uint8_t type) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_release_access_bearers_request_t *req = >p_message.release_access_bearers_request; - d_trace(3, "[MME] Release Access Bearers Request\n"); + ogs_debug("[MME] Release Access Bearers Request"); memset(>p_message, 0, sizeof(gtp_message_t)); req->originating_node.presence = 1; @@ -628,22 +627,22 @@ status_t mme_s11_build_release_access_bearers_request( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_downlink_data_notification_ack( - pkbuf_t **pkbuf, c_uint8_t type) +int mme_s11_build_downlink_data_notification_ack( + ogs_pkbuf_t **pkbuf, uint8_t type) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_downlink_data_notification_acknowledge_t *ack = >p_message.downlink_data_notification_acknowledge; gtp_cause_t cause; - d_trace(3, "[MME] Downlink Data Notification Ackknowledge\n"); + ogs_debug("[MME] Downlink Data Notification Ackknowledge"); memset(>p_message, 0, sizeof(gtp_message_t)); @@ -656,15 +655,15 @@ status_t mme_s11_build_downlink_data_notification_ack( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t mme_s11_build_create_indirect_data_forwarding_tunnel_request( - pkbuf_t **pkbuf, c_uint8_t type, mme_ue_t *mme_ue) +int mme_s11_build_create_indirect_data_forwarding_tunnel_request( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_ue_t *mme_ue) { - status_t rv; + int rv; int i; mme_sess_t *sess = NULL; @@ -679,10 +678,10 @@ status_t mme_s11_build_create_indirect_data_forwarding_tunnel_request( gtp_f_teid_t ul_teid[GTP_MAX_NUM_OF_INDIRECT_TUNNEL]; int len; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Create Indirect Data Forwarding Tunnel Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Create Indirect Data Forwarding Tunnel Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); gtp_bearers_in_create_indirect_tunnel_request(&bearers, req); @@ -702,8 +701,8 @@ status_t mme_s11_build_create_indirect_data_forwarding_tunnel_request( GTP_F_TEID_ENODEB_GTP_U_FOR_DL_DATA_FORWARDING; dl_teid[i].teid = htonl(bearer->enb_dl_teid); rv = gtp_ip_to_f_teid(&bearer->enb_dl_ip, &dl_teid[i], &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); - d_assert(bearers[i], return CORE_ERROR,); + ogs_assert(rv == OGS_OK); + ogs_assert(bearers[i]); bearers[i]->s1_u_enodeb_f_teid.presence = 1; bearers[i]->s1_u_enodeb_f_teid.data = &dl_teid[i]; bearers[i]->s1_u_enodeb_f_teid.len = len; @@ -716,8 +715,8 @@ status_t mme_s11_build_create_indirect_data_forwarding_tunnel_request( GTP_F_TEID_ENODEB_GTP_U_FOR_UL_DATA_FORWARDING; ul_teid[i].teid = htonl(bearer->enb_ul_teid); rv = gtp_ip_to_f_teid(&bearer->enb_ul_ip, &ul_teid[i], &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); - d_assert(bearers[i], return CORE_ERROR,); + ogs_assert(rv == OGS_OK); + ogs_assert(bearers[i]); bearers[i]->s12_rnc_f_teid.presence = 1; bearers[i]->s12_rnc_f_teid.data = &ul_teid[i]; bearers[i]->s12_rnc_f_teid.len = len; @@ -739,7 +738,7 @@ status_t mme_s11_build_create_indirect_data_forwarding_tunnel_request( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/mme_s11_build.h b/src/mme/mme_s11_build.h index df892885b..e3058f73a 100644 --- a/src/mme/mme_s11_build.h +++ b/src/mme/mme_s11_build.h @@ -7,25 +7,24 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) mme_s11_build_create_session_request( - pkbuf_t **pkbuf, c_uint8_t type, mme_sess_t *sess); -CORE_DECLARE(status_t) mme_s11_build_modify_bearer_request(pkbuf_t **pkbuf, - c_uint8_t type, mme_bearer_t *bearer, int uli_presense); -CORE_DECLARE(status_t) mme_s11_build_delete_session_request( - pkbuf_t **pkbuf, c_uint8_t type, mme_sess_t *sess); -CORE_DECLARE(status_t) mme_s11_build_create_bearer_response( - pkbuf_t **pkbuf, c_uint8_t type, mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_s11_build_update_bearer_response( - pkbuf_t **pkbuf, c_uint8_t type, mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_s11_build_delete_bearer_response( - pkbuf_t **pkbuf, c_uint8_t type, mme_bearer_t *bearer); -CORE_DECLARE(status_t) mme_s11_build_release_access_bearers_request( - pkbuf_t **pkbuf, c_uint8_t type); -CORE_DECLARE(status_t) mme_s11_build_downlink_data_notification_ack( - pkbuf_t **pkbuf, c_uint8_t type); -CORE_DECLARE(status_t) - mme_s11_build_create_indirect_data_forwarding_tunnel_request( - pkbuf_t **pkbuf, c_uint8_t type, mme_ue_t *mme_ue); +int mme_s11_build_create_session_request( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_sess_t *sess); +int mme_s11_build_modify_bearer_request(ogs_pkbuf_t **pkbuf, + uint8_t type, mme_bearer_t *bearer, int uli_presense); +int mme_s11_build_delete_session_request( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_sess_t *sess); +int mme_s11_build_create_bearer_response( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_bearer_t *bearer); +int mme_s11_build_update_bearer_response( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_bearer_t *bearer); +int mme_s11_build_delete_bearer_response( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_bearer_t *bearer); +int mme_s11_build_release_access_bearers_request( + ogs_pkbuf_t **pkbuf, uint8_t type); +int mme_s11_build_downlink_data_notification_ack( + ogs_pkbuf_t **pkbuf, uint8_t type); +int mme_s11_build_create_indirect_data_forwarding_tunnel_request( + ogs_pkbuf_t **pkbuf, uint8_t type, mme_ue_t *mme_ue); #ifdef __cplusplus } diff --git a/src/mme/mme_s11_handler.c b/src/mme/mme_s11_handler.c index ade0be24c..d4d46710c 100644 --- a/src/mme/mme_s11_handler.c +++ b/src/mme/mme_s11_handler.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _mme_s11_handler - -#include "core_debug.h" - #include "gtp/gtp_types.h" #include "gtp/gtp_conv.h" #include "gtp/gtp_xact.h" @@ -21,7 +17,7 @@ void mme_s11_handle_create_session_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_create_session_response_t *rsp) { - status_t rv; + int rv; gtp_f_teid_t *sgw_s11_teid = NULL; gtp_f_teid_t *sgw_s1u_teid = NULL; @@ -29,47 +25,47 @@ void mme_s11_handle_create_session_response( mme_sess_t *sess = NULL; pdn_t *pdn = NULL; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(rsp, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(rsp); - d_trace(3, "[MME] Create Session Response\n"); + ogs_debug("[MME] Create Session Response"); if (rsp->sender_f_teid_for_control_plane.presence == 0) { - d_error("No S11 TEID"); + ogs_error("No S11 TEID"); return; } if (rsp->pdn_address_allocation.presence == 0) { - d_error("No PDN Address Allocation"); + ogs_error("No PDN Address Allocation"); return; } if (rsp->bearer_contexts_created.s1_u_enodeb_f_teid.presence == 0) { - d_error("No S1U TEID"); + ogs_error("No S1U TEID"); return; } if (rsp->bearer_contexts_created.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (rsp->bearer_contexts_created. eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } - d_assert(mme_ue, return, "Null param"); + ogs_assert(mme_ue); bearer = mme_bearer_find_by_ue_ebi(mme_ue, rsp->bearer_contexts_created.eps_bearer_id.u8); - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); pdn = sess->pdn; - d_assert(pdn, return, "Null param"); + ogs_assert(pdn); /* Control Plane(UL) : SGW-S11 */ sgw_s11_teid = rsp->sender_f_teid_for_control_plane.data; @@ -88,122 +84,116 @@ void mme_s11_handle_create_session_response( sgw_s1u_teid = rsp->bearer_contexts_created.s1_u_enodeb_f_teid.data; bearer->sgw_s1u_teid = ntohl(sgw_s1u_teid->teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); - d_trace(5, " ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]\n", + ogs_debug(" ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]", bearer->enb_s1u_teid, bearer->sgw_s1u_teid); rv = gtp_f_teid_to_ip(sgw_s1u_teid, &bearer->sgw_s1u_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); - if (FSM_CHECK(&mme_ue->sm, emm_state_initial_context_setup)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_initial_context_setup)) { rv = nas_send_attach_accept(mme_ue); - d_assert(rv == CORE_OK, return, "nas_send_attach_accept failed"); + ogs_assert(rv == OGS_OK); } - else if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + else if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { rv = nas_send_activate_default_bearer_context_request(bearer); - d_assert(rv == CORE_OK, return, "nas send failed"); + ogs_assert(rv == OGS_OK); } else - d_assert(0,, "Invalid EMM state"); + ogs_assert_if_reached(); } void mme_s11_handle_modify_bearer_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_modify_bearer_response_t *rsp) { - status_t rv; + int rv; enb_ue_t *source_ue = NULL, *target_ue = NULL; - d_assert(mme_ue, return, "Null param"); - d_assert(xact, goto cleanup, "Null param"); - d_assert(rsp, goto cleanup, "Null param"); + ogs_assert(mme_ue); + ogs_assert(xact); + ogs_assert(rsp); - d_trace(3, "[MME] Modify Bearer Response\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Modify Bearer Response"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, goto cleanup, "xact_commit error"); + ogs_assert(rv == OGS_OK); GTP_COUNTER_CHECK(mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_PATH_SWITCH, rv = s1ap_send_path_switch_ack(mme_ue); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); ); GTP_COUNTER_CHECK(mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_HANDOVER_NOTIFY, target_ue = mme_ue->enb_ue; - d_assert(target_ue, return, "Null param"); + ogs_assert(target_ue); source_ue = target_ue->source_ue; - d_assert(source_ue, return, "Null param"); + ogs_assert(source_ue); rv = s1ap_send_ue_context_release_command(source_ue, S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_successful_handover, - S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, 300); - d_assert(rv == CORE_OK,, "s1ap send error"); + S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, + ogs_time_from_msec(300)); + ogs_assert(rv == OGS_OK); ); - - return; - -cleanup: - GTP_COUNTER_CHECK(mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_PATH_SWITCH,); - GTP_COUNTER_CHECK(mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_HANDOVER_NOTIFY,); } void mme_s11_handle_delete_session_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_delete_session_response_t *rsp) { - status_t rv; + int rv; mme_sess_t *sess = NULL; - d_assert(mme_ue, return, "Null param"); - d_assert(xact, return, "Null param"); + ogs_assert(mme_ue); + ogs_assert(xact); sess = GTP_XACT_RETRIEVE_SESSION(xact); - d_assert(sess, return, "Null param"); - d_assert(rsp, goto cleanup, "Null param"); + ogs_assert(sess); + ogs_assert(rsp); - d_trace(3, "[MME] Delete Session Response\n"); + ogs_debug("[MME] Delete Session Response"); if (rsp->cause.presence == 0) { - d_error("No Cause"); + ogs_error("No Cause"); goto cleanup; } - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, goto cleanup, "xact_commit error"); + ogs_assert(rv == OGS_OK); - if (FSM_CHECK(&mme_ue->sm, emm_state_authentication)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_authentication)) { if (mme_sess_count(mme_ue) == 1) /* Last Session */ { mme_s6a_send_air(mme_ue, NULL); } } - else if (FSM_CHECK(&mme_ue->sm, emm_state_de_registered)) + else if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_de_registered)) { if (mme_sess_count(mme_ue) == 1) /* Last Session */ { rv = nas_send_detach_accept(mme_ue); - d_assert(rv == CORE_OK,, "nas_send_detach_accept failed"); + ogs_assert(rv == OGS_OK); } } - else if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + else if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { mme_bearer_t *bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, goto cleanup, "Null param"); + ogs_assert(bearer); - if (FSM_CHECK(&bearer->sm, esm_state_pdn_will_disconnect)) + if (OGS_FSM_CHECK(&bearer->sm, esm_state_pdn_will_disconnect)) { rv = nas_send_deactivate_bearer_context_request(bearer); - d_assert(rv == CORE_OK,, - "nas_send_deactivate_bearer_context_request failed"); + ogs_assert(rv == OGS_OK); /* * mme_sess_remove() should not be called here. @@ -214,26 +204,26 @@ void mme_s11_handle_delete_session_response( return; } else - d_assert(0,, "Invalid ESM state"); + ogs_assert_if_reached(); } - else if (FSM_CHECK(&mme_ue->sm, emm_state_initial_context_setup) || - FSM_CHECK(&mme_ue->sm, emm_state_exception)) + else if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_initial_context_setup) || + OGS_FSM_CHECK(&mme_ue->sm, emm_state_exception)) { if (mme_sess_count(mme_ue) == 1) /* Last Session */ { enb_ue_t *enb_ue = NULL; enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, goto cleanup, ); + ogs_assert(enb_ue); rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } } else - d_assert(0,, "Invalid EMM state"); + ogs_assert_if_reached(); cleanup: if (mme_sess_count(mme_ue) == 1) /* Last Session */ @@ -245,70 +235,69 @@ cleanup: void mme_s11_handle_create_bearer_request( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_create_bearer_request_t *req) { - status_t rv; + int rv; mme_bearer_t *bearer = NULL, *default_bearer = NULL; mme_sess_t *sess = NULL; gtp_f_teid_t *sgw_s1u_teid = NULL; gtp_bearer_qos_t bearer_qos; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(req); - d_trace(3, "[MME] Create Bearer Response\n"); + ogs_debug("[MME] Create Bearer Response"); if (req->linked_eps_bearer_id.presence == 0) { - d_error("No Linked EBI"); + ogs_error("No Linked EBI"); return; } if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } if (req->bearer_contexts.s1_u_enodeb_f_teid.presence == 0) { - d_error("No GTP TEID"); + ogs_error("No GTP TEID"); return; } if (req->bearer_contexts.bearer_level_qos.presence == 0) { - d_error("No QoS"); + ogs_error("No QoS"); return; } if (req->bearer_contexts.tft.presence == 0) { - d_error("No TFT"); + ogs_error("No TFT"); return; } - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); sess = mme_sess_find_by_ebi(mme_ue, req->linked_eps_bearer_id.u8); - d_assert(sess, return, - "No Session Context(EBI:%d)", req->linked_eps_bearer_id); + ogs_assert(sess); bearer = mme_bearer_add(sess); - d_assert(bearer, return, "No Bearer Context"); + ogs_assert(bearer); /* Data Plane(UL) : SGW-S1U */ sgw_s1u_teid = req->bearer_contexts.s1_u_enodeb_f_teid.data; bearer->sgw_s1u_teid = ntohl(sgw_s1u_teid->teid); rv = gtp_f_teid_to_ip(sgw_s1u_teid, &bearer->sgw_s1u_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); /* Bearer QoS */ - d_assert(gtp_parse_bearer_qos(&bearer_qos, + ogs_assert(gtp_parse_bearer_qos(&bearer_qos, &req->bearer_contexts.bearer_level_qos) == - req->bearer_contexts.bearer_level_qos.len, return,); + req->bearer_contexts.bearer_level_qos.len); bearer->qos.qci = bearer_qos.qci; bearer->qos.arp.priority_level = bearer_qos.priority_level; bearer->qos.arp.pre_emption_capability = @@ -328,55 +317,53 @@ void mme_s11_handle_create_bearer_request( /* Before Activate DEDICATED bearer, we'll check DEFAULT bearer status */ default_bearer = mme_default_bearer_in_sess(sess); - d_assert(default_bearer, return,); + ogs_assert(default_bearer); if (/* Check if Activate Default Bearer Accept is received */ - FSM_CHECK(&default_bearer->sm, esm_state_active) && + OGS_FSM_CHECK(&default_bearer->sm, esm_state_active) && /* Check if Initial Context Setup Response or * E-RAB Setup Response is received */ MME_HAVE_ENB_S1U_PATH(default_bearer)) { rv = nas_send_activate_dedicated_bearer_context_request(bearer); - d_assert(rv == CORE_OK, return, - "nas_send_activate_dedicated_bearer_context failed"); + ogs_assert(rv == OGS_OK); } } void mme_s11_handle_update_bearer_request( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_update_bearer_request_t *req) { - status_t rv; + int rv; mme_bearer_t *bearer = NULL; gtp_bearer_qos_t bearer_qos; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(req); - d_trace(3, "[MME] Update Bearer Request\n"); + ogs_debug("[MME] Update Bearer Request"); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); bearer = mme_bearer_find_by_ue_ebi(mme_ue, req->bearer_contexts.eps_bearer_id.u8); - d_assert(bearer, return, - "No Bearer Context(EBI:%d)", req->bearer_contexts.eps_bearer_id.u8); + ogs_assert(bearer); /* Save Transaction. will be handled after EMM-attached */ bearer->xact = xact; if (/* Check if Activate Default/Dedicated Bearer Accept is received */ - FSM_CHECK(&bearer->sm, esm_state_active) && + OGS_FSM_CHECK(&bearer->sm, esm_state_active) && /* Check if Initial Context Setup Response or * E-RAB Setup Response is received */ MME_HAVE_ENB_S1U_PATH(bearer)) @@ -384,9 +371,9 @@ void mme_s11_handle_update_bearer_request( if (req->bearer_contexts.bearer_level_qos.presence == 1) { /* Bearer QoS */ - d_assert(gtp_parse_bearer_qos(&bearer_qos, + ogs_assert(gtp_parse_bearer_qos(&bearer_qos, &req->bearer_contexts.bearer_level_qos) == - req->bearer_contexts.bearer_level_qos.len, return,); + req->bearer_contexts.bearer_level_qos.len); bearer->qos.qci = bearer_qos.qci; bearer->qos.arp.priority_level = bearer_qos.priority_level; bearer->qos.arp.pre_emption_capability = @@ -412,30 +399,28 @@ void mme_s11_handle_update_bearer_request( bearer, req->bearer_contexts.bearer_level_qos.presence, req->bearer_contexts.tft.presence); - d_assert(rv == CORE_OK, return, - "nas_send_deactivate_bearer_context_request failed"); + ogs_assert(rv == OGS_OK); } else { - d_warn("[IGNORE] Update Bearer Request : " + ogs_warn("[IGNORE] Update Bearer Request : " "Both QoS and TFT is NULL"); rv = mme_gtp_send_update_bearer_response(bearer); - d_assert(rv == CORE_OK, return, - "mme_gtp_send_delete_session_request error"); + ogs_assert(rv == OGS_OK); } } else { - if (!FSM_CHECK(&bearer->sm, esm_state_active)) + if (!OGS_FSM_CHECK(&bearer->sm, esm_state_active)) { - d_assert(0,, "Invalid Bearer State"); + ogs_assert_if_reached(); } else if (!MME_HAVE_ENB_S1U_PATH(bearer)) { - d_assert(0,, "No ENB S1U PATH"); + ogs_assert_if_reached(); } else - d_assert(0,,); + ogs_assert_if_reached(); } } @@ -443,60 +428,57 @@ void mme_s11_handle_update_bearer_request( void mme_s11_handle_delete_bearer_request( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_delete_bearer_request_t *req) { - status_t rv; + int rv; mme_bearer_t *bearer = NULL; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(req); - d_trace(3, "[MME] Delete Bearer Request\n"); + ogs_debug("[MME] Delete Bearer Request"); if (req->linked_eps_bearer_id.presence == 1) { bearer = mme_bearer_find_by_ue_ebi(mme_ue, req->linked_eps_bearer_id.u8); - d_assert(bearer, return, - "No Bearer Context(EBI:%d)", req->linked_eps_bearer_id.u8); + ogs_assert(bearer); } else if (req->eps_bearer_ids.presence == 1) { bearer = mme_bearer_find_by_ue_ebi( mme_ue, req->eps_bearer_ids.u8); - d_assert(bearer, return, - "No Bearer Context(EBI:%d)", req->eps_bearer_ids.u8); + ogs_assert(bearer); } else { - d_error("No Linked EBI or EPS Bearer ID"); + ogs_error("No Linked EBI or EPS Bearer ID"); return; } - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); /* Save Transaction. will be handled after EMM-attached */ bearer->xact = xact; if (/* Check if Activate Default/Dedicated Bearer Accept is received */ - FSM_CHECK(&bearer->sm, esm_state_active) && + OGS_FSM_CHECK(&bearer->sm, esm_state_active) && /* Check if Initial Context Setup Response or * E-RAB Setup Response is received */ MME_HAVE_ENB_S1U_PATH(bearer)) { rv = nas_send_deactivate_bearer_context_request(bearer); - d_assert(rv == CORE_OK, return, - "nas_send_deactivate_bearer_context_request failed"); + ogs_assert(rv == OGS_OK); } else { - if (!FSM_CHECK(&bearer->sm, esm_state_active)) + if (!OGS_FSM_CHECK(&bearer->sm, esm_state_active)) { - d_assert(0,, "Invalid Bearer State"); + ogs_assert_if_reached(); } else if (!MME_HAVE_ENB_S1U_PATH(bearer)) { - d_assert(0,, "No ENB S1U PATH"); + ogs_assert_if_reached(); } else - d_assert(0,,); + ogs_assert_if_reached(); } } @@ -505,52 +487,52 @@ void mme_s11_handle_release_access_bearers_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_release_access_bearers_response_t *rsp) { - status_t rv; + int rv; enb_ue_t *enb_ue = NULL; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(rsp, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(rsp); - d_trace(3, "[MME] Release Access Bearers Response\n"); + ogs_debug("[MME] Release Access Bearers Response"); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return, "Null param"); + ogs_assert(enb_ue); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK,, "xact_commit error"); + ogs_assert(rv == OGS_OK); if (rsp->cause.presence == 0) { - d_error("No Cause"); + ogs_error("No Cause"); return; } rv = CLEAR_BEARER_CONTEXT(mme_ue); - d_assert(rv == CORE_OK,, "MME_BEARER_SET_INACTIVE failed"); + ogs_assert(rv == OGS_OK); rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_S1_NORMAL_RELEASE, 0); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } void mme_s11_handle_downlink_data_notification( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_downlink_data_notification_t *noti) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *s11buf = NULL; + ogs_pkbuf_t *s11buf = NULL; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(noti, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(noti); - d_trace(3, "[MME] Downlink Data Notification\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[MME] Downlink Data Notification"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); /* Build Downlink data notification ack */ @@ -559,20 +541,20 @@ void mme_s11_handle_downlink_data_notification( h.teid = mme_ue->sgw_s11_teid; rv = mme_s11_build_downlink_data_notification_ack(&s11buf, h.type); - d_assert(rv == CORE_OK, return, "S11 build error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(xact, &h, s11buf); - d_assert(rv == CORE_OK, return, "xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void mme_s11_handle_create_indirect_data_forwarding_tunnel_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_create_indirect_data_forwarding_tunnel_response_t *rsp) { - status_t rv; + int rv; mme_bearer_t *bearer = NULL; enb_ue_t *source_ue = NULL; int i; @@ -580,24 +562,24 @@ void mme_s11_handle_create_indirect_data_forwarding_tunnel_response( tlv_bearer_context_t *bearers[GTP_MAX_NUM_OF_INDIRECT_TUNNEL]; gtp_f_teid_t *teid = NULL; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(rsp, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(rsp); source_ue = mme_ue->enb_ue; - d_assert(source_ue, return, "Null param"); + ogs_assert(source_ue); - d_trace(3, "[MME] Create Indirect Data Forwarding Tunnel Response\n"); + ogs_debug("[MME] Create Indirect Data Forwarding Tunnel Response"); if (rsp->cause.presence == 0) { - d_error("No Cause"); + ogs_error("No Cause"); return; } - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); gtp_bearers_in_create_indirect_tunnel_response(&bearers, rsp); @@ -605,60 +587,60 @@ void mme_s11_handle_create_indirect_data_forwarding_tunnel_response( { if (bearers[i]->eps_bearer_id.presence == 0) { - d_error("No EBI"); + ogs_error("No EBI"); return; } bearer = mme_bearer_find_by_ue_ebi(mme_ue, bearers[i]->eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context"); + ogs_assert(bearer); if (bearers[i]->s4_u_sgsn_f_teid.presence) { teid = bearers[i]->s4_u_sgsn_f_teid.data; - d_assert(teid, return,); + ogs_assert(teid); bearer->sgw_dl_teid = ntohl(teid->teid); rv = gtp_f_teid_to_ip(teid, &bearer->sgw_dl_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } if (bearers[i]->s2b_u_epdg_f_teid_5.presence) { teid = bearers[i]->s2b_u_epdg_f_teid_5.data; - d_assert(teid, return,); + ogs_assert(teid); bearer->sgw_ul_teid = ntohl(teid->teid); rv = gtp_f_teid_to_ip(teid, &bearer->sgw_ul_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } } rv = s1ap_send_handover_command(source_ue); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } void mme_s11_handle_delete_indirect_data_forwarding_tunnel_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_delete_indirect_data_forwarding_tunnel_response_t *rsp) { - status_t rv; + int rv; - d_assert(xact, return, "Null param"); - d_assert(mme_ue, return, "Null param"); - d_assert(rsp, return, "Null param"); + ogs_assert(xact); + ogs_assert(mme_ue); + ogs_assert(rsp); - d_trace(3, "[MME] Delete Indirect Data Forwarding Tunnel Response\n"); + ogs_debug("[MME] Delete Indirect Data Forwarding Tunnel Response"); if (rsp->cause.presence == 0) { - d_error("No Cause"); + ogs_error("No Cause"); return; } - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", mme_ue->mme_s11_teid, mme_ue->sgw_s11_teid); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK,, "xact_commit error"); + ogs_assert(rv == OGS_OK); rv = mme_ue_clear_indirect_tunnel(mme_ue); - d_assert(rv == CORE_OK,, "mme_ue_clear_indirect_tunnel() failed"); + ogs_assert(rv == OGS_OK); } diff --git a/src/mme/mme_s11_handler.h b/src/mme/mme_s11_handler.h index 86049a762..646041f02 100644 --- a/src/mme/mme_s11_handler.h +++ b/src/mme/mme_s11_handler.h @@ -9,29 +9,29 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) mme_s11_handle_create_session_response( +void mme_s11_handle_create_session_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_create_session_response_t *rsp); -CORE_DECLARE(void) mme_s11_handle_modify_bearer_response( +void mme_s11_handle_modify_bearer_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_modify_bearer_response_t *rsp); -CORE_DECLARE(void) mme_s11_handle_delete_session_response( +void mme_s11_handle_delete_session_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_delete_session_response_t *rsp); -CORE_DECLARE(void) mme_s11_handle_create_bearer_request( +void mme_s11_handle_create_bearer_request( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_create_bearer_request_t *rsp); -CORE_DECLARE(void) mme_s11_handle_update_bearer_request( +void mme_s11_handle_update_bearer_request( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_update_bearer_request_t *rsp); -CORE_DECLARE(void) mme_s11_handle_delete_bearer_request( +void mme_s11_handle_delete_bearer_request( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_delete_bearer_request_t *rsp); -CORE_DECLARE(void) mme_s11_handle_release_access_bearers_response( +void mme_s11_handle_release_access_bearers_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_release_access_bearers_response_t *rsp); -CORE_DECLARE(void) mme_s11_handle_downlink_data_notification( +void mme_s11_handle_downlink_data_notification( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_downlink_data_notification_t *noti); -CORE_DECLARE(void) mme_s11_handle_create_indirect_data_forwarding_tunnel_response( +void mme_s11_handle_create_indirect_data_forwarding_tunnel_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_create_indirect_data_forwarding_tunnel_response_t *rsp); -CORE_DECLARE(void) mme_s11_handle_delete_indirect_data_forwarding_tunnel_response( +void mme_s11_handle_delete_indirect_data_forwarding_tunnel_response( gtp_xact_t *xact, mme_ue_t *mme_ue, gtp_delete_indirect_data_forwarding_tunnel_response_t *rsp); diff --git a/src/mme/mme_s6a_handler.c b/src/mme/mme_s6a_handler.c index a5e42939b..ce08618a8 100644 --- a/src/mme/mme_s6a_handler.c +++ b/src/mme/mme_s6a_handler.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _mme_s6a_handler - -#include "core_debug.h" - #include "fd/s6a/s6a_message.h" #include "nas_path.h" #include "s1ap_path.h" @@ -11,31 +7,31 @@ void mme_s6a_handle_aia(mme_ue_t *mme_ue, s6a_aia_message_t *aia_message) { - status_t rv; + int rv; e_utran_vector_t *e_utran_vector = NULL; - d_assert(mme_ue, return, "Null param"); - d_assert(aia_message, return, "Null param"); + ogs_assert(mme_ue); + ogs_assert(aia_message); e_utran_vector = &aia_message->e_utran_vector; - d_assert(e_utran_vector, return, "Null param"); + ogs_assert(e_utran_vector); mme_ue->xres_len = e_utran_vector->xres_len; memcpy(mme_ue->xres, e_utran_vector->xres, mme_ue->xres_len); - memcpy(mme_ue->kasme, e_utran_vector->kasme, SHA256_DIGEST_SIZE); + memcpy(mme_ue->kasme, e_utran_vector->kasme, OGS_SHA256_DIGEST_SIZE); memcpy(mme_ue->rand, e_utran_vector->rand, RAND_LEN); rv = nas_send_authentication_request(mme_ue, e_utran_vector); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); } void mme_s6a_handle_ula(mme_ue_t *mme_ue, s6a_ula_message_t *ula_message) { s6a_subscription_data_t *subscription_data = NULL; - d_assert(mme_ue, return, "Null param"); - d_assert(ula_message, return, "Null param"); + ogs_assert(mme_ue); + ogs_assert(ula_message); subscription_data = &ula_message->subscription_data; - d_assert(subscription_data, return, "Null param"); + ogs_assert(subscription_data); memcpy(&mme_ue->subscription_data, subscription_data, sizeof(s6a_subscription_data_t)); diff --git a/src/mme/mme_s6a_handler.h b/src/mme/mme_s6a_handler.h index 5943dca40..254efaf8a 100644 --- a/src/mme/mme_s6a_handler.h +++ b/src/mme/mme_s6a_handler.h @@ -8,10 +8,8 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) mme_s6a_handle_aia( - mme_ue_t *mme_ue, s6a_aia_message_t *aia_message); -CORE_DECLARE(void) mme_s6a_handle_ula( - mme_ue_t *mme_ue, s6a_ula_message_t *ula_message); +void mme_s6a_handle_aia(mme_ue_t *mme_ue, s6a_aia_message_t *aia_message); +void mme_s6a_handle_ula(mme_ue_t *mme_ue, s6a_ula_message_t *ula_message); #ifdef __cplusplus } diff --git a/src/mme/mme_sm.c b/src/mme/mme_sm.c index c0e78a19d..242fc1642 100644 --- a/src/mme/mme_sm.c +++ b/src/mme/mme_sm.c @@ -1,8 +1,4 @@ -#define TRACE_MODULE _mme_sm -#include "core_debug.h" -#include "core_lib.h" - -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #include "nas/nas_message.h" #include "gtp/gtp_xact.h" #include "fd/fd_lib.h" @@ -22,159 +18,151 @@ #include "mme_s6a_handler.h" #include "mme_path.h" -void mme_state_initial(fsm_t *s, event_t *e) +void mme_state_initial(ogs_fsm_t *s, mme_event_t *e) { - mme_sm_trace(3, e); + mme_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); - FSM_TRAN(s, &mme_state_operational); + OGS_FSM_TRAN(s, &mme_state_operational); } -void mme_state_final(fsm_t *s, event_t *e) +void mme_state_final(ogs_fsm_t *s, mme_event_t *e) { - mme_sm_trace(3, e); + mme_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); } -void mme_state_operational(fsm_t *s, event_t *e) +void mme_state_operational(ogs_fsm_t *s, mme_event_t *e) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; - mme_sm_trace(3, e); + ogs_assert(e); + mme_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { rv = mme_gtp_open(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't establish S11-GTP path"); + ogs_error("Can't establish S11-GTP path"); break; } rv = s1ap_open(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't establish S1AP path"); + ogs_error("Can't establish S1AP path"); break; } break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { rv = mme_gtp_close(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't close S11-GTP path"); + ogs_error("Can't close S11-GTP path"); } rv = s1ap_close(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't close S1AP path"); + ogs_error("Can't close S1AP path"); } break; } case MME_EVT_S1AP_LO_ACCEPT: { - sock_id sock = (sock_id)event_get_param1(e); - d_assert(sock, break,); - c_sockaddr_t *addr = (c_sockaddr_t *)event_get_param2(e); - d_assert(addr, break,); + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *addr = NULL; mme_enb_t *enb = NULL; - d_trace(1, "eNB-S1 accepted[%s] in master_sm module\n", - CORE_ADDR(addr, buf)); + sock = e->enb_sock; + ogs_assert(sock); + addr = e->enb_addr; + ogs_assert(addr); + + ogs_info("eNB-S1 accepted[%s] in master_sm module", + OGS_ADDR(addr, buf)); enb = mme_enb_find_by_addr(addr); if (!enb) { -#if USE_USRSCTP != 1 - status_t rv; - - rv = sock_register(sock, s1ap_recv_handler, NULL); - d_assert(rv == CORE_OK, break, "register s1ap_recv_cb failed"); -#endif enb = mme_enb_add(sock, addr); - d_assert(enb, break, "Null param"); + ogs_assert(enb); } else { - d_warn("eNB context duplicated with IP-address [%s]!!!", - CORE_ADDR(addr, buf)); - sock_delete(sock); - d_warn("S1 Socket Closed"); + ogs_warn("eNB context duplicated with IP-address [%s]!!!", + OGS_ADDR(addr, buf)); + ogs_sock_destroy(sock); + ogs_warn("S1 Socket Closed"); } break; } case MME_EVT_S1AP_LO_SCTP_COMM_UP: { + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *addr = NULL; mme_enb_t *enb = NULL; - sock_id sock = 0; - c_sockaddr_t *addr = NULL; - c_uint16_t outbound_streams = 0; + uint16_t outbound_streams = 0; - sock = (sock_id)event_get_param1(e); - d_assert(sock, break, "Null param"); - addr = (c_sockaddr_t *)event_get_param2(e); - d_assert(addr, break, "Null param"); + sock = e->enb_sock; + ogs_assert(sock); + addr = e->enb_addr; + ogs_assert(addr); - outbound_streams = (c_uint16_t)event_get_param4(e); + outbound_streams = e->outbound_streams; enb = mme_enb_find_by_addr(addr); if (!enb) { -#if USE_USRSCTP != 1 - status_t rv; - - rv = sock_register(sock, s1ap_recv_handler, NULL); - d_assert(rv == CORE_OK, break, "register s1ap_recv_cb failed"); -#endif enb = mme_enb_add(sock, addr); - d_assert(enb, break, "Null param"); + ogs_assert(enb); } else { - CORE_FREE(addr); + ogs_free(addr); } enb->outbound_streams = - c_min(outbound_streams, enb->outbound_streams); + ogs_min(outbound_streams, enb->outbound_streams); - d_trace(3, "eNB-S1 SCTP_COMM_UP[%s] Outbound Streams[%d]\n", - CORE_ADDR(addr, buf), enb->outbound_streams); + ogs_debug("eNB-S1 SCTP_COMM_UP[%s] Outbound Streams[%d]", + OGS_ADDR(addr, buf), enb->outbound_streams); break; } case MME_EVT_S1AP_LO_CONNREFUSED: { + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *addr = NULL; mme_enb_t *enb = NULL; - sock_id sock = 0; - c_sockaddr_t *addr = NULL; - sock = (sock_id)event_get_param1(e); - d_assert(sock, break, "Null param"); - addr = (c_sockaddr_t *)event_get_param2(e); - d_assert(addr, break, "Null param"); + sock = e->enb_sock; + ogs_assert(sock); + addr = e->enb_addr; + ogs_assert(addr); enb = mme_enb_find_by_addr(addr); - CORE_FREE(addr); + ogs_free(addr); if (enb) { - d_trace(1, "eNB-S1[%x] connection refused!!!\n", enb->enb_id); + ogs_info("eNB-S1[%x] connection refused!!!", enb->enb_id); mme_enb_remove(enb); } else { - d_warn("Socket connection refused, Already Removed!"); + ogs_warn("Socket connection refused, Already Removed!"); } break; @@ -183,90 +171,52 @@ void mme_state_operational(fsm_t *s, event_t *e) { s1ap_message_t message; mme_enb_t *enb = NULL; - sock_id sock = 0; - c_sockaddr_t *addr = NULL; - pkbuf_t *pkbuf = NULL; + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *addr = NULL; + ogs_pkbuf_t *pkbuf = NULL; + int rc; - sock = (sock_id)event_get_param1(e); - d_assert(sock, break, "Null param"); - - addr = (c_sockaddr_t *)event_get_param2(e); - d_assert(addr, break, "Null param"); - - pkbuf = (pkbuf_t *)event_get_param3(e); - d_assert(pkbuf, break, "Null param"); + sock = e->enb_sock; + ogs_assert(sock); + addr = e->enb_addr; + ogs_assert(addr); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); enb = mme_enb_find_by_addr(addr); - CORE_FREE(addr); + ogs_free(addr); - d_assert(enb, pkbuf_free(pkbuf); break, "No eNB context"); - d_assert(FSM_STATE(&enb->sm), pkbuf_free(pkbuf); break, - "No S1AP State Machine"); + ogs_assert(enb); + ogs_assert(OGS_FSM_STATE(&enb->sm)); - rv = s1ap_decode_pdu(&message, pkbuf); - if (rv != CORE_OK) + rc = s1ap_decode_pdu(&message, pkbuf); + if (rc == OGS_OK) { - d_print_hex(pkbuf->payload, pkbuf->len); - d_assert(0, s1ap_free_pdu(&message); pkbuf_free(pkbuf); break, - "Can't decode S1AP_PDU"); + e->enb = enb; + e->s1ap_message = &message; + ogs_fsm_dispatch(&enb->sm, e); + } + else + { + ogs_error("Cannot process S1AP message"); } - event_set_param1(e, (c_uintptr_t)enb->index); - event_set_param4(e, (c_uintptr_t)&message); - fsm_dispatch(&enb->sm, (fsm_event_t*)e); - s1ap_free_pdu(&message); - pkbuf_free(pkbuf); - break; - } - case MME_EVT_S1AP_DELAYED_SEND: - { - enb_ue_t *enb_ue = NULL; - pkbuf_t *pkbuf = NULL; - tm_block_id timer = 0; - - enb_ue = enb_ue_find(event_get_param1(e)); - d_assert(enb_ue, break,); - - pkbuf = (pkbuf_t *)event_get_param2(e); - d_assert(pkbuf, break,); - - timer = event_get_param3(e); - d_assert(timer, pkbuf_free(pkbuf); break,); - - rv = s1ap_send_to_enb_ue(enb_ue, pkbuf); - d_assert(rv == CORE_OK, pkbuf_free(pkbuf),); - - tm_delete(timer); - break; - } - case MME_EVT_S1AP_S1_HOLDING_TIMER: - { - enb_ue_t *enb_ue = NULL; - - enb_ue = enb_ue_find(event_get_param1(e)); - d_assert(enb_ue, break, "No ENB UE context"); - d_warn("Implicit S1 release"); - d_warn(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", - enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - - rv = enb_ue_remove(enb_ue); - d_assert(rv == CORE_OK,,); + ogs_pkbuf_free(pkbuf); break; } case MME_EVT_EMM_MESSAGE: { nas_message_t message; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - enb_ue = enb_ue_find(event_get_param1(e)); - d_assert(enb_ue, break, "No ENB UE context"); - pkbuf = (pkbuf_t *)event_get_param4(e); - d_assert(pkbuf, break, "Null param"); - d_assert(nas_emm_decode(&message, pkbuf) == CORE_OK, - pkbuf_free(pkbuf); break, "Can't decode NAS_EMM"); + enb_ue = e->enb_ue; + ogs_assert(enb_ue); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); + ogs_assert(nas_emm_decode(&message, pkbuf) == OGS_OK); mme_ue = enb_ue->mme_ue; if (!mme_ue) @@ -275,7 +225,7 @@ void mme_state_operational(fsm_t *s, event_t *e) if (!mme_ue) { mme_ue = mme_ue_add(enb_ue); - d_assert(mme_ue, pkbuf_free(pkbuf); break, "Null param"); + ogs_assert(mme_ue); } else { @@ -286,17 +236,15 @@ void mme_state_operational(fsm_t *s, event_t *e) * * Now, We will check the MAC in the NAS message*/ nas_security_header_type_t h; - h.type = (c_uint8_t)event_get_param3(e); + h.type = e->nas_type; if (h.integrity_protected) { /* Decryption was performed in S1AP handler. * So, we disabled 'ciphered' * not to decrypt NAS message */ h.ciphered = 0; - d_assert( - nas_security_decode(mme_ue, h, pkbuf) == CORE_OK, - pkbuf_free(pkbuf); return, - "nas_security_decode failed"); + ogs_assert( + nas_security_decode(mme_ue, h, pkbuf) == OGS_OK); } } @@ -304,63 +252,32 @@ void mme_state_operational(fsm_t *s, event_t *e) * older S1(enb_ue_t) context */ if (ECM_CONNECTED(mme_ue)) { -#if 1 /* IMPLICIT_S1_RELEASE */ /* Implcit S1 release */ - d_trace(5, "Implicit S1 release\n"); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug("Implicit S1 release"); + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", mme_ue->enb_ue->enb_ue_s1ap_id, mme_ue->enb_ue->mme_ue_s1ap_id); rv = enb_ue_remove(mme_ue->enb_ue); - d_assert(rv == CORE_OK,,); - -#else /* S1_HOLDING_TIMER */ - - /* Previous S1(enb_ue_t) context the holding timer(30secs) - * is started. - * Newly associated S1(enb_ue_t) context holding timer - * is stopped. */ - d_trace(5, "Start S1 Holding Timer\n"); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", - mme_ue->enb_ue->enb_ue_s1ap_id, - mme_ue->enb_ue->mme_ue_s1ap_id); - tm_start(mme_ue->enb_ue->holding_timer); - - /* De-associate S1 with NAS/EMM */ - rv = enb_ue_deassociate(mme_ue->enb_ue); - d_assert(rv == CORE_OK,,); -#endif + ogs_assert(rv == OGS_OK); } - tm_stop(enb_ue->holding_timer); mme_ue_associate_enb_ue(mme_ue, enb_ue); } - d_assert(mme_ue, pkbuf_free(pkbuf); break, "No MME UE context"); - d_assert(FSM_STATE(&mme_ue->sm), pkbuf_free(pkbuf); break, - "No EMM State Machine"); + ogs_assert(mme_ue); + ogs_assert(OGS_FSM_STATE(&mme_ue->sm)); - event_set_param1(e, (c_uintptr_t)mme_ue->index); - event_set_param5(e, (c_uintptr_t)&message); + e->mme_ue = mme_ue; + e->nas_message = &message; - fsm_dispatch(&mme_ue->sm, (fsm_event_t*)e); - if (FSM_CHECK(&mme_ue->sm, emm_state_exception)) + ogs_fsm_dispatch(&mme_ue->sm, e); + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_exception)) { rv = mme_send_delete_session_or_ue_context_release( mme_ue, enb_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_ue_context_release() failed"); + ogs_assert(rv == OGS_OK); } - pkbuf_free(pkbuf); - break; - } - case MME_EVT_EMM_T3413: - { - mme_ue_t *mme_ue = mme_ue_find(event_get_param1(e)); - d_assert(mme_ue, break, "No UE context"); - d_assert(FSM_STATE(&mme_ue->sm), break, "No EMM State Machine"); - - fsm_dispatch(&mme_ue->sm, (fsm_event_t*)e); - + ogs_pkbuf_free(pkbuf); break; } case MME_EVT_ESM_MESSAGE: @@ -370,29 +287,28 @@ void mme_state_operational(fsm_t *s, event_t *e) mme_bearer_t *bearer = NULL; mme_bearer_t *default_bearer = NULL; mme_sess_t *sess = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - mme_ue = mme_ue_find(event_get_param1(e)); - d_assert(mme_ue, break, "No UE context"); + mme_ue = e->mme_ue; + ogs_assert(mme_ue); - pkbuf = (pkbuf_t *)event_get_param2(e); - d_assert(pkbuf, break, "Null param"); - d_assert(nas_esm_decode(&message, pkbuf) == CORE_OK, - pkbuf_free(pkbuf); break, "Can't decode NAS_ESM"); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); + ogs_assert(nas_esm_decode(&message, pkbuf) == OGS_OK); bearer = mme_bearer_find_or_add_by_message(mme_ue, &message); - d_assert(bearer, pkbuf_free(pkbuf); break, "No Bearer context"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, pkbuf_free(pkbuf); break, "Null param"); + ogs_assert(sess); default_bearer = mme_default_bearer_in_sess(sess); - d_assert(default_bearer, pkbuf_free(pkbuf); break, "Null param"); + ogs_assert(default_bearer); - event_set_param1(e, (c_uintptr_t)bearer->index); - event_set_param3(e, (c_uintptr_t)&message); + e->bearer = bearer; + e->nas_message = &message; - fsm_dispatch(&bearer->sm, (fsm_event_t*)e); - if (FSM_CHECK(&bearer->sm, esm_state_bearer_deactivated) || - FSM_CHECK(&bearer->sm, esm_state_exception)) + ogs_fsm_dispatch(&bearer->sm, e); + if (OGS_FSM_CHECK(&bearer->sm, esm_state_bearer_deactivated) || + OGS_FSM_CHECK(&bearer->sm, esm_state_exception)) { if (default_bearer->ebi == bearer->ebi) { @@ -407,29 +323,28 @@ void mme_state_operational(fsm_t *s, event_t *e) mme_bearer_remove(bearer); } } - else if (FSM_CHECK(&bearer->sm, esm_state_pdn_did_disconnect)) + else if (OGS_FSM_CHECK(&bearer->sm, esm_state_pdn_did_disconnect)) { - d_assert(default_bearer->ebi == bearer->ebi, - pkbuf_free(pkbuf); break, - "Bearer[%d] is not Default Bearer", - default_bearer->ebi, bearer->ebi); + ogs_assert(default_bearer->ebi == bearer->ebi); mme_sess_remove(sess); } - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); break; } case MME_EVT_S6A_MESSAGE: { - status_t rv; - mme_ue_t *mme_ue = mme_ue_find(event_get_param1(e)); - pkbuf_t *s6abuf = (pkbuf_t *)event_get_param2(e); + int rv; + mme_ue_t *mme_ue = NULL; + ogs_pkbuf_t *s6abuf = NULL; s6a_message_t *s6a_message = NULL; - d_assert(mme_ue, return, "Null param"); - d_assert(s6abuf, return, "Null param"); - s6a_message = s6abuf->payload; - d_assert(s6a_message, return, "Null param"); + mme_ue = e->mme_ue; + ogs_assert(mme_ue); + s6abuf = e->pkbuf; + ogs_assert(s6abuf); + s6a_message = s6abuf->data; + ogs_assert(s6a_message); if (s6a_message->result_code != ER_DIAMETER_SUCCESS) { @@ -438,19 +353,18 @@ void mme_state_operational(fsm_t *s, event_t *e) rv = nas_send_attach_reject(mme_ue, EMM_CAUSE_IMSI_UNKNOWN_IN_HSS, ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED); - d_assert(rv == CORE_OK,, - "nas_send_attach_reject failed"); - d_warn("EMM_CAUSE : IMSI Unknown in HSS"); + ogs_assert(rv == OGS_OK); + ogs_warn("EMM_CAUSE : IMSI Unknown in HSS"); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, break, "No ENB UE context"); + ogs_assert(enb_ue); rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); - pkbuf_free(s6abuf); + ogs_pkbuf_free(s6abuf); break; } @@ -465,75 +379,75 @@ void mme_state_operational(fsm_t *s, event_t *e) { mme_s6a_handle_ula(mme_ue, &s6a_message->ula_message); - if (FSM_CHECK(&mme_ue->sm, emm_state_initial_context_setup)) + if (OGS_FSM_CHECK(&mme_ue->sm, + emm_state_initial_context_setup)) { if (mme_ue->nas_eps.type == MME_EPS_TYPE_ATTACH_REQUEST) { rv = nas_send_emm_to_esm(mme_ue, &mme_ue->pdn_connectivity_request); - d_assert(rv == CORE_OK,, - "nas_send_emm_to_esm() failed"); + ogs_assert(rv == OGS_OK); } else - d_assert(0,, "Invalid Type[%d]", - mme_ue->nas_eps.type); + { + ogs_fatal("Invalid Type[%d]", mme_ue->nas_eps.type); + ogs_assert_if_reached(); + } } - else if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + else if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { if (mme_ue->nas_eps.type == MME_EPS_TYPE_TAU_REQUEST) { rv = nas_send_tau_accept(mme_ue, S1AP_ProcedureCode_id_InitialContextSetup); - d_assert(rv == CORE_OK,, - "nas_send_tau_accept() failed"); + ogs_assert(rv == OGS_OK); } else if (mme_ue->nas_eps.type == MME_EPS_TYPE_SERVICE_REQUEST) { rv = s1ap_send_initial_context_setup_request( mme_ue); - d_assert(rv == CORE_OK,, - "s1ap_send_initial_context_setup_request()" - "failed"); + ogs_assert(rv == OGS_OK); } else - d_assert(0,, "Invalid EPS-Type[%d]", - mme_ue->nas_eps.type); + { + ogs_fatal("Invalid Type[%d]", mme_ue->nas_eps.type); + ogs_assert_if_reached(); + } } else - d_assert(0,, "Invaild EMM state for EPS-Type[%d]", - mme_ue->nas_eps.type); + ogs_assert_if_reached(); break; } default: { - d_error("Invalid Type[%d]", event_get_param2(e)); + ogs_error("Invalid Type[%d]", s6a_message->cmd_code); break; } } - pkbuf_free(s6abuf); + ogs_pkbuf_free(s6abuf); break; } case MME_EVT_S11_MESSAGE: { - status_t rv; - pkbuf_t *pkbuf = (pkbuf_t *)event_get_param1(e); + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; gtp_message_t message; mme_ue_t *mme_ue = NULL; - d_assert(pkbuf, break, "Null param"); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); rv = gtp_parse_msg(&message, pkbuf); - d_assert(rv == CORE_OK, pkbuf_free(pkbuf); break, "parse error"); + ogs_assert(rv == OGS_OK); mme_ue = mme_ue_find_by_teid(message.h.teid); - d_assert(mme_ue, pkbuf_free(pkbuf); break, - "No UE Context(TEID:%d)", message.h.teid); + ogs_assert(mme_ue); rv = gtp_xact_receive(mme_ue->gnode, &message.h, &xact); - if (rv != CORE_OK) + if (rv != OGS_OK) { - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); break; } @@ -589,7 +503,7 @@ void mme_state_operational(fsm_t *s, event_t *e) { s1ap_handle_paging(mme_ue); /* Start T3413 */ - tm_start(mme_ue->t3413); + ogs_timer_start(mme_ue->t3413, mme_self()->t3413_value); } break; case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE: @@ -603,21 +517,15 @@ void mme_state_operational(fsm_t *s, event_t *e) &message.delete_indirect_data_forwarding_tunnel_response); break; default: - d_warn("Not implmeneted(type:%d)", message.h.type); + ogs_warn("Not implmeneted(type:%d)", message.h.type); break; } - pkbuf_free(pkbuf); - break; - } - case MME_EVT_S11_T3_RESPONSE: - case MME_EVT_S11_T3_HOLDING: - { - gtp_xact_timeout(event_get_param1(e), event_get(e)); + ogs_pkbuf_free(pkbuf); break; } default: { - d_error("No handler for event %s", mme_event_get_name(e)); + ogs_error("No handler for event %s", mme_event_get_name(e)); break; } } diff --git a/src/mme/mme_sm.h b/src/mme/mme_sm.h index d72030ced..6b69db5b1 100644 --- a/src/mme/mme_sm.h +++ b/src/mme/mme_sm.h @@ -1,47 +1,42 @@ #ifndef __MME_SM_H__ #define __MME_SM_H__ -#include "core_param.h" -#include "core_fsm.h" -#include "core_event.h" +#include "mme_event.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -void mme_state_initial(fsm_t *s, event_t *e); -void mme_state_final(fsm_t *s, event_t *e); -void mme_state_operational(fsm_t *s, event_t *e); -void mme_state_exception(fsm_t *s, event_t *e); +void mme_state_initial(ogs_fsm_t *s, mme_event_t *e); +void mme_state_final(ogs_fsm_t *s, mme_event_t *e); +void mme_state_operational(ogs_fsm_t *s, mme_event_t *e); +void mme_state_exception(ogs_fsm_t *s, mme_event_t *e); -void s1ap_state_initial(fsm_t *s, event_t *e); -void s1ap_state_final(fsm_t *s, event_t *e); -void s1ap_state_operational(fsm_t *s, event_t *e); -void s1ap_state_exception(fsm_t *s, event_t *e); +void s1ap_state_initial(ogs_fsm_t *s, mme_event_t *e); +void s1ap_state_final(ogs_fsm_t *s, mme_event_t *e); +void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e); +void s1ap_state_exception(ogs_fsm_t *s, mme_event_t *e); -void emm_state_initial(fsm_t *s, event_t *e); -void emm_state_final(fsm_t *s, event_t *e); -void emm_state_de_registered(fsm_t *s, event_t *e); -void emm_state_authentication(fsm_t *s, event_t *e); -void emm_state_security_mode(fsm_t *s, event_t *e); -void emm_state_initial_context_setup(fsm_t *s, event_t *e); -void emm_state_registered(fsm_t *s, event_t *e); -void emm_state_exception(fsm_t *s, event_t *e); +void emm_state_initial(ogs_fsm_t *s, mme_event_t *e); +void emm_state_final(ogs_fsm_t *s, mme_event_t *e); +void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e); +void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e); +void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e); +void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e); +void emm_state_registered(ogs_fsm_t *s, mme_event_t *e); +void emm_state_exception(ogs_fsm_t *s, mme_event_t *e); -void esm_state_initial(fsm_t *s, event_t *e); -void esm_state_final(fsm_t *s, event_t *e); -void esm_state_inactive(fsm_t *s, event_t *e); -void esm_state_active(fsm_t *s, event_t *e); -void esm_state_pdn_will_disconnect(fsm_t *s, event_t *e); -void esm_state_pdn_did_disconnect(fsm_t *s, event_t *e); -void esm_state_bearer_deactivated(fsm_t *s, event_t *e); -void esm_state_exception(fsm_t *s, event_t *e); +void esm_state_initial(ogs_fsm_t *s, mme_event_t *e); +void esm_state_final(ogs_fsm_t *s, mme_event_t *e); +void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e); +void esm_state_active(ogs_fsm_t *s, mme_event_t *e); +void esm_state_pdn_will_disconnect(ogs_fsm_t *s, mme_event_t *e); +void esm_state_pdn_did_disconnect(ogs_fsm_t *s, mme_event_t *e); +void esm_state_bearer_deactivated(ogs_fsm_t *s, mme_event_t *e); +void esm_state_exception(ogs_fsm_t *s, mme_event_t *e); -#define mme_sm_print(__pe) \ - d_print("%s(): %s\n", __func__, mme_event_get_name(__pe)) - -#define mme_sm_trace(__l, __pe) \ - d_trace(__l, "%s(): %s\n", __func__, mme_event_get_name(__pe)) +#define mme_sm_debug(__pe) \ + ogs_debug("%s(): %s\n", __func__, mme_event_get_name(__pe)) #ifdef __cplusplus } diff --git a/src/mme/nas_conv.c b/src/mme/nas_conv.c index 954ddaa0f..cc8a2328e 100644 --- a/src/mme/nas_conv.c +++ b/src/mme/nas_conv.c @@ -1,11 +1,7 @@ -#define TRACE_MODULE _nas_conv - -#include "core_debug.h" - #include "nas_conv.h" void nas_imsi_to_bcd( - nas_mobile_identity_imsi_t *imsi, c_uint8_t imsi_len, c_int8_t *bcd) + nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd) { int bcd_len; @@ -29,7 +25,7 @@ void nas_imsi_to_bcd( if (!imsi->odd_even) /* if bcd length is even */ { if (bcd[bcd_len] != 0xf) - d_warn("Spec warning : bcd[%d] = 0x%x", bcd_len, bcd[bcd_len]); + ogs_warn("Spec warning : bcd[%d] = 0x%x", bcd_len, bcd[bcd_len]); (bcd_len)--; } @@ -37,8 +33,8 @@ void nas_imsi_to_bcd( } void nas_imsi_to_buffer( - nas_mobile_identity_imsi_t *imsi, c_uint8_t imsi_len, - c_uint8_t *buf, c_uint8_t *buf_len) + nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, + uint8_t *buf, uint8_t *buf_len) { buf[0] = ((('0' + imsi->digit2) << 4) & 0xf0) | (('0' + imsi->digit1) & 0x0f); @@ -61,6 +57,6 @@ void nas_imsi_to_buffer( { (*buf_len)--; if ((buf[*buf_len] & 0xf) != 0xf) - d_warn("Spec warning : buf[%d] = 0x%x", *buf_len, buf[*buf_len]); + ogs_warn("Spec warning : buf[%d] = 0x%x", *buf_len, buf[*buf_len]); } } diff --git a/src/mme/nas_conv.h b/src/mme/nas_conv.h index ced294d49..9e6281b11 100644 --- a/src/mme/nas_conv.h +++ b/src/mme/nas_conv.h @@ -7,12 +7,12 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) nas_imsi_to_buffer( - nas_mobile_identity_imsi_t *imsi, c_uint8_t imsi_len, - c_uint8_t *buf, c_uint8_t *buf_len); +void nas_imsi_to_buffer( + nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, + uint8_t *buf, uint8_t *buf_len); -CORE_DECLARE(void) nas_imsi_to_bcd( - nas_mobile_identity_imsi_t *imsi, c_uint8_t imsi_len, c_int8_t *bcd); +void nas_imsi_to_bcd( + nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd); #ifdef __cplusplus } diff --git a/src/mme/nas_path.c b/src/mme/nas_path.c index 73d0962e5..cdb3543ba 100644 --- a/src/mme/nas_path.c +++ b/src/mme/nas_path.c @@ -1,6 +1,3 @@ -#define TRACE_MODULE _nas_path - -#include "core_debug.h" #include "s1ap_path.h" #include "s1ap_build.h" #include "esm_build.h" @@ -9,448 +6,430 @@ #include "mme_event.h" #include "mme_sm.h" -status_t nas_send_to_enb(mme_ue_t *mme_ue, pkbuf_t *pkbuf) +int nas_send_to_enb(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf) { enb_ue_t *enb_ue = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); return s1ap_send_to_enb_ue(enb_ue, pkbuf); } -status_t nas_send_emm_to_esm( +int nas_send_emm_to_esm( mme_ue_t *mme_ue, nas_esm_message_container_t *esm_message_container) { - pkbuf_t *esmbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(esm_message_container, return CORE_ERROR, "Null param"); - d_assert(esm_message_container->length, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(esm_message_container); + ogs_assert(esm_message_container->length); /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ - esmbuf = pkbuf_alloc(NAS_HEADROOM, esm_message_container->length); - d_assert(esmbuf, return CORE_ERROR, "Null param"); - memcpy(esmbuf->payload, + esmbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+esm_message_container->length); + ogs_pkbuf_reserve(esmbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(esmbuf, esm_message_container->buffer, esm_message_container->length); - d_assert(s1ap_send_to_esm(mme_ue, esmbuf) == CORE_OK, return CORE_ERROR, - "s1ap_send_to_esm failed"); + ogs_assert(s1ap_send_to_esm(mme_ue, esmbuf) == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_to_downlink_nas_transport(mme_ue_t *mme_ue, pkbuf_t *pkbuf) +int nas_send_to_downlink_nas_transport(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; enb_ue_t *enb_ue = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); rv = s1ap_build_downlink_nas_transport(&s1apbuf, enb_ue, pkbuf); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(pkbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_attach_accept(mme_ue_t *mme_ue) +int nas_send_attach_accept(mme_ue_t *mme_ue) { - status_t rv; + int rv; mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - pkbuf_t *esmbuf = NULL, *emmbuf = NULL, *s1apbuf = NULL; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL, *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); sess = mme_sess_first(mme_ue); - d_assert(sess, return CORE_ERROR, "Null param"); - d_assert(mme_sess_next(sess) == NULL, - return CORE_ERROR, "there is another session"); + ogs_assert(sess); + ogs_assert(mme_sess_next(sess) == NULL); bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR, "Null param"); - d_assert(mme_bearer_next(bearer) == NULL, - return CORE_ERROR, "there is dedicated bearer"); + ogs_assert(bearer); + ogs_assert(mme_bearer_next(bearer) == NULL); rv = esm_build_activate_default_bearer_context_request(&esmbuf, sess); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); rv = emm_build_attach_accept(&emmbuf, mme_ue, esmbuf); - d_assert(rv == CORE_OK && emmbuf, - pkbuf_free(esmbuf); return CORE_ERROR, "emm build error"); + ogs_assert(rv == OGS_OK && emmbuf); rv = s1ap_build_initial_context_setup_request(&s1apbuf, mme_ue, emmbuf); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(emmbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_attach_reject(mme_ue_t *mme_ue, +int nas_send_attach_reject(mme_ue_t *mme_ue, nas_emm_cause_t emm_cause, nas_esm_cause_t esm_cause) { - status_t rv; + int rv; mme_sess_t *sess = NULL; - pkbuf_t *esmbuf = NULL, *emmbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL, *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[EMM] Attach reject\n"); - d_trace(5, " IMSI[%s] Cause[%d]\n", mme_ue->imsi_bcd, emm_cause); + ogs_debug("[EMM] Attach reject"); + ogs_debug(" IMSI[%s] Cause[%d]", mme_ue->imsi_bcd, emm_cause); sess = mme_sess_first(mme_ue); if (sess) { rv = esm_build_pdn_connectivity_reject(&esmbuf, sess, esm_cause); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); } rv = emm_build_attach_reject(&emmbuf, emm_cause, esmbuf); - d_assert(rv == CORE_OK && emmbuf, - esmbuf ? pkbuf_free(esmbuf) : 1; return CORE_ERROR, - "emm build error"); + ogs_assert(rv == OGS_OK && emmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK, - esmbuf ? pkbuf_free(esmbuf) : 1; return CORE_ERROR, - "nas send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t nas_send_identity_request(mme_ue_t *mme_ue) +int nas_send_identity_request(mme_ue_t *mme_ue) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = emm_build_identity_request(&emmbuf, mme_ue); - d_assert(rv == CORE_OK && emmbuf, return CORE_ERROR, - "nas_build_detach_accept failed"); + ogs_assert(rv == OGS_OK && emmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); return rv; } -status_t nas_send_authentication_request( +int nas_send_authentication_request( mme_ue_t *mme_ue, e_utran_vector_t *e_utran_vector) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(e_utran_vector, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(e_utran_vector); - d_trace(3, "[EMM] Authentication request\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Authentication request"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_build_authentication_request(&emmbuf, e_utran_vector); - d_assert(rv == CORE_OK && emmbuf, return CORE_ERROR, - "nas_build_detach_accept failed"); + ogs_assert(rv == OGS_OK && emmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); return rv; } -status_t nas_send_authentication_reject(mme_ue_t *mme_ue) +int nas_send_authentication_reject(mme_ue_t *mme_ue) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[EMM] Authentication reject\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Authentication reject"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_build_authentication_reject(&emmbuf); - d_assert(rv == CORE_OK && emmbuf, return CORE_ERROR, - "nas_build_detach_accept failed"); + ogs_assert(rv == OGS_OK && emmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK,, "nas send failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_detach_accept(mme_ue_t *mme_ue) +int nas_send_detach_accept(mme_ue_t *mme_ue) { - status_t rv; + int rv; enb_ue_t *enb_ue = NULL; - pkbuf_t *emmbuf = NULL; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); /* reply with detach accept */ if (mme_ue->nas_eps.detach.switch_off == 0) { rv = emm_build_detach_accept(&emmbuf, mme_ue); - d_assert(rv == CORE_OK && emmbuf, return CORE_ERROR, - "nas_build_detach_accept failed"); + ogs_assert(rv == OGS_OK && emmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send failed"); + ogs_assert(rv == OGS_OK); } rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_detach, S1AP_UE_CTX_REL_S1_NORMAL_RELEASE, 0); - d_assert(rv == CORE_OK, return CORE_ERROR, "s1ap send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_pdn_connectivity_reject( +int nas_send_pdn_connectivity_reject( mme_sess_t *sess, nas_esm_cause_t esm_cause) { - status_t rv; + int rv; mme_ue_t *mme_ue; - pkbuf_t *esmbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = sess->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = esm_build_pdn_connectivity_reject(&esmbuf, sess, esm_cause); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, esmbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, - "nas_send_to_downlink_nas_transport"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_esm_information_request(mme_bearer_t *bearer) +int nas_send_esm_information_request(mme_bearer_t *bearer) { - status_t rv; + int rv; mme_ue_t *mme_ue = NULL; - pkbuf_t *esmbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = esm_build_information_request(&esmbuf, bearer); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); rv = nas_send_to_downlink_nas_transport(mme_ue, esmbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, - "nas_send_to_downlink_nas_transport"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_activate_default_bearer_context_request(mme_bearer_t *bearer) +int nas_send_activate_default_bearer_context_request(mme_bearer_t *bearer) { - status_t rv; - pkbuf_t *esmbuf = NULL, *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; mme_sess_t *sess = NULL; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = esm_build_activate_default_bearer_context_request(&esmbuf, sess); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); rv = s1ap_build_e_rab_setup_request(&s1apbuf, bearer, esmbuf); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(esmbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_activate_dedicated_bearer_context_request( +int nas_send_activate_dedicated_bearer_context_request( mme_bearer_t *bearer) { - status_t rv; - pkbuf_t *esmbuf = NULL, *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = esm_build_activate_dedicated_bearer_context_request(&esmbuf, bearer); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); rv = s1ap_build_e_rab_setup_request(&s1apbuf, bearer, esmbuf); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(esmbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_activate_all_dedicated_bearers(mme_bearer_t *default_bearer) +int nas_send_activate_all_dedicated_bearers(mme_bearer_t *default_bearer) { - status_t rv; + int rv; - d_assert(default_bearer, return CORE_ERROR, "Null param"); + ogs_assert(default_bearer); mme_bearer_t *dedicated_bearer = mme_bearer_next(default_bearer); while(dedicated_bearer) { rv = nas_send_activate_dedicated_bearer_context_request( dedicated_bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, - "nas_send_activate_dedicated_bearer_context failed"); + ogs_assert(rv == OGS_OK); dedicated_bearer = mme_bearer_next(dedicated_bearer); } - return CORE_OK; + return OGS_OK; } -status_t nas_send_modify_bearer_context_request( +int nas_send_modify_bearer_context_request( mme_bearer_t *bearer, int qos_presence, int tft_presence) { - status_t rv; - pkbuf_t *esmbuf = NULL, *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = esm_build_modify_bearer_context_request( &esmbuf, bearer, qos_presence, tft_presence); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); if (qos_presence == 1) { rv = s1ap_build_e_rab_modify_request(&s1apbuf, bearer, esmbuf); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(esmbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send error"); + ogs_assert(rv == OGS_OK); } else { rv = nas_send_to_downlink_nas_transport(mme_ue, esmbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send failed"); + ogs_assert(rv == OGS_OK); } - return CORE_OK; + return OGS_OK; } -status_t nas_send_deactivate_bearer_context_request(mme_bearer_t *bearer) +int nas_send_deactivate_bearer_context_request(mme_bearer_t *bearer) { - status_t rv; - pkbuf_t *esmbuf = NULL, *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *esmbuf = NULL; mme_ue_t *mme_ue = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = esm_build_deactivate_bearer_context_request( &esmbuf, bearer, ESM_CAUSE_REGULAR_DEACTIVATION); - d_assert(rv == CORE_OK && esmbuf, return CORE_ERROR, "esm build error"); + ogs_assert(rv == OGS_OK && esmbuf); rv = s1ap_build_e_rab_release_command(&s1apbuf, bearer, esmbuf, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(esmbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_tau_accept( +int nas_send_tau_accept( mme_ue_t *mme_ue, S1AP_ProcedureCode_t procedureCode) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); - d_trace(3, "[EMM] Tracking area update accept\n"); - d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd); + ogs_debug("[EMM] Tracking area update accept"); + ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd); rv = emm_build_tau_accept(&emmbuf, mme_ue); - d_assert(rv == CORE_OK, return CORE_ERROR, "emm build error"); + ogs_assert(rv == OGS_OK); if (procedureCode == S1AP_ProcedureCode_id_InitialContextSetup) { - pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *s1apbuf = NULL; rv = s1ap_build_initial_context_setup_request(&s1apbuf, mme_ue, emmbuf); - d_assert(rv == CORE_OK && s1apbuf, - pkbuf_free(emmbuf); return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK,, "nas send error"); + ogs_assert(rv == OGS_OK); } else if (procedureCode == S1AP_ProcedureCode_id_downlinkNASTransport) { rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK,, "nas_send_to_downlink_nas_transport"); + ogs_assert(rv == OGS_OK); } else - d_assert(0, pkbuf_free(emmbuf); return CORE_ERROR, - "Invalid Procedure Code[%d]", procedureCode); + ogs_assert_if_reached(); return rv; } -status_t nas_send_tau_reject(mme_ue_t *mme_ue, nas_emm_cause_t emm_cause) +int nas_send_tau_reject(mme_ue_t *mme_ue, nas_emm_cause_t emm_cause) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); /* Build TAU reject */ rv = emm_build_tau_reject(&emmbuf, emm_cause, mme_ue); - d_assert(rv == CORE_OK, return CORE_ERROR, "emm build error"); + ogs_assert(rv == OGS_OK); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas dl send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t nas_send_service_reject(mme_ue_t *mme_ue, nas_emm_cause_t emm_cause) +int nas_send_service_reject(mme_ue_t *mme_ue, nas_emm_cause_t emm_cause) { - status_t rv; - pkbuf_t *emmbuf = NULL; + int rv; + ogs_pkbuf_t *emmbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); /* Build Service Reject */ rv = emm_build_service_reject(&emmbuf, emm_cause, mme_ue); - d_assert(rv == CORE_OK, return CORE_ERROR, "emm build error"); + ogs_assert(rv == OGS_OK); rv = nas_send_to_downlink_nas_transport(mme_ue, emmbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "nas dl send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/nas_path.h b/src/mme/nas_path.h index 50297adda..8921646b4 100644 --- a/src/mme/nas_path.h +++ b/src/mme/nas_path.h @@ -1,52 +1,49 @@ #ifndef __NAS_PATH_H__ #define __NAS_PATH_H__ -#include "core_pkbuf.h" - #include "mme_context.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) nas_send_to_enb(mme_ue_t *mme_ue, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) nas_send_emm_to_esm( +int nas_send_to_enb(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf); +int nas_send_emm_to_esm( mme_ue_t *mme_ue, nas_esm_message_container_t *esm_message_container); -CORE_DECLARE(status_t) nas_send_to_downlink_nas_transport( - mme_ue_t *mme_ue, pkbuf_t *pkbuf); +int nas_send_to_downlink_nas_transport(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf); -CORE_DECLARE(status_t) nas_send_attach_accept(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) nas_send_attach_reject(mme_ue_t *mme_ue, +int nas_send_attach_accept(mme_ue_t *mme_ue); +int nas_send_attach_reject(mme_ue_t *mme_ue, nas_emm_cause_t emm_cause, nas_esm_cause_t esm_cause); -CORE_DECLARE(status_t) nas_send_identity_request(mme_ue_t *mme_ue); +int nas_send_identity_request(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) nas_send_authentication_request( +int nas_send_authentication_request( mme_ue_t *mme_ue, e_utran_vector_t *e_utran_vector); -CORE_DECLARE(status_t) nas_send_authentication_reject(mme_ue_t *mme_ue); +int nas_send_authentication_reject(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) nas_send_detach_accept(mme_ue_t *mme_ue); +int nas_send_detach_accept(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) nas_send_pdn_connectivity_reject( +int nas_send_pdn_connectivity_reject( mme_sess_t *sess, nas_esm_cause_t esm_cause); -CORE_DECLARE(status_t) nas_send_esm_information_request(mme_bearer_t *bearer); -CORE_DECLARE(status_t) nas_send_activate_default_bearer_context_request( +int nas_send_esm_information_request(mme_bearer_t *bearer); +int nas_send_activate_default_bearer_context_request( mme_bearer_t *bearer); -CORE_DECLARE(status_t) nas_send_activate_dedicated_bearer_context_request( +int nas_send_activate_dedicated_bearer_context_request( mme_bearer_t *bearer); -CORE_DECLARE(status_t) nas_send_activate_all_dedicated_bearers( +int nas_send_activate_all_dedicated_bearers( mme_bearer_t *default_bearer); -CORE_DECLARE(status_t) nas_send_modify_bearer_context_request( +int nas_send_modify_bearer_context_request( mme_bearer_t *bearer, int qos_presence, int tft_presence); -CORE_DECLARE(status_t) nas_send_deactivate_bearer_context_request( +int nas_send_deactivate_bearer_context_request( mme_bearer_t *bearer); -CORE_DECLARE(status_t) nas_send_tau_accept( +int nas_send_tau_accept( mme_ue_t *mme_ue, S1AP_ProcedureCode_t procedureCode); -CORE_DECLARE(status_t) nas_send_tau_reject( +int nas_send_tau_reject( mme_ue_t *mme_ue, nas_esm_cause_t emm_cause); -CORE_DECLARE(status_t) nas_send_service_reject( +int nas_send_service_reject( mme_ue_t *mme_ue, nas_emm_cause_t emm_cause); #ifdef __cplusplus diff --git a/src/mme/nas_security.c b/src/mme/nas_security.c index 8dfb5248a..3095aa6fe 100644 --- a/src/mme/nas_security.c +++ b/src/mme/nas_security.c @@ -1,19 +1,15 @@ -#define TRACE_MODULE _nas_sec - -#include "core_debug.h" - #include "nas/nas_message.h" #include "nas_security.h" -status_t nas_security_encode( - pkbuf_t **pkbuf, mme_ue_t *mme_ue, nas_message_t *message) +int nas_security_encode( + ogs_pkbuf_t **pkbuf, mme_ue_t *mme_ue, nas_message_t *message) { int integrity_protected = 0; int new_security_context = 0; int ciphered = 0; - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(message, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(message); switch(message->h.security_header_type) { @@ -36,9 +32,9 @@ status_t nas_security_encode( ciphered = 1; break; default: - d_warn("Not implemented(securiry header type:0x%x)", + ogs_warn("Not implemented(securiry header type:0x%x)", message->h.security_header_type); - return CORE_ERROR; + return OGS_ERROR; } if (new_security_context) @@ -55,15 +51,14 @@ status_t nas_security_encode( if (ciphered || integrity_protected) { nas_security_header_t h; - pkbuf_t *new = NULL; + ogs_pkbuf_t *new = NULL; memset(&h, 0, sizeof(h)); h.security_header_type = message->h.security_header_type; h.protocol_discriminator = message->h.protocol_discriminator; h.sequence_number = (mme_ue->dl_count & 0xff); - d_assert(nas_plain_encode(&new, message) == CORE_OK, - return CORE_ERROR, "NAS encoding error"); + ogs_assert(nas_plain_encode(&new, message) == OGS_OK); if (ciphered) { @@ -74,13 +69,12 @@ status_t nas_security_encode( } /* encode sequence number */ - d_assert(CORE_OK == pkbuf_header(new, 1), - pkbuf_free(new);return CORE_ERROR, "pkbuf_header error"); - *(c_uint8_t *)(new->payload) = h.sequence_number; + ogs_assert(ogs_pkbuf_push(new, 1)); + *(uint8_t *)(new->data) = h.sequence_number; if (integrity_protected) { - c_uint8_t mac[NAS_SECURITY_MAC_SIZE]; + uint8_t mac[NAS_SECURITY_MAC_SIZE]; /* calculate NAS MAC(message authentication code) */ nas_mac_calculate(mme_ue->selected_int_algorithm, @@ -93,43 +87,41 @@ status_t nas_security_encode( mme_ue->dl_count = (mme_ue->dl_count + 1) & 0xffffff; /* Use 24bit */ /* encode all security header */ - d_assert(CORE_OK == pkbuf_header(new, 5), - pkbuf_free(new);return CORE_ERROR, "pkbuf_header error"); - memcpy(new->payload, &h, sizeof(nas_security_header_t)); + ogs_assert(ogs_pkbuf_push(new, 5)); + memcpy(new->data, &h, sizeof(nas_security_header_t)); *pkbuf = new; mme_ue->security_context_available = 1; } - return CORE_OK; + return OGS_OK; } -status_t nas_security_decode(mme_ue_t *mme_ue, - nas_security_header_type_t security_header_type, pkbuf_t *pkbuf) +int nas_security_decode(mme_ue_t *mme_ue, + nas_security_header_type_t security_header_type, ogs_pkbuf_t *pkbuf) { - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); - d_assert(pkbuf->payload, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); if (security_header_type.service_request) { #define SHORT_MAC_SIZE 2 nas_ksi_and_sequence_number_t *ksi_and_sequence_number = - pkbuf->payload + 1; - c_uint16_t original_pkbuf_len = pkbuf->len; - c_uint8_t original_mac[SHORT_MAC_SIZE]; - c_uint8_t estimated_sequence_number; - c_uint8_t sequence_number_high_3bit; - c_uint8_t mac[NAS_SECURITY_MAC_SIZE]; + pkbuf->data + 1; + uint8_t original_mac[SHORT_MAC_SIZE]; + uint8_t estimated_sequence_number; + uint8_t sequence_number_high_3bit; + uint8_t mac[NAS_SECURITY_MAC_SIZE]; if (mme_ue->selected_int_algorithm == 0) { - d_warn("integrity algorithm is not defined"); - return CORE_ERROR; + ogs_warn("integrity algorithm is not defined"); + return OGS_ERROR; } - d_assert(ksi_and_sequence_number, return CORE_ERROR, "Null param"); + ogs_assert(ksi_and_sequence_number); estimated_sequence_number = ksi_and_sequence_number->sequence_number; @@ -144,23 +136,21 @@ status_t nas_security_decode(mme_ue_t *mme_ue, mme_ue->ul_count.overflow++; mme_ue->ul_count.sqn = estimated_sequence_number; - pkbuf->len = 2; - memcpy(original_mac, pkbuf->payload + 2, SHORT_MAC_SIZE); + memcpy(original_mac, pkbuf->data + 2, SHORT_MAC_SIZE); + ogs_pkbuf_trim(pkbuf, 2); nas_mac_calculate(mme_ue->selected_int_algorithm, mme_ue->knas_int, mme_ue->ul_count.i32, NAS_SECURITY_BEARER, NAS_SECURITY_UPLINK_DIRECTION, pkbuf, mac); - pkbuf->len = original_pkbuf_len; - memcpy(pkbuf->payload + 2, original_mac, SHORT_MAC_SIZE); - - if (memcmp(mac + 2, pkbuf->payload + 2, 2) != 0) + ogs_pkbuf_put_data(pkbuf, original_mac, SHORT_MAC_SIZE); + if (memcmp(mac + 2, pkbuf->data + 2, 2) != 0) { - d_warn("NAS MAC verification failed"); + ogs_warn("NAS MAC verification failed"); mme_ue->mac_failed = 1; } - return CORE_OK; + return OGS_OK; } if (!mme_ue->security_context_available) @@ -186,13 +176,11 @@ status_t nas_security_decode(mme_ue_t *mme_ue, nas_security_header_t *h = NULL; /* NAS Security Header */ - d_assert(CORE_OK == pkbuf_header(pkbuf, 6), - return CORE_ERROR, "pkbuf_header error"); - h = pkbuf->payload; + ogs_assert(ogs_pkbuf_push(pkbuf, 6)); + h = pkbuf->data; /* NAS Security Header.Sequence_Number */ - d_assert(CORE_OK == pkbuf_header(pkbuf, -5), - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(pkbuf, 5)); /* calculate ul_count */ if (mme_ue->ul_count.sqn > h->sequence_number) @@ -201,9 +189,9 @@ status_t nas_security_decode(mme_ue_t *mme_ue, if (security_header_type.integrity_protected) { - c_uint8_t mac[NAS_SECURITY_MAC_SIZE]; - c_uint32_t mac32; - c_uint32_t original_mac = h->message_authentication_code; + uint8_t mac[NAS_SECURITY_MAC_SIZE]; + uint32_t mac32; + uint32_t original_mac = h->message_authentication_code; /* calculate NAS MAC(message authentication code) */ nas_mac_calculate(mme_ue->selected_int_algorithm, @@ -214,15 +202,14 @@ status_t nas_security_decode(mme_ue_t *mme_ue, memcpy(&mac32, mac, NAS_SECURITY_MAC_SIZE); if (h->message_authentication_code != mac32) { - d_warn("NAS MAC verification failed(0x%x != 0x%x)", + ogs_warn("NAS MAC verification failed(0x%x != 0x%x)", ntohl(h->message_authentication_code), ntohl(mac32)); mme_ue->mac_failed = 1; } } /* NAS EMM Header or ESM Header */ - d_assert(CORE_OK == pkbuf_header(pkbuf, -1), - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(pkbuf, 1)); if (security_header_type.ciphered) { @@ -233,119 +220,117 @@ status_t nas_security_decode(mme_ue_t *mme_ue, } } - return CORE_OK; + return OGS_OK; } -void nas_mac_calculate(c_uint8_t algorithm_identity, - c_uint8_t *knas_int, c_uint32_t count, c_uint8_t bearer, - c_uint8_t direction, pkbuf_t *pkbuf, c_uint8_t *mac) +void nas_mac_calculate(uint8_t algorithm_identity, + uint8_t *knas_int, uint32_t count, uint8_t bearer, + uint8_t direction, ogs_pkbuf_t *pkbuf, uint8_t *mac) { - d_assert(knas_int, return, "Null param"); - d_assert(bearer >= 0 && bearer <= 0x1f, return, "Invalid param"); - d_assert(direction == 0 || direction == 1, return, "Invalid param"); - d_assert(pkbuf, return, "Null param"); - d_assert(pkbuf->payload, return, "Null param"); - d_assert(pkbuf->len, return, "Null param"); - d_assert(mac, return, "Null param"); + ogs_assert(knas_int); + ogs_assert(bearer >= 0 && bearer <= 0x1f); + ogs_assert(direction == 0 || direction == 1); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); + ogs_assert(mac); switch(algorithm_identity) { case NAS_SECURITY_ALGORITHMS_128_EIA1: { snow_3g_f9(knas_int, count, (bearer << 27), direction, - pkbuf->payload, (pkbuf->len << 3), mac); + pkbuf->data, (pkbuf->len << 3), mac); break; } case NAS_SECURITY_ALGORITHMS_128_EIA2: { count = htonl(count); - c_uint8_t *ivec = NULL;; - c_uint8_t cmac[16]; + uint8_t *ivec = NULL;; + uint8_t cmac[16]; - pkbuf_header(pkbuf, 8); + ogs_pkbuf_push(pkbuf, 8); - ivec = pkbuf->payload; + ivec = pkbuf->data; memset(ivec, 0, 8); memcpy(ivec + 0, &count, sizeof(count)); ivec[4] = (bearer << 3) | (direction << 2); - aes_cmac_calculate(cmac, knas_int, pkbuf->payload, pkbuf->len); + ogs_aes_cmac_calculate(cmac, knas_int, pkbuf->data, pkbuf->len); memcpy(mac, cmac, 4); - pkbuf_header(pkbuf, -8); + ogs_pkbuf_pull(pkbuf, 8); break; } case NAS_SECURITY_ALGORITHMS_128_EIA3: { - c_uint32_t mac32; + uint32_t mac32; zuc_eia3(knas_int, count, bearer, direction, - (pkbuf->len << 3), pkbuf->payload, &mac32); + (pkbuf->len << 3), pkbuf->data, &mac32); mac32 = ntohl(mac32); - memcpy(mac, &mac32, sizeof(c_uint32_t)); + memcpy(mac, &mac32, sizeof(uint32_t)); break; } case NAS_SECURITY_ALGORITHMS_EIA0: { - d_error("Invalid identity : NAS_SECURITY_ALGORITHMS_EIA0"); + ogs_error("Invalid identity : NAS_SECURITY_ALGORITHMS_EIA0"); break; } default: { - d_assert(0, return, "Unknown algorithm identity(%d)", - algorithm_identity); + ogs_assert_if_reached(); break; } } } -void nas_encrypt(c_uint8_t algorithm_identity, - c_uint8_t *knas_enc, c_uint32_t count, c_uint8_t bearer, - c_uint8_t direction, pkbuf_t *pkbuf) +void nas_encrypt(uint8_t algorithm_identity, + uint8_t *knas_enc, uint32_t count, uint8_t bearer, + uint8_t direction, ogs_pkbuf_t *pkbuf) { - d_assert(knas_enc, return, "Null param"); - d_assert(bearer >= 0 && bearer <= 0x1f, return, "Invalid param"); - d_assert(direction == 0 || direction == 1, return, "Invalid param"); - d_assert(pkbuf, return, "Null param"); - d_assert(pkbuf->payload, return, "Null param"); - d_assert(pkbuf->len, return, "Null param"); + ogs_assert(knas_enc); + ogs_assert(bearer >= 0 && bearer <= 0x1f); + ogs_assert(direction == 0 || direction == 1); + ogs_assert(pkbuf); + ogs_assert(pkbuf->data); + ogs_assert(pkbuf->len); switch(algorithm_identity) { case NAS_SECURITY_ALGORITHMS_128_EEA1: { snow_3g_f8(knas_enc, count, bearer, direction, - pkbuf->payload, (pkbuf->len << 3)); + pkbuf->data, (pkbuf->len << 3)); break; } case NAS_SECURITY_ALGORITHMS_128_EEA2: { count = htonl(count); - c_uint8_t ivec[16]; + uint8_t ivec[16]; memset(ivec, 0, 16); memcpy(ivec + 0, &count, sizeof(count)); ivec[4] = (bearer << 3) | (direction << 2); - aes_ctr128_encrypt(knas_enc, ivec, - pkbuf->payload, pkbuf->len, pkbuf->payload); + ogs_aes_ctr128_encrypt(knas_enc, ivec, + pkbuf->data, pkbuf->len, pkbuf->data); break; } case NAS_SECURITY_ALGORITHMS_128_EEA3: { zuc_eea3(knas_enc, count, bearer, direction, - (pkbuf->len << 3), pkbuf->payload, pkbuf->payload); + (pkbuf->len << 3), pkbuf->data, pkbuf->data); break; } case NAS_SECURITY_ALGORITHMS_EEA0: { - d_error("Invalid identity : NAS_SECURITY_ALGORITHMS_EEA0"); + ogs_error("Invalid identity : NAS_SECURITY_ALGORITHMS_EEA0"); break; } default: { - d_assert(0, return, "Unknown algorithm identity(%d)", - algorithm_identity); + ogs_assert_if_reached(); break; } } diff --git a/src/mme/nas_security.h b/src/mme/nas_security.h index 04bd9165a..9c752215c 100644 --- a/src/mme/nas_security.h +++ b/src/mme/nas_security.h @@ -1,9 +1,7 @@ #ifndef __NAS_SECURITY_H__ #define __NAS_SECURITY_H__ -#include "core_pkbuf.h" -#include "core_aes.h" -#include "core_aes_cmac.h" +#include "ogs-crypt.h" #include "mme_context.h" #include "snow_3g.h" @@ -22,28 +20,28 @@ extern "C" { typedef struct _nas_security_header_type_t { union { struct { - ED5(c_uint8_t integrity_protected:1;, - c_uint8_t ciphered:1;, - c_uint8_t new_security_context:1;, - c_uint8_t service_request:1;, - c_uint8_t reserved:4;) + ED5(uint8_t integrity_protected:1;, + uint8_t ciphered:1;, + uint8_t new_security_context:1;, + uint8_t service_request:1;, + uint8_t reserved:4;) }; - c_uint8_t type; + uint8_t type; }; } __attribute__ ((packed)) nas_security_header_type_t; -CORE_DECLARE(status_t) nas_security_encode( - pkbuf_t **pkbuf, mme_ue_t *mme_ue, nas_message_t *message); -CORE_DECLARE(status_t) nas_security_decode(mme_ue_t *mme_ue, - nas_security_header_type_t security_header_type, pkbuf_t *pkbuf); +int nas_security_encode( + ogs_pkbuf_t **pkbuf, mme_ue_t *mme_ue, nas_message_t *message); +int nas_security_decode(mme_ue_t *mme_ue, + nas_security_header_type_t security_header_type, ogs_pkbuf_t *pkbuf); -CORE_DECLARE(void) nas_mac_calculate(c_uint8_t algorithm_identity, - c_uint8_t *knas_int, c_uint32_t count, c_uint8_t bearer, - c_uint8_t direction, pkbuf_t *pkbuf, c_uint8_t *mac); +void nas_mac_calculate(uint8_t algorithm_identity, + uint8_t *knas_int, uint32_t count, uint8_t bearer, + uint8_t direction, ogs_pkbuf_t *pkbuf, uint8_t *mac); -CORE_DECLARE(void) nas_encrypt(c_uint8_t algorithm_identity, - c_uint8_t *knas_enc, c_uint32_t count, c_uint8_t bearer, - c_uint8_t direction, pkbuf_t *pkbuf); +void nas_encrypt(uint8_t algorithm_identity, + uint8_t *knas_enc, uint32_t count, uint8_t bearer, + uint8_t direction, ogs_pkbuf_t *pkbuf); #ifdef __cplusplus } diff --git a/src/mme/ogs-sctp.c b/src/mme/ogs-sctp.c new file mode 100644 index 000000000..c027beb0f --- /dev/null +++ b/src/mme/ogs-sctp.c @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-sctp.h" + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __ogs_sock_domain + +static int subscribe_to_events(ogs_sock_t *sock); +static int set_paddrparams(ogs_sock_t *sock, uint32_t spp_hbinterval); +static int set_rtoinfo(ogs_sock_t *sock, + uint32_t srto_initial, uint32_t srto_min, uint32_t srto_max); +static int set_initmsg(ogs_sock_t *sock, + uint32_t sinit_num_ostreams, uint32_t sinit_max_instreams, + uint32_t sinit_max_attempts, uint32_t sinit_max_init_timeo); + +static int sctp_num_ostreams = -1; + +void ogs_sctp_set_num_ostreams(int sctp_streams) +{ + sctp_num_ostreams = sctp_streams; +} + +ogs_sock_t *ogs_sctp_socket(int family, int type) +{ + ogs_sock_t *new = NULL; + int rv; + + new = ogs_sock_socket(family, type, IPPROTO_SCTP); + ogs_assert(new); + + rv = subscribe_to_events(new); + ogs_assert(rv == OGS_OK); + + /* heartbit interval : 5 secs */ + rv = set_paddrparams(new, 5000); + ogs_assert(rv == OGS_OK); + + /* + * RTO info + * + * initial : 3 secs + * min : 1 sec + * max : 5 secs + */ + rv = set_rtoinfo(new, 3000, 1000, 5000); + ogs_assert(rv == OGS_OK); + + /* + * INITMSG + * + * max number of input streams : 65535 + * max attemtps : 4 + * max initial timeout : 8 secs + */ + rv = set_initmsg(new, sctp_num_ostreams, 65535, 4, 8000); + ogs_assert(rv == OGS_OK); + + return new; +} + +ogs_sock_t *ogs_sctp_server(int type, ogs_sockaddr_t *sa_list) +{ + int rv; + ogs_sock_t *new; + ogs_sockaddr_t *addr; + char buf[OGS_ADDRSTRLEN]; + + addr = sa_list; + while (addr) { + new = ogs_sctp_socket(addr->c_sa_family, type); + if (new) { + rv = ogs_listen_reusable(new->fd); + ogs_assert(rv == OGS_OK); + + if (ogs_sock_bind(new, addr) == OGS_OK) { + ogs_debug("sctp_server() [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + break; + } + + ogs_sock_destroy(new); + } + + addr = addr->next; + } + + if (addr == NULL) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "sctp_server() [%s]:%d failed", + OGS_ADDR(sa_list, buf), OGS_PORT(sa_list)); + return NULL; + } + + rv = ogs_sock_listen(new); + ogs_assert(rv == OGS_OK); + + return new; +} + +ogs_sock_t *ogs_sctp_client(int type, ogs_sockaddr_t *sa_list) +{ + ogs_sock_t *new = NULL; + ogs_sockaddr_t *addr; + char buf[OGS_ADDRSTRLEN]; + + addr = sa_list; + while (addr) { + new = ogs_sctp_socket(addr->c_sa_family, type); + if (new) { + if (ogs_sock_connect(new, addr) == OGS_OK) { + ogs_debug("sctp_client() [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + break; + } + + ogs_sock_destroy(new); + } + + addr = addr->next; + } + + if (addr == NULL) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "sctp_client() [%s]:%d failed", + OGS_ADDR(sa_list, buf), OGS_PORT(sa_list)); + return NULL; + } + + return new; +} + +int ogs_sctp_connect(ogs_sock_t *sock, ogs_sockaddr_t *sa_list) +{ + ogs_sockaddr_t *addr; + char buf[OGS_ADDRSTRLEN]; + + ogs_assert(sock); + + addr = sa_list; + while (addr) { + if (ogs_sock_connect(sock, addr) == OGS_OK) { + ogs_debug("sctp_connect() [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + break; + } + + addr = addr->next; + } + + if (addr == NULL) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "sctp_connect() [%s]:%d failed", + OGS_ADDR(sa_list, buf), OGS_PORT(sa_list)); + return OGS_ERROR; + } + + return OGS_OK; +} + +int ogs_sctp_sendmsg(ogs_sock_t *sock, const void *msg, size_t len, + ogs_sockaddr_t *to, uint32_t ppid, uint16_t stream_no) +{ + int size; + socklen_t addrlen = 0; + + ogs_assert(sock); + + if (to) + addrlen = ogs_sockaddr_len(to); + + size = sctp_sendmsg(sock->fd, msg, len, + to ? &to->sa : NULL, addrlen, + htonl(ppid), + 0, /* flags */ + stream_no, + 0, /* timetolive */ + 0); /* context */ + if (size < 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "sctp_sendmsg(len:%d) failed", (int)len); + } + + return size; +} + +int ogs_sctp_recvmsg(ogs_sock_t *sock, void *msg, size_t len, + ogs_sockaddr_t *from, ogs_sctp_info_t *sinfo, int *msg_flags) +{ + int size; + socklen_t addrlen = sizeof(struct sockaddr_storage); + + int flags = 0; + struct sctp_sndrcvinfo sndrcvinfo; + + ogs_assert(sock); + + size = sctp_recvmsg(sock->fd, msg, len, + from ? &from->sa : NULL, from ? &addrlen : NULL, + &sndrcvinfo, &flags); + if (size < 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "sctp_recvmsg(%d) failed", size); + return size; + } + + if (msg_flags) { + *msg_flags = flags; + } + + if (sinfo) { + sinfo->ppid = ntohl(sndrcvinfo.sinfo_ppid); + sinfo->stream_no = sndrcvinfo.sinfo_stream; + } + + return size; +} + +int ogs_sctp_recvdata(ogs_sock_t *sock, void *msg, size_t len, + ogs_sockaddr_t *from, ogs_sctp_info_t *sinfo) +{ + int size; + int flags = 0; + + do { + size = ogs_sctp_recvmsg(sock, msg, len, from, sinfo, &flags); + if (size < 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "ogs_sctp_recvdata(%d)", size); + return size; + } + + if (flags & MSG_NOTIFICATION) { + /* Nothing */ + } + else if (flags & MSG_EOR) { + break; + } + else { + ogs_assert_if_reached(); + } + } while(1); + + return size; +} + +static int subscribe_to_events(ogs_sock_t *sock) +{ + struct sctp_event_subscribe event; + + ogs_assert(sock); + + memset(&event, 0, sizeof(event)); + event.sctp_data_io_event = 1; + event.sctp_association_event = 1; + event.sctp_send_failure_event = 1; + event.sctp_shutdown_event = 1; + + if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_EVENTS, + &event, sizeof(event)) != 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Unable to subscribe to SCTP events"); + return OGS_ERROR; + } + + return OGS_OK; +} + +static int set_paddrparams(ogs_sock_t *sock, uint32_t spp_hbinterval) +{ + struct sctp_paddrparams heartbeat; + socklen_t socklen; + + ogs_assert(sock); + + memset(&heartbeat, 0, sizeof(heartbeat)); + socklen = sizeof(heartbeat); + if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, + &heartbeat, &socklen) != 0 ) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "getsockopt for SCTP_PEER_ADDR failed"); + return OGS_ERROR; + } + + ogs_trace("Old spp _flags = 0x%x hbinter = %d pathmax = %d", + heartbeat.spp_flags, + heartbeat.spp_hbinterval, + heartbeat.spp_pathmaxrxt); + + heartbeat.spp_hbinterval = spp_hbinterval; + + if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, + &heartbeat, sizeof( heartbeat)) != 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "setsockopt for SCTP_PEER_ADDR_PARAMS failed"); + return OGS_ERROR; + } + + ogs_trace("New spp _flags = 0x%x hbinter = %d pathmax = %d", + heartbeat.spp_flags, + heartbeat.spp_hbinterval, + heartbeat.spp_pathmaxrxt); + + return OGS_OK; +} + +static int set_rtoinfo(ogs_sock_t *sock, + uint32_t srto_initial, uint32_t srto_min, uint32_t srto_max) +{ + struct sctp_rtoinfo rtoinfo; + socklen_t socklen; + + ogs_assert(sock); + + memset(&rtoinfo, 0, sizeof(rtoinfo)); + socklen = sizeof(rtoinfo); + if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_RTOINFO, + &rtoinfo, &socklen) != 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "getsockopt for SCTP_RTOINFO failed"); + return OGS_ERROR; + } + + ogs_trace("Old RTO (initial:%d max:%d min:%d)", + rtoinfo.srto_initial, + rtoinfo.srto_max, + rtoinfo.srto_min); + + rtoinfo.srto_initial = srto_initial; + rtoinfo.srto_min = srto_min; + rtoinfo.srto_max = srto_max; + + if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_RTOINFO, + &rtoinfo, sizeof(rtoinfo)) != 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "setsockopt for SCTP_RTOINFO failed"); + return OGS_ERROR; + } + ogs_trace("New RTO (initial:%d max:%d min:%d)", + rtoinfo.srto_initial, + rtoinfo.srto_max, + rtoinfo.srto_min); + + return OGS_OK; +} + +static int set_initmsg(ogs_sock_t *sock, + uint32_t sinit_num_ostreams, uint32_t sinit_max_instreams, + uint32_t sinit_max_attempts, uint32_t sinit_max_init_timeo) +{ + struct sctp_initmsg initmsg; + socklen_t socklen; + + ogs_assert(sock); + ogs_assert(sinit_num_ostreams > 1); + + memset(&initmsg, 0, sizeof(initmsg)); + socklen = sizeof(initmsg); + if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_INITMSG, + &initmsg, &socklen) != 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "getsockopt for SCTP_INITMSG failed"); + return OGS_ERROR; + } + + ogs_trace("Old INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)", + initmsg.sinit_num_ostreams, + initmsg.sinit_max_instreams, + initmsg.sinit_max_attempts, + initmsg.sinit_max_init_timeo); + + initmsg.sinit_num_ostreams = sinit_num_ostreams; + initmsg.sinit_max_instreams = sinit_max_instreams; + initmsg.sinit_max_attempts = sinit_max_attempts; + initmsg.sinit_max_init_timeo = sinit_max_init_timeo; + + if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_INITMSG, + &initmsg, sizeof(initmsg)) != 0) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "setsockopt for SCTP_INITMSG failed"); + return OGS_ERROR; + } + + ogs_trace("New INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)", + initmsg.sinit_num_ostreams, + initmsg.sinit_max_instreams, + initmsg.sinit_max_attempts, + initmsg.sinit_max_init_timeo); + + return OGS_OK; +} diff --git a/src/mme/ogs-sctp.h b/src/mme/ogs-sctp.h new file mode 100644 index 000000000..6cd0365bc --- /dev/null +++ b/src/mme/ogs-sctp.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef OGS_SCTP_H +#define OGS_SCTP_H + +#include "base/base.h" + +#if HAVE_NETINET_SCTP_H +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sctp_info_s { + uint32_t ppid; + uint16_t stream_no; + uint16_t inbound_streams; + uint16_t outbound_streams; +} ogs_sctp_info_t; + +void ogs_sctp_set_num_ostreams(int sctp_streams); + +ogs_sock_t *ogs_sctp_socket(int family, int type); +ogs_sock_t *ogs_sctp_server(int type, ogs_sockaddr_t *sa_list); +ogs_sock_t *ogs_sctp_client(int type, ogs_sockaddr_t *sa_list); +int ogs_sctp_connect(ogs_sock_t *sock, ogs_sockaddr_t *sa_list); +int ogs_sctp_sendmsg(ogs_sock_t *sock, const void *msg, size_t len, + ogs_sockaddr_t *to, uint32_t ppid, uint16_t stream_no); +int ogs_sctp_recvmsg(ogs_sock_t *sock, void *msg, size_t len, + ogs_sockaddr_t *from, ogs_sctp_info_t *sinfo, int *msg_flags); +int ogs_sctp_recvdata(ogs_sock_t *sock, void *msg, size_t len, + ogs_sockaddr_t *from, ogs_sctp_info_t *sinfo); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SCTP_H */ diff --git a/src/mme/s1ap_build.c b/src/mme/s1ap_build.c index 9f49ae648..796b8ae94 100644 --- a/src/mme/s1ap_build.c +++ b/src/mme/s1ap_build.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _s1ap_build - -#include "core_debug.h" - #include "fd/s6a/s6a_message.h" #include "mme_context.h" @@ -10,9 +6,9 @@ #include "s1ap_build.h" #include "s1ap_conv.h" -status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) +int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf) { - status_t rv; + int rv; int i, j; S1AP_S1AP_PDU_t pdu; @@ -26,7 +22,7 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = S1AP_ProcedureCode_id_S1Setup; @@ -36,7 +32,7 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) S1SetupResponse = &successfulOutcome->value.choice.S1SetupResponse; - ie = core_calloc(1, sizeof(S1AP_S1SetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupResponseIEs_t)); ASN_SEQUENCE_ADD(&S1SetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_ServedGUMMEIs; @@ -45,7 +41,7 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) ServedGUMMEIs = &ie->value.choice.ServedGUMMEIs; - ie = core_calloc(1, sizeof(S1AP_S1SetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupResponseIEs_t)); ASN_SEQUENCE_ADD(&S1SetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_RelativeMMECapacity; @@ -58,19 +54,19 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) { S1AP_ServedGUMMEIsItem_t *ServedGUMMEIsItem = NULL; ServedGUMMEIsItem = (S1AP_ServedGUMMEIsItem_t *) - core_calloc(1, sizeof(S1AP_ServedGUMMEIsItem_t)); + ogs_calloc(1, sizeof(S1AP_ServedGUMMEIsItem_t)); served_gummei_t *served_gummei = &mme_self()->served_gummei[i]; for (j = 0; j < served_gummei->num_of_plmn_id; j++) { S1AP_PLMNidentity_t *PLMNidentity = NULL; PLMNidentity = (S1AP_PLMNidentity_t *) - core_calloc(1, sizeof(S1AP_PLMNidentity_t)); + ogs_calloc(1, sizeof(S1AP_PLMNidentity_t)); s1ap_buffer_to_OCTET_STRING( &served_gummei->plmn_id[j], PLMN_ID_LEN, PLMNidentity); ASN_SEQUENCE_ADD( &ServedGUMMEIsItem->servedPLMNs.list, PLMNidentity); - d_trace(5, " PLMN_ID[MCC:%d MNC:%d]\n", + ogs_debug(" PLMN_ID[MCC:%d MNC:%d]", plmn_id_mcc(&served_gummei->plmn_id[j]), plmn_id_mnc(&served_gummei->plmn_id[j])); } @@ -79,22 +75,22 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) { S1AP_MME_Group_ID_t *MME_Group_ID = NULL; MME_Group_ID = (S1AP_MME_Group_ID_t *) - core_calloc(1, sizeof(S1AP_MME_Group_ID_t)); + ogs_calloc(1, sizeof(S1AP_MME_Group_ID_t)); s1ap_uint16_to_OCTET_STRING( served_gummei->mme_gid[j], MME_Group_ID); ASN_SEQUENCE_ADD( &ServedGUMMEIsItem->servedGroupIDs.list, MME_Group_ID); - d_trace(5, " MME Group[%d]\n", served_gummei->mme_gid[j]); + ogs_debug(" MME Group[%d]", served_gummei->mme_gid[j]); } for (j = 0; j < served_gummei->num_of_mme_code; j++) { S1AP_MME_Code_t *MME_Code = NULL ; MME_Code = (S1AP_MME_Code_t *) - core_calloc(1, sizeof(S1AP_MME_Code_t)); + ogs_calloc(1, sizeof(S1AP_MME_Code_t)); s1ap_uint8_to_OCTET_STRING(served_gummei->mme_code[j], MME_Code); ASN_SEQUENCE_ADD(&ServedGUMMEIsItem->servedMMECs.list, MME_Code); - d_trace(5, " MME Code[%d]\n", served_gummei->mme_code[j]); + ogs_debug(" MME Code[%d]", served_gummei->mme_code[j]); } ASN_SEQUENCE_ADD(&ServedGUMMEIs->list, ServedGUMMEIsItem); } @@ -104,19 +100,19 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf) rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_setup_failure( - pkbuf_t **pkbuf, S1AP_Cause_PR group, long cause, long time_to_wait) +int s1ap_build_setup_failure( + ogs_pkbuf_t **pkbuf, S1AP_Cause_PR group, long cause, long time_to_wait) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL; @@ -126,13 +122,13 @@ status_t s1ap_build_setup_failure( S1AP_Cause_t *Cause = NULL; S1AP_TimeToWait_t *TimeToWait = NULL; - d_trace(5, " Group[%d] Cause[%d] TimeToWait[%ld]\n", - group, cause, time_to_wait); + ogs_debug(" Group[%d] Cause[%d] TimeToWait[%ld]", + group, (int)cause, time_to_wait); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_unsuccessfulOutcome; pdu.choice.unsuccessfulOutcome = - core_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t)); unsuccessfulOutcome = pdu.choice.unsuccessfulOutcome; unsuccessfulOutcome->procedureCode = S1AP_ProcedureCode_id_S1Setup; @@ -142,7 +138,7 @@ status_t s1ap_build_setup_failure( S1SetupFailure = &unsuccessfulOutcome->value.choice.S1SetupFailure; - ie = core_calloc(1, sizeof(S1AP_S1SetupFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupFailureIEs_t)); ASN_SEQUENCE_ADD(&S1SetupFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -153,7 +149,7 @@ status_t s1ap_build_setup_failure( if (time_to_wait > -1) { - ie = core_calloc(1, sizeof(S1AP_S1SetupFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupFailureIEs_t)); ASN_SEQUENCE_ADD(&S1SetupFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_TimeToWait; @@ -172,19 +168,19 @@ status_t s1ap_build_setup_failure( rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_downlink_nas_transport( - pkbuf_t **s1apbuf, enb_ue_t *enb_ue, pkbuf_t *emmbuf) +int s1ap_build_downlink_nas_transport( + ogs_pkbuf_t **s1apbuf, enb_ue_t *enb_ue, ogs_pkbuf_t *emmbuf) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -195,15 +191,15 @@ status_t s1ap_build_downlink_nas_transport( S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL; S1AP_NAS_PDU_t *NAS_PDU = NULL; - d_assert(emmbuf, return CORE_ERROR, "Null param"); - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(emmbuf); + ogs_assert(enb_ue); - d_trace(3, "[MME] Downlink NAS transport\n"); + ogs_debug("[MME] Downlink NAS transport"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = @@ -215,7 +211,7 @@ status_t s1ap_build_downlink_nas_transport( DownlinkNASTransport = &initiatingMessage->value.choice.DownlinkNASTransport; - ie = core_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t)); ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -224,7 +220,7 @@ status_t s1ap_build_downlink_nas_transport( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t)); ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -233,7 +229,7 @@ status_t s1ap_build_downlink_nas_transport( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_DownlinkNASTransport_IEs_t)); ASN_SEQUENCE_ADD(&DownlinkNASTransport->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; @@ -242,33 +238,33 @@ status_t s1ap_build_downlink_nas_transport( NAS_PDU = &ie->value.choice.NAS_PDU; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); *MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id; NAS_PDU->size = emmbuf->len; - NAS_PDU->buf = core_calloc(NAS_PDU->size, sizeof(c_uint8_t)); - memcpy(NAS_PDU->buf, emmbuf->payload, NAS_PDU->size); - pkbuf_free(emmbuf); + NAS_PDU->buf = ogs_calloc(NAS_PDU->size, sizeof(uint8_t)); + memcpy(NAS_PDU->buf, emmbuf->data, NAS_PDU->size); + ogs_pkbuf_free(emmbuf); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_initial_context_setup_request( - pkbuf_t **s1apbuf, mme_ue_t *mme_ue, pkbuf_t *emmbuf) +int s1ap_build_initial_context_setup_request( + ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue, ogs_pkbuf_t *emmbuf) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -287,18 +283,18 @@ status_t s1ap_build_initial_context_setup_request( mme_bearer_t *bearer = NULL; s6a_subscription_data_t *subscription_data = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); subscription_data = &mme_ue->subscription_data; - d_assert(subscription_data, return CORE_ERROR, "Null param"); + ogs_assert(subscription_data); - d_trace(3, "[MME] Initial context setup request\n"); + ogs_debug("[MME] Initial context setup request"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = @@ -310,7 +306,7 @@ status_t s1ap_build_initial_context_setup_request( InitialContextSetupRequest = &initiatingMessage->value.choice.InitialContextSetupRequest; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -320,7 +316,7 @@ status_t s1ap_build_initial_context_setup_request( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -330,7 +326,7 @@ status_t s1ap_build_initial_context_setup_request( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate; @@ -340,7 +336,7 @@ status_t s1ap_build_initial_context_setup_request( UEAggregateMaximumBitrate = &ie->value.choice.UEAggregateMaximumBitrate; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq; @@ -350,7 +346,7 @@ status_t s1ap_build_initial_context_setup_request( E_RABToBeSetupListCtxtSUReq = &ie->value.choice.E_RABToBeSetupListCtxtSUReq; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UESecurityCapabilities; @@ -360,7 +356,7 @@ status_t s1ap_build_initial_context_setup_request( UESecurityCapabilities = &ie->value.choice.UESecurityCapabilities; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SecurityKey; @@ -370,7 +366,7 @@ status_t s1ap_build_initial_context_setup_request( SecurityKey = &ie->value.choice.SecurityKey; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); *MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; @@ -394,7 +390,7 @@ status_t s1ap_build_initial_context_setup_request( S1AP_GBR_QosInformation_t *gbrQosInformation = NULL; S1AP_NAS_PDU_t *nasPdu = NULL; - item = core_calloc( + item = ogs_calloc( 1, sizeof(S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t)); ASN_SEQUENCE_ADD(&E_RABToBeSetupListCtxtSUReq->list, item); @@ -407,7 +403,7 @@ status_t s1ap_build_initial_context_setup_request( e_rab->e_RAB_ID = bearer->ebi; e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.qci; - d_trace(5, " EBI[%d] QCI[%d] SGW-S1U-TEID[%d]\n", + ogs_debug(" EBI[%d] QCI[%d] SGW-S1U-TEID[%d]", bearer->ebi, bearer->qos.qci, bearer->sgw_s1u_teid); e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. @@ -432,7 +428,7 @@ status_t s1ap_build_initial_context_setup_request( bearer->qos.gbr.uplink = MAX_BIT_RATE; gbrQosInformation = - core_calloc(1, sizeof(struct S1AP_GBR_QosInformation)); + ogs_calloc(1, sizeof(struct S1AP_GBR_QosInformation)); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, bearer->qos.mbr.downlink); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, @@ -447,18 +443,18 @@ status_t s1ap_build_initial_context_setup_request( rv = s1ap_ip_to_BIT_STRING( &bearer->sgw_s1u_ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(bearer->sgw_s1u_teid, &e_rab->gTP_TEID); if (emmbuf && emmbuf->len) { - nasPdu = (S1AP_NAS_PDU_t *)core_calloc( + nasPdu = (S1AP_NAS_PDU_t *)ogs_calloc( 1, sizeof(S1AP_NAS_PDU_t)); nasPdu->size = emmbuf->len; - nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t)); - memcpy(nasPdu->buf, emmbuf->payload, nasPdu->size); + nasPdu->buf = ogs_calloc(nasPdu->size, sizeof(uint8_t)); + memcpy(nasPdu->buf, emmbuf->data, nasPdu->size); e_rab->nAS_PDU = nasPdu; - pkbuf_free(emmbuf); + ogs_pkbuf_free(emmbuf); } bearer = mme_bearer_next(bearer); @@ -468,23 +464,23 @@ status_t s1ap_build_initial_context_setup_request( UESecurityCapabilities->encryptionAlgorithms.size = 2; UESecurityCapabilities->encryptionAlgorithms.buf = - core_calloc(UESecurityCapabilities->encryptionAlgorithms.size, - sizeof(c_uint8_t)); + ogs_calloc(UESecurityCapabilities->encryptionAlgorithms.size, + sizeof(uint8_t)); UESecurityCapabilities->encryptionAlgorithms.bits_unused = 0; UESecurityCapabilities->encryptionAlgorithms.buf[0] = (mme_ue->ue_network_capability.eea << 1); UESecurityCapabilities->integrityProtectionAlgorithms.size = 2; UESecurityCapabilities->integrityProtectionAlgorithms.buf = - core_calloc(UESecurityCapabilities-> - integrityProtectionAlgorithms.size, sizeof(c_uint8_t)); + ogs_calloc(UESecurityCapabilities-> + integrityProtectionAlgorithms.size, sizeof(uint8_t)); UESecurityCapabilities->integrityProtectionAlgorithms.bits_unused = 0; UESecurityCapabilities->integrityProtectionAlgorithms.buf[0] = (mme_ue->ue_network_capability.eia << 1); - SecurityKey->size = SHA256_DIGEST_SIZE; + SecurityKey->size = OGS_SHA256_DIGEST_SIZE; SecurityKey->buf = - core_calloc(SecurityKey->size, sizeof(c_uint8_t)); + ogs_calloc(SecurityKey->size, sizeof(uint8_t)); SecurityKey->bits_unused = 0; memcpy(SecurityKey->buf, mme_ue->kenb, SecurityKey->size); @@ -493,7 +489,7 @@ status_t s1ap_build_initial_context_setup_request( { S1AP_UERadioCapability_t *UERadioCapability = NULL; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UERadioCapability; @@ -503,7 +499,7 @@ status_t s1ap_build_initial_context_setup_request( UERadioCapability = &ie->value.choice.UERadioCapability; - d_assert(UERadioCapability, return CORE_ERROR,); + ogs_assert(UERadioCapability); s1ap_buffer_to_OCTET_STRING( mme_ue->ueRadioCapability.buf, mme_ue->ueRadioCapability.size, UERadioCapability); @@ -512,19 +508,19 @@ status_t s1ap_build_initial_context_setup_request( rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_e_rab_setup_request( - pkbuf_t **s1apbuf, mme_bearer_t *bearer, pkbuf_t *esmbuf) +int s1ap_build_e_rab_setup_request( + ogs_pkbuf_t **s1apbuf, mme_bearer_t *bearer, ogs_pkbuf_t *esmbuf) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -543,18 +539,18 @@ status_t s1ap_build_e_rab_setup_request( mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; - d_assert(esmbuf, return CORE_ERROR, "Null param"); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(esmbuf); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_E_RABSetup; @@ -564,7 +560,7 @@ status_t s1ap_build_e_rab_setup_request( E_RABSetupRequest = &initiatingMessage->value.choice.E_RABSetupRequest; - ie = core_calloc(1, sizeof(S1AP_E_RABSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -573,7 +569,7 @@ status_t s1ap_build_e_rab_setup_request( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -582,7 +578,7 @@ status_t s1ap_build_e_rab_setup_request( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABSetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABSetupRequestIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq; @@ -593,13 +589,13 @@ status_t s1ap_build_e_rab_setup_request( E_RABToBeSetupListBearerSUReq = &ie->value.choice.E_RABToBeSetupListBearerSUReq; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); *MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id; - item = core_calloc(1, sizeof(S1AP_E_RABToBeSetupItemBearerSUReqIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABToBeSetupItemBearerSUReqIEs_t)); ASN_SEQUENCE_ADD(&E_RABToBeSetupListBearerSUReq->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABToBeSetupItemBearerSUReq; @@ -611,7 +607,7 @@ status_t s1ap_build_e_rab_setup_request( e_rab->e_RAB_ID = bearer->ebi; e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.qci; - d_trace(5, " EBI[%d] QCI[%d]\n", bearer->ebi, bearer->qos.qci); + ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.qci); e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. priorityLevel = bearer->qos.arp.priority_level; @@ -632,7 +628,7 @@ status_t s1ap_build_e_rab_setup_request( if (bearer->qos.gbr.uplink == 0) bearer->qos.gbr.uplink = MAX_BIT_RATE; - gbrQosInformation = core_calloc(1, sizeof(S1AP_GBR_QosInformation_t)); + gbrQosInformation = ogs_calloc(1, sizeof(S1AP_GBR_QosInformation_t)); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, bearer->qos.mbr.downlink); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, @@ -646,32 +642,32 @@ status_t s1ap_build_e_rab_setup_request( rv = s1ap_ip_to_BIT_STRING( &bearer->sgw_s1u_ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(bearer->sgw_s1u_teid, &e_rab->gTP_TEID); - d_trace(5, " SGW-S1U-TEID[%d]\n", bearer->sgw_s1u_teid); + ogs_debug(" SGW-S1U-TEID[%d]", bearer->sgw_s1u_teid); nasPdu = &e_rab->nAS_PDU; nasPdu->size = esmbuf->len; - nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t)); - memcpy(nasPdu->buf, esmbuf->payload, nasPdu->size); - pkbuf_free(esmbuf); + nasPdu->buf = ogs_calloc(nasPdu->size, sizeof(uint8_t)); + memcpy(nasPdu->buf, esmbuf->data, nasPdu->size); + ogs_pkbuf_free(esmbuf); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_e_rab_modify_request( - pkbuf_t **s1apbuf, mme_bearer_t *bearer, pkbuf_t *esmbuf) +int s1ap_build_e_rab_modify_request( + ogs_pkbuf_t **s1apbuf, mme_bearer_t *bearer, ogs_pkbuf_t *esmbuf) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -691,19 +687,19 @@ status_t s1ap_build_e_rab_modify_request( mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; - d_assert(esmbuf, return CORE_ERROR, "Null param"); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(esmbuf); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); - d_trace(3, "[MME] E-RAB modify request\n"); + ogs_debug("[MME] E-RAB modify request"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_E_RABModify; @@ -713,7 +709,7 @@ status_t s1ap_build_e_rab_modify_request( E_RABModifyRequest = &initiatingMessage->value.choice.E_RABModifyRequest; - ie = core_calloc(1, sizeof(S1AP_E_RABModifyRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABModifyRequestIEs_t)); ASN_SEQUENCE_ADD(&E_RABModifyRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -722,7 +718,7 @@ status_t s1ap_build_e_rab_modify_request( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABModifyRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABModifyRequestIEs_t)); ASN_SEQUENCE_ADD(&E_RABModifyRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -731,7 +727,7 @@ status_t s1ap_build_e_rab_modify_request( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABModifyRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABModifyRequestIEs_t)); ASN_SEQUENCE_ADD(&E_RABModifyRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq; @@ -742,13 +738,13 @@ status_t s1ap_build_e_rab_modify_request( E_RABToBeModifiedListBearerModReq = &ie->value.choice.E_RABToBeModifiedListBearerModReq; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); *MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id; - item = core_calloc(1, sizeof(S1AP_E_RABToBeModifiedItemBearerModReqIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABToBeModifiedItemBearerModReqIEs_t)); ASN_SEQUENCE_ADD(&E_RABToBeModifiedListBearerModReq->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABToBeModifiedItemBearerModReq; @@ -760,7 +756,7 @@ status_t s1ap_build_e_rab_modify_request( e_rab->e_RAB_ID = bearer->ebi; e_rab->e_RABLevelQoSParameters.qCI = bearer->qos.qci; - d_trace(5, " EBI[%d] QCI[%d]\n", bearer->ebi, bearer->qos.qci); + ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.qci); e_rab->e_RABLevelQoSParameters.allocationRetentionPriority. priorityLevel = bearer->qos.arp.priority_level; @@ -782,7 +778,7 @@ status_t s1ap_build_e_rab_modify_request( bearer->qos.gbr.uplink = MAX_BIT_RATE; gbrQosInformation = - core_calloc(1, sizeof(S1AP_GBR_QosInformation_t)); + ogs_calloc(1, sizeof(S1AP_GBR_QosInformation_t)); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, bearer->qos.mbr.downlink); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, @@ -796,27 +792,27 @@ status_t s1ap_build_e_rab_modify_request( nasPdu = &e_rab->nAS_PDU; nasPdu->size = esmbuf->len; - nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t)); - memcpy(nasPdu->buf, esmbuf->payload, nasPdu->size); - pkbuf_free(esmbuf); + nasPdu->buf = ogs_calloc(nasPdu->size, sizeof(uint8_t)); + memcpy(nasPdu->buf, esmbuf->data, nasPdu->size); + ogs_pkbuf_free(esmbuf); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, - mme_bearer_t *bearer, pkbuf_t *esmbuf, +int s1ap_build_e_rab_release_command(ogs_pkbuf_t **s1apbuf, + mme_bearer_t *bearer, ogs_pkbuf_t *esmbuf, S1AP_Cause_PR group, long cause) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -836,22 +832,22 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, enb_ue_t *enb_ue = NULL; s6a_subscription_data_t *subscription_data = NULL; - d_assert(esmbuf, return CORE_ERROR, "Null param"); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(esmbuf); + ogs_assert(bearer); mme_ue = bearer->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); subscription_data = &mme_ue->subscription_data; - d_assert(subscription_data, return CORE_ERROR, "Null param"); + ogs_assert(subscription_data); - d_trace(3, "[MME] E-RAB release command\n"); + ogs_debug("[MME] E-RAB release command"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_E_RABRelease; @@ -861,7 +857,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, E_RABReleaseCommand = &initiatingMessage->value.choice.E_RABReleaseCommand; - ie = core_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); ASN_SEQUENCE_ADD(&E_RABReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -870,7 +866,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); ASN_SEQUENCE_ADD(&E_RABReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -879,7 +875,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); ASN_SEQUENCE_ADD(&E_RABReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate; @@ -889,7 +885,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, UEAggregateMaximumBitrate = &ie->value.choice.UEAggregateMaximumBitrate; - ie = core_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); ASN_SEQUENCE_ADD(&E_RABReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeReleasedList; @@ -898,7 +894,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, E_RABList = &ie->value.choice.E_RABList; - ie = core_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABReleaseCommandIEs_t)); ASN_SEQUENCE_ADD(&E_RABReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; @@ -907,7 +903,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, nasPdu = &ie->value.choice.NAS_PDU; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); *MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; @@ -920,7 +916,7 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateDL, subscription_data->ambr.downlink); - item = core_calloc(1, sizeof(S1AP_E_RABItemIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABItemIEs_t)); ASN_SEQUENCE_ADD(&E_RABList->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABItem; @@ -933,29 +929,30 @@ status_t s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, e_rab->cause.present = group; e_rab->cause.choice.radioNetwork = cause; - d_trace(5, " EBI[%d] Gruop[%d] Cause[%d]\n", bearer->ebi, group, cause); + ogs_debug(" EBI[%d] Gruop[%d] Cause[%d]", + bearer->ebi, group, (int)cause); nasPdu->size = esmbuf->len; - nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t)); - memcpy(nasPdu->buf, esmbuf->payload, nasPdu->size); - pkbuf_free(esmbuf); + nasPdu->buf = ogs_calloc(nasPdu->size, sizeof(uint8_t)); + memcpy(nasPdu->buf, esmbuf->data, nasPdu->size); + ogs_pkbuf_free(esmbuf); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_ue_context_release_command( - pkbuf_t **s1apbuf, enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause) +int s1ap_build_ue_context_release_command( + ogs_pkbuf_t **s1apbuf, enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -965,18 +962,18 @@ status_t s1ap_build_ue_context_release_command( S1AP_UE_S1AP_IDs_t *UE_S1AP_IDs = NULL; S1AP_Cause_t *Cause = NULL; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); if (enb_ue->mme_ue_s1ap_id == 0) { - d_error("invalid mme ue s1ap id (idx: %d)", enb_ue->index); - return CORE_ERROR; + ogs_error("invalid mme ue s1ap id"); + return OGS_ERROR; } memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_UEContextRelease; @@ -987,7 +984,7 @@ status_t s1ap_build_ue_context_release_command( UEContextReleaseCommand = &initiatingMessage->value.choice.UEContextReleaseCommand; - ie = core_calloc(1, sizeof(S1AP_UEContextReleaseCommand_IEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_UEContextReleaseCommand_IEs_t)); ASN_SEQUENCE_ADD(&UEContextReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UE_S1AP_IDs; @@ -996,7 +993,7 @@ status_t s1ap_build_ue_context_release_command( UE_S1AP_IDs = &ie->value.choice.UE_S1AP_IDs; - ie = core_calloc(1, sizeof(S1AP_UEContextReleaseCommand_IEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_UEContextReleaseCommand_IEs_t)); ASN_SEQUENCE_ADD(&UEContextReleaseCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -1014,7 +1011,7 @@ status_t s1ap_build_ue_context_release_command( { UE_S1AP_IDs->present = S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair; UE_S1AP_IDs->choice.uE_S1AP_ID_pair = - core_calloc(1, sizeof(S1AP_UE_S1AP_ID_pair_t)); + ogs_calloc(1, sizeof(S1AP_UE_S1AP_ID_pair_t)); UE_S1AP_IDs->choice.uE_S1AP_ID_pair->mME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; UE_S1AP_IDs->choice.uE_S1AP_ID_pair->eNB_UE_S1AP_ID = @@ -1027,18 +1024,18 @@ status_t s1ap_build_ue_context_release_command( rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) +int s1ap_build_paging(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1054,18 +1051,18 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) S1AP_TAIItemIEs_t *item = NULL; S1AP_TAIItem_t *tai_item = NULL; - c_uint16_t index_value; - c_uint64_t ue_imsi_value = 0; + uint16_t index_value; + uint64_t ue_imsi_value = 0; int i = 0; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); - d_trace(3, "[MME] Paging\n"); + ogs_debug("[MME] Paging"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_Paging; @@ -1074,7 +1071,7 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) Paging = &initiatingMessage->value.choice.Paging; - ie = core_calloc(1, sizeof(S1AP_PagingIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PagingIEs_t)); ASN_SEQUENCE_ADD(&Paging->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UEIdentityIndexValue; @@ -1083,7 +1080,7 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) UEIdentityIndexValue = &ie->value.choice.UEIdentityIndexValue; - ie = core_calloc(1, sizeof(S1AP_PagingIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PagingIEs_t)); ASN_SEQUENCE_ADD(&Paging->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UEPagingID; @@ -1092,7 +1089,7 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) UEPagingID = &ie->value.choice.UEPagingID; - ie = core_calloc(1, sizeof(S1AP_PagingIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PagingIEs_t)); ASN_SEQUENCE_ADD(&Paging->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_CNDomain; @@ -1101,7 +1098,7 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) CNDomain = &ie->value.choice.CNDomain; - ie = core_calloc(1, sizeof(S1AP_PagingIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PagingIEs_t)); ASN_SEQUENCE_ADD(&Paging->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_TAIList; @@ -1113,7 +1110,7 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) /* Set UE Identity Index value : IMSI mod 4096 */ UEIdentityIndexValue->size = 2; UEIdentityIndexValue->buf = - core_calloc(UEIdentityIndexValue->size, sizeof(c_uint8_t)); + ogs_calloc(UEIdentityIndexValue->size, sizeof(uint8_t)); /* Conver string to value */ for (i = 0; i < strlen(mme_ue->imsi_bcd); i++) @@ -1130,19 +1127,19 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) /* Set Paging Identity */ UEPagingID->present = S1AP_UEPagingID_PR_s_TMSI; UEPagingID->choice.s_TMSI = - core_calloc(1, sizeof(S1AP_S_TMSI_t)); + ogs_calloc(1, sizeof(S1AP_S_TMSI_t)); s1ap_uint8_to_OCTET_STRING(mme_ue->guti.mme_code, &UEPagingID->choice.s_TMSI->mMEC); s1ap_uint32_to_OCTET_STRING(mme_ue->guti.m_tmsi, &UEPagingID->choice.s_TMSI->m_TMSI); - d_trace(5, " MME_CODE[%d] M_TMSI[0x%x]\n", + ogs_debug(" MME_CODE[%d] M_TMSI[0x%x]", mme_ue->guti.mme_code, mme_ue->guti.m_tmsi); *CNDomain = S1AP_CNDomain_ps; - item = core_calloc(1, sizeof(S1AP_TAIItemIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_TAIItemIEs_t)); ASN_SEQUENCE_ADD(&TAIList->list, item); item->id = S1AP_ProtocolIE_ID_id_TAIItem; @@ -1158,20 +1155,20 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_mme_configuration_transfer( - pkbuf_t **s1apbuf, +int s1ap_build_mme_configuration_transfer( + ogs_pkbuf_t **s1apbuf, S1AP_SONConfigurationTransfer_t *son_configuration_transfer) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1180,15 +1177,15 @@ status_t s1ap_build_mme_configuration_transfer( S1AP_MMEConfigurationTransferIEs_t *ie = NULL; S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer = NULL; - d_assert(s1apbuf, return CORE_ERROR,); - d_assert(son_configuration_transfer, return CORE_ERROR,); + ogs_assert(s1apbuf); + ogs_assert(son_configuration_transfer); - d_trace(3, "[MME] MME Configuration Transfer\n"); + ogs_debug("[MME] MME Configuration Transfer"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = @@ -1200,7 +1197,7 @@ status_t s1ap_build_mme_configuration_transfer( MMEConfigurationTransfer = &initiatingMessage->value.choice.MMEConfigurationTransfer; - ie = core_calloc(1, sizeof(S1AP_MMEConfigurationTransferIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_MMEConfigurationTransferIEs_t)); ASN_SEQUENCE_ADD(&MMEConfigurationTransfer->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SONConfigurationTransferMCT; @@ -1212,23 +1209,23 @@ status_t s1ap_build_mme_configuration_transfer( rv = s1ap_copy_ie(&asn_DEF_S1AP_SONConfigurationTransfer, son_configuration_transfer, SONConfigurationTransfer); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) +int s1ap_build_path_switch_ack(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -1241,16 +1238,16 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) enb_ue_t *enb_ue = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); enb_ue = mme_ue->enb_ue; - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); - d_trace(3, "[MME] Path switch acknowledge\n"); + ogs_debug("[MME] Path switch acknowledge"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = S1AP_ProcedureCode_id_PathSwitchRequest; @@ -1261,7 +1258,7 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) PathSwitchRequestAcknowledge = &successfulOutcome->value.choice.PathSwitchRequestAcknowledge; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1271,7 +1268,7 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1281,7 +1278,7 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SecurityContext; @@ -1291,17 +1288,17 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) SecurityContext = &ie->value.choice.SecurityContext; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); *MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id; SecurityContext->nextHopChainingCount = mme_ue->nhcc; - SecurityContext->nextHopParameter.size = SHA256_DIGEST_SIZE; + SecurityContext->nextHopParameter.size = OGS_SHA256_DIGEST_SIZE; SecurityContext->nextHopParameter.buf = - core_calloc(SecurityContext->nextHopParameter.size, - sizeof(c_uint8_t)); + ogs_calloc(SecurityContext->nextHopParameter.size, + sizeof(uint8_t)); SecurityContext->nextHopParameter.bits_unused = 0; memcpy(SecurityContext->nextHopParameter.buf, mme_ue->nh, SecurityContext->nextHopParameter.size); @@ -1309,20 +1306,20 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue) rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, - c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id, +int s1ap_build_path_switch_failure(ogs_pkbuf_t **s1apbuf, + uint32_t enb_ue_s1ap_id, uint32_t mme_ue_s1ap_id, S1AP_Cause_PR group, long cause) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL; @@ -1333,12 +1330,12 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL; S1AP_Cause_t *Cause = NULL; - d_trace(3, "[MME] Path switch failure\n"); + ogs_debug("[MME] Path switch failure"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_unsuccessfulOutcome; pdu.choice.unsuccessfulOutcome = - core_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t)); unsuccessfulOutcome = pdu.choice.unsuccessfulOutcome; unsuccessfulOutcome->procedureCode = @@ -1350,7 +1347,7 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, PathSwitchRequestFailure = &unsuccessfulOutcome->value.choice.PathSwitchRequestFailure; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequestFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1360,7 +1357,7 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequestFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1370,7 +1367,7 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequestFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -1379,9 +1376,9 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, Cause = &ie->value.choice.Cause; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue_s1ap_id, mme_ue_s1ap_id); - d_trace(5, " Group[%d] Cause[%d]\n", group, cause); + ogs_debug(" Group[%d] Cause[%d]", group, (int)cause); *MME_UE_S1AP_ID = mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue_s1ap_id; @@ -1391,18 +1388,18 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) +int s1ap_build_handover_command(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -1420,15 +1417,15 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - d_assert(source_ue, return CORE_ERROR, "Null param"); + ogs_assert(source_ue); mme_ue = source_ue->mme_ue; - d_trace(3, "[MME] Handover command\n"); + ogs_debug("[MME] Handover command"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = @@ -1438,9 +1435,9 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) S1AP_SuccessfulOutcome__value_PR_HandoverCommand; HandoverCommand = &successfulOutcome->value.choice.HandoverCommand; - d_assert(HandoverCommand, return CORE_ERROR,); + ogs_assert(HandoverCommand); - ie = core_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); ASN_SEQUENCE_ADD(&HandoverCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1449,7 +1446,7 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); ASN_SEQUENCE_ADD(&HandoverCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1458,7 +1455,7 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); ASN_SEQUENCE_ADD(&HandoverCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_HandoverType; @@ -1471,7 +1468,7 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) *ENB_UE_S1AP_ID = source_ue->enb_ue_s1ap_id; *HandoverType = source_ue->handover_type; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); sess = mme_sess_first(mme_ue); @@ -1489,8 +1486,8 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) if (E_RABSubjecttoDataForwardingList == NULL) { - ie = core_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); - d_assert(ie, return CORE_ERROR,); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); + ogs_assert(ie); ASN_SEQUENCE_ADD(&HandoverCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABSubjecttoDataForwardingList; @@ -1501,11 +1498,11 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) E_RABSubjecttoDataForwardingList = &ie->value.choice.E_RABSubjecttoDataForwardingList; } - d_assert(E_RABSubjecttoDataForwardingList, return CORE_ERROR,); + ogs_assert(E_RABSubjecttoDataForwardingList); - item = core_calloc( + item = ogs_calloc( 1, sizeof(S1AP_E_RABDataForwardingItemIEs_t)); - d_assert(item, return CORE_ERROR,); + ogs_assert(item); ASN_SEQUENCE_ADD(&E_RABSubjecttoDataForwardingList->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABDataForwardingItem; @@ -1514,43 +1511,43 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) S1AP_E_RABDataForwardingItemIEs__value_PR_E_RABDataForwardingItem; e_rab = &item->value.choice.E_RABDataForwardingItem; - d_assert(e_rab, return CORE_ERROR,); + ogs_assert(e_rab); e_rab->e_RAB_ID = bearer->ebi; } if (MME_HAVE_SGW_DL_INDIRECT_TUNNEL(bearer)) { - d_assert(e_rab, return CORE_ERROR,); + ogs_assert(e_rab); e_rab->dL_transportLayerAddress = (S1AP_TransportLayerAddress_t *) - core_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); + ogs_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); rv = s1ap_ip_to_BIT_STRING( &bearer->sgw_dl_ip, e_rab->dL_transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); e_rab->dL_gTP_TEID = (S1AP_GTP_TEID_t *) - core_calloc(1, sizeof(S1AP_GTP_TEID_t)); + ogs_calloc(1, sizeof(S1AP_GTP_TEID_t)); s1ap_uint32_to_OCTET_STRING( bearer->sgw_dl_teid, e_rab->dL_gTP_TEID); - d_trace(5, " SGW-DL-TEID[%d]\n", bearer->sgw_dl_teid); + ogs_debug(" SGW-DL-TEID[%d]", bearer->sgw_dl_teid); } if (MME_HAVE_SGW_UL_INDIRECT_TUNNEL(bearer)) { - d_assert(e_rab, return CORE_ERROR,); + ogs_assert(e_rab); e_rab->uL_TransportLayerAddress = (S1AP_TransportLayerAddress_t *) - core_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); + ogs_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); rv = s1ap_ip_to_BIT_STRING( &bearer->sgw_ul_ip, e_rab->uL_TransportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); e_rab->uL_GTP_TEID = (S1AP_GTP_TEID_t *) - core_calloc(1, sizeof(S1AP_GTP_TEID_t)); + ogs_calloc(1, sizeof(S1AP_GTP_TEID_t)); s1ap_uint32_to_OCTET_STRING( bearer->sgw_ul_teid, e_rab->uL_GTP_TEID); - d_trace(5, " SGW-UL-TEID[%d]\n", bearer->sgw_dl_teid); + ogs_debug(" SGW-UL-TEID[%d]", bearer->sgw_dl_teid); } bearer = mme_bearer_next(bearer); @@ -1558,7 +1555,7 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) sess = mme_sess_next(sess); } - ie = core_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCommandIEs_t)); ASN_SEQUENCE_ADD(&HandoverCommand->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Target_ToSource_TransparentContainer; @@ -1575,19 +1572,19 @@ status_t s1ap_build_handover_command(pkbuf_t **s1apbuf, enb_ue_t *source_ue) rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_handover_preparation_failure( - pkbuf_t **s1apbuf, enb_ue_t *source_ue, S1AP_Cause_t *cause) +int s1ap_build_handover_preparation_failure( + ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue, S1AP_Cause_t *cause) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL; @@ -1598,16 +1595,16 @@ status_t s1ap_build_handover_preparation_failure( S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL; S1AP_Cause_t *Cause = NULL; - d_assert(s1apbuf, return CORE_ERROR,); - d_assert(source_ue, return CORE_ERROR,); - d_assert(cause, return CORE_ERROR,); + ogs_assert(s1apbuf); + ogs_assert(source_ue); + ogs_assert(cause); - d_trace(3, "[MME] Handover preparation failure\n"); + ogs_debug("[MME] Handover preparation failure"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_unsuccessfulOutcome; pdu.choice.unsuccessfulOutcome = - core_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t)); unsuccessfulOutcome = pdu.choice.unsuccessfulOutcome; unsuccessfulOutcome->procedureCode = @@ -1619,7 +1616,7 @@ status_t s1ap_build_handover_preparation_failure( HandoverPreparationFailure = &unsuccessfulOutcome->value.choice.HandoverPreparationFailure; - ie = core_calloc(1, sizeof(S1AP_HandoverPreparationFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverPreparationFailureIEs_t)); ASN_SEQUENCE_ADD(&HandoverPreparationFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1629,7 +1626,7 @@ status_t s1ap_build_handover_preparation_failure( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverPreparationFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverPreparationFailureIEs_t)); ASN_SEQUENCE_ADD(&HandoverPreparationFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1639,7 +1636,7 @@ status_t s1ap_build_handover_preparation_failure( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverPreparationFailureIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverPreparationFailureIEs_t)); ASN_SEQUENCE_ADD(&HandoverPreparationFailure->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -1648,10 +1645,10 @@ status_t s1ap_build_handover_preparation_failure( Cause = &ie->value.choice.Cause; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Group[%d] Cause[%d]\n", - cause->present, cause->choice.radioNetwork); + ogs_debug(" Group[%d] Cause[%d]", + cause->present, (int)cause->choice.radioNetwork); *MME_UE_S1AP_ID = source_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = source_ue->enb_ue_s1ap_id; @@ -1661,17 +1658,17 @@ status_t s1ap_build_handover_preparation_failure( rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_handover_request( - pkbuf_t **s1apbuf, mme_ue_t *mme_ue, enb_ue_t *target_ue, +int s1ap_build_handover_request( + ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue, enb_ue_t *target_ue, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_HandoverType_t *handovertype, @@ -1679,7 +1676,7 @@ status_t s1ap_build_handover_request( S1AP_Source_ToTarget_TransparentContainer_t *source_totarget_transparentContainer) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1700,21 +1697,21 @@ status_t s1ap_build_handover_request( mme_bearer_t *bearer = NULL; s6a_subscription_data_t *subscription_data = NULL; - d_assert(handovertype, return CORE_ERROR,); - d_assert(cause, return CORE_ERROR,); - d_assert(source_totarget_transparentContainer, return CORE_ERROR,); + ogs_assert(handovertype); + ogs_assert(cause); + ogs_assert(source_totarget_transparentContainer); - d_assert(target_ue, return CORE_ERROR, "Null param"); - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(target_ue); + ogs_assert(mme_ue); subscription_data = &mme_ue->subscription_data; - d_assert(subscription_data, return CORE_ERROR, "Null param"); + ogs_assert(subscription_data); - d_trace(3, "[MME] Handover request\n"); + ogs_debug("[MME] Handover request"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = @@ -1725,7 +1722,7 @@ status_t s1ap_build_handover_request( HandoverRequest = &initiatingMessage->value.choice.HandoverRequest; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1734,7 +1731,7 @@ status_t s1ap_build_handover_request( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_HandoverType; @@ -1743,7 +1740,7 @@ status_t s1ap_build_handover_request( HandoverType = &ie->value.choice.HandoverType; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -1752,7 +1749,7 @@ status_t s1ap_build_handover_request( Cause = &ie->value.choice.Cause; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate; @@ -1762,7 +1759,7 @@ status_t s1ap_build_handover_request( UEAggregateMaximumBitrate = &ie->value.choice.UEAggregateMaximumBitrate; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeSetupListHOReq; @@ -1772,7 +1769,7 @@ status_t s1ap_build_handover_request( E_RABToBeSetupListHOReq = &ie->value.choice.E_RABToBeSetupListHOReq; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Source_ToTarget_TransparentContainer; @@ -1783,7 +1780,7 @@ status_t s1ap_build_handover_request( Source_ToTarget_TransparentContainer = &ie->value.choice.Source_ToTarget_TransparentContainer; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UESecurityCapabilities; @@ -1793,7 +1790,7 @@ status_t s1ap_build_handover_request( UESecurityCapabilities = &ie->value.choice.UESecurityCapabilities; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SecurityContext; @@ -1825,7 +1822,7 @@ status_t s1ap_build_handover_request( S1AP_E_RABToBeSetupItemHOReq_t *e_rab = NULL; S1AP_GBR_QosInformation_t *gbrQosInformation = NULL; - item = core_calloc(1, sizeof(S1AP_E_RABToBeSetupItemHOReqIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABToBeSetupItemHOReqIEs_t)); ASN_SEQUENCE_ADD(&E_RABToBeSetupListHOReq->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABToBeSetupItemHOReq; @@ -1860,7 +1857,7 @@ status_t s1ap_build_handover_request( bearer->qos.gbr.uplink = MAX_BIT_RATE; gbrQosInformation = - core_calloc(1, sizeof(struct S1AP_GBR_QosInformation)); + ogs_calloc(1, sizeof(struct S1AP_GBR_QosInformation)); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, bearer->qos.mbr.downlink); asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, @@ -1875,9 +1872,9 @@ status_t s1ap_build_handover_request( rv = s1ap_ip_to_BIT_STRING( &bearer->sgw_s1u_ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(bearer->sgw_s1u_teid, &e_rab->gTP_TEID); - d_trace(5, " SGW-S1U-TEID[%d]\n", bearer->sgw_s1u_teid); + ogs_debug(" SGW-S1U-TEID[%d]", bearer->sgw_s1u_teid); bearer = mme_bearer_next(bearer); } @@ -1891,25 +1888,25 @@ status_t s1ap_build_handover_request( UESecurityCapabilities->encryptionAlgorithms.size = 2; UESecurityCapabilities->encryptionAlgorithms.buf = - core_calloc(UESecurityCapabilities->encryptionAlgorithms.size, - sizeof(c_uint8_t)); + ogs_calloc(UESecurityCapabilities->encryptionAlgorithms.size, + sizeof(uint8_t)); UESecurityCapabilities->encryptionAlgorithms.bits_unused = 0; UESecurityCapabilities->encryptionAlgorithms.buf[0] = (mme_ue->ue_network_capability.eea << 1); UESecurityCapabilities->integrityProtectionAlgorithms.size = 2; UESecurityCapabilities->integrityProtectionAlgorithms.buf = - core_calloc(UESecurityCapabilities-> - integrityProtectionAlgorithms.size, sizeof(c_uint8_t)); + ogs_calloc(UESecurityCapabilities-> + integrityProtectionAlgorithms.size, sizeof(uint8_t)); UESecurityCapabilities->integrityProtectionAlgorithms.bits_unused = 0; UESecurityCapabilities->integrityProtectionAlgorithms.buf[0] = (mme_ue->ue_network_capability.eia << 1); SecurityContext->nextHopChainingCount = mme_ue->nhcc; - SecurityContext->nextHopParameter.size = SHA256_DIGEST_SIZE; + SecurityContext->nextHopParameter.size = OGS_SHA256_DIGEST_SIZE; SecurityContext->nextHopParameter.buf = - core_calloc(SecurityContext->nextHopParameter.size, - sizeof(c_uint8_t)); + ogs_calloc(SecurityContext->nextHopParameter.size, + sizeof(uint8_t)); SecurityContext->nextHopParameter.bits_unused = 0; memcpy(SecurityContext->nextHopParameter.buf, mme_ue->nh, SecurityContext->nextHopParameter.size); @@ -1917,18 +1914,18 @@ status_t s1ap_build_handover_request( rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_handover_cancel_ack(pkbuf_t **s1apbuf, enb_ue_t *source_ue) +int s1ap_build_handover_cancel_ack(ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -1938,14 +1935,14 @@ status_t s1ap_build_handover_cancel_ack(pkbuf_t **s1apbuf, enb_ue_t *source_ue) S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL; S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL; - d_assert(source_ue, return CORE_ERROR, "Null param"); + ogs_assert(source_ue); - d_trace(3, "[MME] Handover cancel acknowledge\n"); + ogs_debug("[MME] Handover cancel acknowledge"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = S1AP_ProcedureCode_id_HandoverCancel; @@ -1956,7 +1953,7 @@ status_t s1ap_build_handover_cancel_ack(pkbuf_t **s1apbuf, enb_ue_t *source_ue) HandoverCancelAcknowledge = &successfulOutcome->value.choice.HandoverCancelAcknowledge; - ie = core_calloc(1, sizeof(S1AP_HandoverCancelAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCancelAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&HandoverCancelAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1966,7 +1963,7 @@ status_t s1ap_build_handover_cancel_ack(pkbuf_t **s1apbuf, enb_ue_t *source_ue) MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverCancelAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverCancelAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&HandoverCancelAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1979,27 +1976,27 @@ status_t s1ap_build_handover_cancel_ack(pkbuf_t **s1apbuf, enb_ue_t *source_ue) *MME_UE_S1AP_ID = source_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = source_ue->enb_ue_s1ap_id; - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, +int s1ap_build_mme_status_transfer(ogs_pkbuf_t **s1apbuf, enb_ue_t *target_ue, S1AP_ENB_StatusTransfer_TransparentContainer_t *enb_statustransfer_transparentContainer) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -2011,15 +2008,15 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, S1AP_ENB_StatusTransfer_TransparentContainer_t *ENB_StatusTransfer_TransparentContainer = NULL; - d_assert(target_ue, return CORE_ERROR,); - d_assert(enb_statustransfer_transparentContainer, return CORE_ERROR,); + ogs_assert(target_ue); + ogs_assert(enb_statustransfer_transparentContainer); - d_trace(3, "[MME] MME status transfer\n"); + ogs_debug("[MME] MME status transfer"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_MMEStatusTransfer; @@ -2029,7 +2026,7 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, MMEStatusTransfer = &initiatingMessage->value.choice.MMEStatusTransfer; - ie = core_calloc(1, sizeof(S1AP_MMEStatusTransferIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_MMEStatusTransferIEs_t)); ASN_SEQUENCE_ADD(&MMEStatusTransfer->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -2038,7 +2035,7 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_MMEStatusTransferIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_MMEStatusTransferIEs_t)); ASN_SEQUENCE_ADD(&MMEStatusTransfer->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -2047,7 +2044,7 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_MMEStatusTransferIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_MMEStatusTransferIEs_t)); ASN_SEQUENCE_ADD(&MMEStatusTransfer->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_StatusTransfer_TransparentContainer; @@ -2061,34 +2058,34 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, *MME_UE_S1AP_ID = target_ue->mme_ue_s1ap_id; *ENB_UE_S1AP_ID = target_ue->enb_ue_s1ap_id; - d_trace(5, " Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id); rv = s1ap_copy_ie( &asn_DEF_S1AP_ENB_StatusTransfer_TransparentContainer, enb_statustransfer_transparentContainer, ENB_StatusTransfer_TransparentContainer); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_error_indication( - pkbuf_t **s1apbuf, +int s1ap_build_error_indication( + ogs_pkbuf_t **s1apbuf, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, S1AP_Cause_PR group, long cause) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -2099,12 +2096,12 @@ status_t s1ap_build_error_indication( S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL; S1AP_Cause_t *Cause = NULL; - d_trace(3, "[MME] Error Indication\n"); + ogs_debug("[MME] Error Indication"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_ErrorIndication; @@ -2116,7 +2113,7 @@ status_t s1ap_build_error_indication( if (mme_ue_s1ap_id) { - ie = core_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t)); ASN_SEQUENCE_ADD(&ErrorIndication->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -2126,12 +2123,12 @@ status_t s1ap_build_error_indication( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; *MME_UE_S1AP_ID = *mme_ue_s1ap_id; - d_trace(5, " MME_UE_S1AP_ID[%d]\n", mme_ue_s1ap_id); + ogs_debug(" MME_UE_S1AP_ID[%d]", (int)*mme_ue_s1ap_id); } if (enb_ue_s1ap_id) { - ie = core_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t)); ASN_SEQUENCE_ADD(&ErrorIndication->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -2141,10 +2138,10 @@ status_t s1ap_build_error_indication( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; *ENB_UE_S1AP_ID = *enb_ue_s1ap_id; - d_trace(5, " ENB_UE_S1AP_ID[%d]\n", enb_ue_s1ap_id); + ogs_debug(" ENB_UE_S1AP_ID[%d]", (int)*enb_ue_s1ap_id); } - ie = core_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_ErrorIndicationIEs_t)); ASN_SEQUENCE_ADD(&ErrorIndication->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -2156,27 +2153,27 @@ status_t s1ap_build_error_indication( Cause->present = group; Cause->choice.radioNetwork = cause; - d_trace(5, " Group[%d] Cause[%d]\n", - Cause->present, Cause->choice.radioNetwork); + ogs_debug(" Group[%d] Cause[%d]", + Cause->present, (int)Cause->choice.radioNetwork); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_s1_reset( - pkbuf_t **s1apbuf, +int s1ap_build_s1_reset( + ogs_pkbuf_t **s1apbuf, S1AP_Cause_PR group, long cause, S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -2186,12 +2183,12 @@ status_t s1ap_build_s1_reset( S1AP_Cause_t *Cause = NULL; S1AP_ResetType_t *ResetType = NULL; - d_trace(3, "[MME] Reset\n"); + ogs_debug("[MME] Reset"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_Reset; @@ -2201,7 +2198,7 @@ status_t s1ap_build_s1_reset( Reset = &initiatingMessage->value.choice.Reset; - ie = core_calloc(1, sizeof(S1AP_ResetIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_ResetIEs_t)); ASN_SEQUENCE_ADD(&Reset->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -2210,7 +2207,7 @@ status_t s1ap_build_s1_reset( Cause = &ie->value.choice.Cause; - ie = core_calloc(1, sizeof(S1AP_ResetIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_ResetIEs_t)); ASN_SEQUENCE_ADD(&Reset->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_ResetType; @@ -2222,8 +2219,8 @@ status_t s1ap_build_s1_reset( Cause->present = group; Cause->choice.radioNetwork = cause; - d_trace(5, " Group[%d] Cause[%d] partOfS1_Interface[%p]\n", - Cause->present, Cause->choice.radioNetwork, partOfS1_Interface); + ogs_debug(" Group[%d] Cause[%d] partOfS1_Interface[%p]", + Cause->present, (int)Cause->choice.radioNetwork, partOfS1_Interface); if (partOfS1_Interface) { @@ -2239,17 +2236,17 @@ status_t s1ap_build_s1_reset( rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_s1_reset_partial( - pkbuf_t **s1apbuf, +int s1ap_build_s1_reset_partial( + ogs_pkbuf_t **s1apbuf, S1AP_Cause_PR group, long cause, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id) @@ -2258,11 +2255,11 @@ status_t s1ap_build_s1_reset_partial( S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie2 = NULL; S1AP_UE_associatedLogicalS1_ConnectionItem_t *item = NULL; - partOfS1_Interface = core_calloc(1, + partOfS1_Interface = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionListRes_t)); - d_assert(partOfS1_Interface, return CORE_ERROR,); + ogs_assert(partOfS1_Interface); - ie2 = core_calloc(1, + ie2 = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t)); ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie2); @@ -2277,11 +2274,11 @@ status_t s1ap_build_s1_reset_partial( return s1ap_build_s1_reset(s1apbuf, group, cause, partOfS1_Interface); } -status_t s1ap_build_s1_reset_ack( - pkbuf_t **s1apbuf, +int s1ap_build_s1_reset_ack( + ogs_pkbuf_t **s1apbuf, S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -2289,12 +2286,12 @@ status_t s1ap_build_s1_reset_ack( S1AP_ResetAcknowledgeIEs_t *ie = NULL; - d_trace(3, "[MME] Reset acknowledge\n"); + ogs_debug("[MME] Reset acknowledge"); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = S1AP_ProcedureCode_id_Reset; @@ -2309,7 +2306,7 @@ status_t s1ap_build_s1_reset_ack( int i = 0; S1AP_UE_associatedLogicalS1_ConnectionListResAck_t *list = NULL; - ie = core_calloc(1, sizeof(S1AP_ResetAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_ResetAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&ResetAcknowledge->protocolIEs, ie); ie->id = @@ -2329,20 +2326,20 @@ status_t s1ap_build_s1_reset_ack( ie1 = (S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *) partOfS1_Interface->list.array[i]; - d_assert(ie1, return CORE_ERROR,); + ogs_assert(ie1); item1 = &ie1->value.choice.UE_associatedLogicalS1_ConnectionItem; - d_assert(item1, return CORE_ERROR,); + ogs_assert(item1); if (item1->mME_UE_S1AP_ID == NULL && item1->eNB_UE_S1AP_ID == NULL) { - d_warn("No MME_UE_S1AP_ID & ENB_UE_S1AP_ID"); + ogs_warn("No MME_UE_S1AP_ID & ENB_UE_S1AP_ID"); continue; } - ie2 = core_calloc(1, + ie2 = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemResAck_t)); - d_assert(ie2, return CORE_ERROR,); + ogs_assert(ie2); ASN_SEQUENCE_ADD(&list->list, ie2); ie2->id = @@ -2351,46 +2348,46 @@ status_t s1ap_build_s1_reset_ack( ie2->value.present = S1AP_UE_associatedLogicalS1_ConnectionItemResAck__value_PR_UE_associatedLogicalS1_ConnectionItem; item2 = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem; - d_assert(item2, return CORE_ERROR,); + ogs_assert(item2); if (item1->mME_UE_S1AP_ID) { - item2->mME_UE_S1AP_ID = core_calloc(1, + item2->mME_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); - d_assert(item2->mME_UE_S1AP_ID, return CORE_ERROR,); + ogs_assert(item2->mME_UE_S1AP_ID); *item2->mME_UE_S1AP_ID = *item1->mME_UE_S1AP_ID; } if (item1->eNB_UE_S1AP_ID) { - item2->eNB_UE_S1AP_ID = core_calloc(1, + item2->eNB_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t)); - d_assert(item2->eNB_UE_S1AP_ID, return CORE_ERROR,); + ogs_assert(item2->eNB_UE_S1AP_ID); *item2->eNB_UE_S1AP_ID = *item1->eNB_UE_S1AP_ID; } - d_trace(5, " MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]\n", - item2->mME_UE_S1AP_ID ? *item2->mME_UE_S1AP_ID : -1, - item2->eNB_UE_S1AP_ID ? *item2->eNB_UE_S1AP_ID : -1); + ogs_debug(" MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]", + item2->mME_UE_S1AP_ID ? (int)*item2->mME_UE_S1AP_ID : -1, + item2->eNB_UE_S1AP_ID ? (int)*item2->eNB_UE_S1AP_ID : -1); } } rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_write_replace_warning_request( - pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws) +int s1ap_build_write_replace_warning_request( + ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -2404,14 +2401,14 @@ status_t s1ap_build_write_replace_warning_request( S1AP_DataCodingScheme_t *DataCodingScheme = NULL; S1AP_WarningMessageContents_t *WarningMessageContents = NULL; - d_trace(3, "[MME] Write-replace warning request\n"); + ogs_debug("[MME] Write-replace warning request"); - d_assert(sbc_pws, return CORE_ERROR,); + ogs_assert(sbc_pws); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_WriteReplaceWarning; @@ -2421,7 +2418,7 @@ status_t s1ap_build_write_replace_warning_request( WriteReplaceWarningRequest = &initiatingMessage->value.choice.WriteReplaceWarningRequest; - ie = core_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); ASN_SEQUENCE_ADD(&WriteReplaceWarningRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MessageIdentifier; @@ -2432,12 +2429,12 @@ status_t s1ap_build_write_replace_warning_request( MessageIdentifier->size = (16 / 8); MessageIdentifier->buf = - core_calloc(MessageIdentifier->size, sizeof(c_uint8_t)); + ogs_calloc(MessageIdentifier->size, sizeof(uint8_t)); MessageIdentifier->bits_unused = 0; MessageIdentifier->buf[0] = (sbc_pws->message_id >> 8) & 0xFF; MessageIdentifier->buf[1] = sbc_pws->message_id & 0xFF; - ie = core_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); ASN_SEQUENCE_ADD(&WriteReplaceWarningRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SerialNumber; @@ -2448,14 +2445,14 @@ status_t s1ap_build_write_replace_warning_request( SerialNumber->size = (16 / 8); SerialNumber->buf = - core_calloc(SerialNumber->size, sizeof(c_uint8_t)); + ogs_calloc(SerialNumber->size, sizeof(uint8_t)); SerialNumber->bits_unused = 0; SerialNumber->buf[0] = (sbc_pws->serial_number >> 8) & 0xFF; SerialNumber->buf[1] = sbc_pws->serial_number & 0xFF; /* TODO: optional Warning Area List */ - ie = core_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); ASN_SEQUENCE_ADD(&WriteReplaceWarningRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_RepetitionPeriod; @@ -2468,7 +2465,7 @@ status_t s1ap_build_write_replace_warning_request( /* TODO: optional Extended Repetition Period */ - ie = core_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); ASN_SEQUENCE_ADD(&WriteReplaceWarningRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_NumberofBroadcastRequest; @@ -2483,7 +2480,7 @@ status_t s1ap_build_write_replace_warning_request( /* TODO: optional Warning Security Information */ - ie = core_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); ASN_SEQUENCE_ADD(&WriteReplaceWarningRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_DataCodingScheme; @@ -2494,11 +2491,11 @@ status_t s1ap_build_write_replace_warning_request( DataCodingScheme->size = (8 / 8); DataCodingScheme->buf = - core_calloc(DataCodingScheme->size, sizeof(c_uint8_t)); + ogs_calloc(DataCodingScheme->size, sizeof(uint8_t)); DataCodingScheme->bits_unused = 0; DataCodingScheme->buf[0] = sbc_pws->data_coding_scheme & 0xFF; - ie = core_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_WriteReplaceWarningRequestIEs_t)); ASN_SEQUENCE_ADD(&WriteReplaceWarningRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_WarningMessageContents; @@ -2509,31 +2506,33 @@ status_t s1ap_build_write_replace_warning_request( WarningMessageContents->size = sbc_pws->message_length;; WarningMessageContents->buf = - core_calloc(WarningMessageContents->size, sizeof(c_uint8_t)); + ogs_calloc(WarningMessageContents->size, sizeof(uint8_t)); memcpy(WarningMessageContents->buf, sbc_pws->message_contents, WarningMessageContents->size); /* TODO: optional Concurrent Warning Message Indicator */ - d_trace(5, " Message[%02x,%02x] Serial[%02x,%02x] Repetition[%d] NumBroadcast[%d]\n", - MessageIdentifier->buf[0], MessageIdentifier->buf[1], SerialNumber->buf[0], - SerialNumber->buf[1], *RepetitionPeriod, *NumberofBroadcastRequest); + ogs_debug(" Message[%02x,%02x] Serial[%02x,%02x] " + "Repetition[%d] NumBroadcast[%d]", + MessageIdentifier->buf[0], MessageIdentifier->buf[1], + SerialNumber->buf[0], SerialNumber->buf[1], + (int)*RepetitionPeriod, (int)*NumberofBroadcastRequest); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t s1ap_build_kill_request( - pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws) +int s1ap_build_kill_request( + ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -2543,14 +2542,14 @@ status_t s1ap_build_kill_request( S1AP_MessageIdentifier_t *MessageIdentifier = NULL; S1AP_SerialNumber_t *SerialNumber = NULL; - d_trace(3, "[MME] Kill request\n"); + ogs_debug("[MME] Kill request"); - d_assert(sbc_pws, return CORE_ERROR,); + ogs_assert(sbc_pws); memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_Kill; @@ -2560,7 +2559,7 @@ status_t s1ap_build_kill_request( KillRequest = &initiatingMessage->value.choice.KillRequest; - ie = core_calloc(1, sizeof(S1AP_KillRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_KillRequestIEs_t)); ASN_SEQUENCE_ADD(&KillRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MessageIdentifier; @@ -2571,12 +2570,12 @@ status_t s1ap_build_kill_request( MessageIdentifier->size = (16 / 8); MessageIdentifier->buf = - core_calloc(MessageIdentifier->size, sizeof(c_uint8_t)); + ogs_calloc(MessageIdentifier->size, sizeof(uint8_t)); MessageIdentifier->bits_unused = 0; MessageIdentifier->buf[0] = (sbc_pws->message_id >> 8) & 0xFF; MessageIdentifier->buf[1] = sbc_pws->message_id & 0xFF; - ie = core_calloc(1, sizeof(S1AP_KillRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_KillRequestIEs_t)); ASN_SEQUENCE_ADD(&KillRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SerialNumber; @@ -2587,25 +2586,25 @@ status_t s1ap_build_kill_request( SerialNumber->size = (16 / 8); SerialNumber->buf = - core_calloc(SerialNumber->size, sizeof(c_uint8_t)); + ogs_calloc(SerialNumber->size, sizeof(uint8_t)); SerialNumber->bits_unused = 0; SerialNumber->buf[0] = (sbc_pws->serial_number >> 8) & 0xFF; SerialNumber->buf[1] = sbc_pws->serial_number & 0xFF; /* TODO: optional Warning Area List */ - d_trace(5, " Message[%02x,%02x] Serial[%02x,%02x]\n", + ogs_debug(" Message[%02x,%02x] Serial[%02x,%02x]", MessageIdentifier->buf[0], MessageIdentifier->buf[1], SerialNumber->buf[0], SerialNumber->buf[1]); rv = s1ap_encode_pdu(s1apbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/s1ap_build.h b/src/mme/s1ap_build.h index e9ebab83c..64b5ed2dd 100644 --- a/src/mme/s1ap_build.h +++ b/src/mme/s1ap_build.h @@ -1,7 +1,7 @@ #ifndef __S1AP_BUILD_H__ #define __S1AP_BUILD_H__ -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #include "mme_context.h" #include "sbc_message.h" @@ -10,40 +10,40 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) s1ap_build_setup_rsp(pkbuf_t **pkbuf); -CORE_DECLARE(status_t) s1ap_build_setup_failure( - pkbuf_t **pkbuf, S1AP_Cause_PR group, long cause, long time_to_wait); -CORE_DECLARE(status_t) s1ap_build_downlink_nas_transport( - pkbuf_t **s1apbuf, enb_ue_t *enb_ue, pkbuf_t *emmbuf); -CORE_DECLARE(status_t) s1ap_build_initial_context_setup_request( - pkbuf_t **s1apbuf, mme_ue_t *mme_ue, pkbuf_t *emmbuf); -CORE_DECLARE(status_t) s1ap_build_e_rab_setup_request( - pkbuf_t **s1apbuf, mme_bearer_t *bearer, pkbuf_t *esmbuf); -CORE_DECLARE(status_t) s1ap_build_e_rab_modify_request( - pkbuf_t **s1apbuf, mme_bearer_t *bearer, pkbuf_t *esmbuf); -CORE_DECLARE(status_t) s1ap_build_e_rab_release_command(pkbuf_t **s1apbuf, - mme_bearer_t *bearer, pkbuf_t *esmbuf, S1AP_Cause_PR group, long cause); -CORE_DECLARE(status_t) s1ap_build_ue_context_release_command( - pkbuf_t **s1apbuf, enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause); -CORE_DECLARE(status_t) s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue); +int s1ap_build_setup_rsp(ogs_pkbuf_t **pkbuf); +int s1ap_build_setup_failure( + ogs_pkbuf_t **pkbuf, S1AP_Cause_PR group, long cause, long time_to_wait); +int s1ap_build_downlink_nas_transport( + ogs_pkbuf_t **s1apbuf, enb_ue_t *enb_ue, ogs_pkbuf_t *emmbuf); +int s1ap_build_initial_context_setup_request( + ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue, ogs_pkbuf_t *emmbuf); +int s1ap_build_e_rab_setup_request( + ogs_pkbuf_t **s1apbuf, mme_bearer_t *bearer, ogs_pkbuf_t *esmbuf); +int s1ap_build_e_rab_modify_request( + ogs_pkbuf_t **s1apbuf, mme_bearer_t *bearer, ogs_pkbuf_t *esmbuf); +int s1ap_build_e_rab_release_command(ogs_pkbuf_t **s1apbuf, + mme_bearer_t *bearer, ogs_pkbuf_t *esmbuf, S1AP_Cause_PR group, long cause); +int s1ap_build_ue_context_release_command( + ogs_pkbuf_t **s1apbuf, enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause); +int s1ap_build_paging(ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue); -CORE_DECLARE(status_t) s1ap_build_mme_configuration_transfer( - pkbuf_t **s1apbuf, +int s1ap_build_mme_configuration_transfer( + ogs_pkbuf_t **s1apbuf, S1AP_SONConfigurationTransfer_t *son_configuration_transfer); -CORE_DECLARE(status_t) s1ap_build_path_switch_ack( - pkbuf_t **s1apbuf, mme_ue_t *mme_ue); -CORE_DECLARE(status_t) s1ap_build_path_switch_failure(pkbuf_t **s1apbuf, - c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id, +int s1ap_build_path_switch_ack( + ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue); +int s1ap_build_path_switch_failure(ogs_pkbuf_t **s1apbuf, + uint32_t enb_ue_s1ap_id, uint32_t mme_ue_s1ap_id, S1AP_Cause_PR group, long cause); -CORE_DECLARE(status_t) s1ap_build_handover_command( - pkbuf_t **s1apbuf, enb_ue_t *source_ue); -CORE_DECLARE(status_t) s1ap_build_handover_preparation_failure( - pkbuf_t **s1apbuf, enb_ue_t *source_ue, S1AP_Cause_t *cause); +int s1ap_build_handover_command( + ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue); +int s1ap_build_handover_preparation_failure( + ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue, S1AP_Cause_t *cause); -CORE_DECLARE(status_t) s1ap_build_handover_request( - pkbuf_t **s1apbuf, mme_ue_t *mme_ue, enb_ue_t *target_ue, +int s1ap_build_handover_request( + ogs_pkbuf_t **s1apbuf, mme_ue_t *mme_ue, enb_ue_t *target_ue, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_HandoverType_t *handovertype, @@ -51,40 +51,40 @@ CORE_DECLARE(status_t) s1ap_build_handover_request( S1AP_Source_ToTarget_TransparentContainer_t *source_totarget_transparentContainer); -CORE_DECLARE(status_t) s1ap_build_handover_cancel_ack( - pkbuf_t **s1apbuf, enb_ue_t *source_ue); +int s1ap_build_handover_cancel_ack( + ogs_pkbuf_t **s1apbuf, enb_ue_t *source_ue); -CORE_DECLARE(status_t) s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf, +int s1ap_build_mme_status_transfer(ogs_pkbuf_t **s1apbuf, enb_ue_t *target_ue, S1AP_ENB_StatusTransfer_TransparentContainer_t *enb_statustransfer_transparentContainer); -CORE_DECLARE(status_t) s1ap_build_error_indication( - pkbuf_t **s1apbuf, +int s1ap_build_error_indication( + ogs_pkbuf_t **s1apbuf, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, S1AP_Cause_PR group, long cause); -CORE_DECLARE(status_t) s1ap_build_s1_reset( - pkbuf_t **s1apbuf, +int s1ap_build_s1_reset( + ogs_pkbuf_t **s1apbuf, S1AP_Cause_PR group, long cause, S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface); -CORE_DECLARE(status_t) s1ap_build_s1_reset_partial( - pkbuf_t **s1apbuf, +int s1ap_build_s1_reset_partial( + ogs_pkbuf_t **s1apbuf, S1AP_Cause_PR group, long cause, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id); -CORE_DECLARE(status_t) s1ap_build_s1_reset_ack( - pkbuf_t **s1apbuf, +int s1ap_build_s1_reset_ack( + ogs_pkbuf_t **s1apbuf, S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface); -CORE_DECLARE(status_t) s1ap_build_write_replace_warning_request( - pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws); +int s1ap_build_write_replace_warning_request( + ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws); -CORE_DECLARE(status_t) s1ap_build_kill_request( - pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws); +int s1ap_build_kill_request( + ogs_pkbuf_t **s1apbuf, sbc_pws_data_t *sbc_pws); #ifdef __cplusplus } diff --git a/src/mme/s1ap_conv.c b/src/mme/s1ap_conv.c index 3641f10e4..860f8b8bb 100644 --- a/src/mme/s1ap_conv.c +++ b/src/mme/s1ap_conv.c @@ -1,32 +1,27 @@ -#define TRACE_MODULE _s1ap_conv - -#include "core_debug.h" -#include "core_network.h" - -#include "3gpp_types.h" +#include "base/types.h" #include "s1ap_conv.h" -void s1ap_uint8_to_OCTET_STRING(c_uint8_t uint8, OCTET_STRING_t *octet_string) +void s1ap_uint8_to_OCTET_STRING(uint8_t uint8, OCTET_STRING_t *octet_string) { octet_string->size = 1; - octet_string->buf = core_calloc(octet_string->size, sizeof(c_uint8_t)); + octet_string->buf = ogs_calloc(octet_string->size, sizeof(uint8_t)); octet_string->buf[0] = uint8; } -void s1ap_uint16_to_OCTET_STRING(c_uint16_t uint16, OCTET_STRING_t *octet_string) +void s1ap_uint16_to_OCTET_STRING(uint16_t uint16, OCTET_STRING_t *octet_string) { octet_string->size = 2; - octet_string->buf = core_calloc(octet_string->size, sizeof(c_uint8_t)); + octet_string->buf = ogs_calloc(octet_string->size, sizeof(uint8_t)); octet_string->buf[0] = uint16 >> 8; octet_string->buf[1] = uint16; } -void s1ap_uint32_to_OCTET_STRING(c_uint32_t uint32, OCTET_STRING_t *octet_string) +void s1ap_uint32_to_OCTET_STRING(uint32_t uint32, OCTET_STRING_t *octet_string) { octet_string->size = 4; - octet_string->buf = core_calloc(octet_string->size, sizeof(c_uint8_t)); + octet_string->buf = ogs_calloc(octet_string->size, sizeof(uint8_t)); octet_string->buf[0] = uint32 >> 24; octet_string->buf[1] = uint32 >> 16; @@ -38,24 +33,24 @@ void s1ap_buffer_to_OCTET_STRING( void *buf, int size, S1AP_TBCD_STRING_t *tbcd_string) { tbcd_string->size = size; - tbcd_string->buf = core_calloc(tbcd_string->size, sizeof(c_uint8_t)); + tbcd_string->buf = ogs_calloc(tbcd_string->size, sizeof(uint8_t)); memcpy(tbcd_string->buf, buf, size); } void s1ap_uint32_to_ENB_ID( - S1AP_ENB_ID_PR present, c_uint32_t enb_id, S1AP_ENB_ID_t *eNB_ID) + S1AP_ENB_ID_PR present, uint32_t enb_id, S1AP_ENB_ID_t *eNB_ID) { - d_assert(eNB_ID, return, "Null param"); + ogs_assert(eNB_ID); eNB_ID->present = present; if (present == S1AP_ENB_ID_PR_macroENB_ID) { BIT_STRING_t *bit_string = &eNB_ID->choice.macroENB_ID; - d_assert(bit_string, return, "Null param"); + ogs_assert(bit_string); bit_string->size = 3; - bit_string->buf = core_calloc(bit_string->size, sizeof(c_uint8_t)); + bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t)); bit_string->buf[0] = enb_id >> 12; bit_string->buf[1] = enb_id >> 4; @@ -66,10 +61,10 @@ void s1ap_uint32_to_ENB_ID( else if (present == S1AP_ENB_ID_PR_homeENB_ID) { BIT_STRING_t *bit_string = &eNB_ID->choice.homeENB_ID; - d_assert(bit_string, return, "Null param"); + ogs_assert(bit_string); bit_string->size = 4; - bit_string->buf = core_calloc(bit_string->size, sizeof(c_uint8_t)); + bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t)); bit_string->buf[0] = enb_id >> 20; bit_string->buf[1] = enb_id >> 12; @@ -80,42 +75,42 @@ void s1ap_uint32_to_ENB_ID( } else { - d_assert(0, return, "Invalid param"); + ogs_assert_if_reached(); } } -void s1ap_ENB_ID_to_uint32(S1AP_ENB_ID_t *eNB_ID, c_uint32_t *uint32) +void s1ap_ENB_ID_to_uint32(S1AP_ENB_ID_t *eNB_ID, uint32_t *uint32) { - d_assert(uint32, return, "Null param"); - d_assert(eNB_ID, return, "Null param"); + ogs_assert(uint32); + ogs_assert(eNB_ID); if (eNB_ID->present == S1AP_ENB_ID_PR_homeENB_ID) { - c_uint8_t *buf = eNB_ID->choice.homeENB_ID.buf; - d_assert(buf, return, "Null param"); + uint8_t *buf = eNB_ID->choice.homeENB_ID.buf; + ogs_assert(buf); *uint32 = (buf[0] << 20) + (buf[1] << 12) + (buf[2] << 4) + ((buf[3] & 0xf0) >> 4); } else if (eNB_ID->present == S1AP_ENB_ID_PR_macroENB_ID) { - c_uint8_t *buf = eNB_ID->choice.macroENB_ID.buf; - d_assert(buf, return, "Null param"); + uint8_t *buf = eNB_ID->choice.macroENB_ID.buf; + ogs_assert(buf); *uint32 = (buf[0] << 12) + (buf[1] << 4) + ((buf[2] & 0xf0) >> 4); } else { - d_assert(0, return, "Invalid param"); + ogs_assert_if_reached(); } } -status_t s1ap_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ip_t *ip) +int s1ap_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ip_t *ip) { - char buf[CORE_ADDRSTRLEN], buf2[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN], buf2[OGS_ADDRSTRLEN]; - d_assert(bit_string, return CORE_ERROR,); - d_assert(ip, return CORE_ERROR,); + ogs_assert(bit_string); + ogs_assert(ip); if (bit_string->size == IPV4V6_LEN) { @@ -123,79 +118,79 @@ status_t s1ap_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ip_t *ip) ip->ipv6 = 1; memcpy(&ip->both.addr, bit_string->buf, IPV4_LEN); memcpy(&ip->both.addr6, bit_string->buf+IPV4_LEN, IPV6_LEN); - d_trace(5, " IPv4[%s] IPv6[%s]\n", + ogs_debug(" IPv4[%s] IPv6[%s]", INET_NTOP(&ip->both.addr, buf), INET6_NTOP(&ip->both.addr6, buf2)); } else if (bit_string->size == IPV4_LEN) { ip->ipv4 = 1; memcpy(&ip->addr, bit_string->buf, IPV4_LEN); - d_trace(5, " IPv4[%s]\n", INET_NTOP(&ip->addr, buf)); + ogs_debug(" IPv4[%s]", INET_NTOP(&ip->addr, buf)); } else if (bit_string->size == IPV6_LEN) { ip->ipv6 = 1; memcpy(&ip->addr6, bit_string->buf, IPV6_LEN); - d_trace(5, " IPv6[%s]\n", INET_NTOP(&ip->addr6, buf)); + ogs_debug(" IPv6[%s]", INET_NTOP(&ip->addr6, buf)); } else - d_assert(0, return CORE_ERROR, "Invalid Length(%d)", bit_string->size); + ogs_assert_if_reached(); ip->len = bit_string->size; - return CORE_OK; + return OGS_OK; } -status_t s1ap_ip_to_BIT_STRING(ip_t *ip, BIT_STRING_t *bit_string) +int s1ap_ip_to_BIT_STRING(ip_t *ip, BIT_STRING_t *bit_string) { - char buf[CORE_ADDRSTRLEN], buf2[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN], buf2[OGS_ADDRSTRLEN]; - d_assert(ip, return CORE_ERROR,); - d_assert(bit_string, return CORE_ERROR,); + ogs_assert(ip); + ogs_assert(bit_string); if (ip->ipv4 && ip->ipv6) { bit_string->size = IPV4V6_LEN; - bit_string->buf = core_calloc(bit_string->size, sizeof(c_uint8_t)); + bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t)); memcpy(bit_string->buf, &ip->both.addr, IPV4_LEN); memcpy(bit_string->buf+IPV4_LEN, &ip->both.addr6, IPV6_LEN); - d_trace(5, " IPv4[%s] IPv6[%s]\n", + ogs_debug(" IPv4[%s] IPv6[%s]", INET_NTOP(&ip->both.addr, buf), INET6_NTOP(&ip->both.addr6, buf2)); } else if (ip->ipv4) { bit_string->size = IPV4_LEN; - bit_string->buf = core_calloc(bit_string->size, sizeof(c_uint8_t)); + bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t)); memcpy(bit_string->buf, &ip->addr, IPV4_LEN); - d_trace(5, " IPv4[%s]\n", INET_NTOP(&ip->addr, buf)); + ogs_debug(" IPv4[%s]", INET_NTOP(&ip->addr, buf)); } else if (ip->ipv6) { bit_string->size = IPV6_LEN; - bit_string->buf = core_calloc(bit_string->size, sizeof(c_uint8_t)); + bit_string->buf = ogs_calloc(bit_string->size, sizeof(uint8_t)); memcpy(bit_string->buf, &ip->addr6, IPV6_LEN); - d_trace(5, " IPv6[%s]\n", INET_NTOP(&ip->addr6, buf)); + ogs_debug(" IPv6[%s]", INET_NTOP(&ip->addr6, buf)); } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - return CORE_OK; + return OGS_OK; } -status_t s1ap_copy_ie(const asn_TYPE_descriptor_t *td, void *src, void *dst) +int s1ap_copy_ie(const asn_TYPE_descriptor_t *td, void *src, void *dst) { asn_enc_rval_t enc_ret = {0}; asn_dec_rval_t dec_ret = {0}; - c_uint8_t buffer[MAX_SDU_LEN]; + uint8_t buffer[MAX_SDU_LEN]; - d_assert(td, return CORE_ERROR,); - d_assert(src, return CORE_ERROR,); - d_assert(dst, return CORE_ERROR,); + ogs_assert(td); + ogs_assert(src); + ogs_assert(dst); enc_ret = aper_encode_to_buffer(td, NULL, src, buffer, MAX_SDU_LEN); if (enc_ret.encoded < 0) { - d_error("aper_encode_to_buffer() failed[%d]", enc_ret.encoded); - return CORE_ERROR; + ogs_error("aper_encode_to_buffer() failed[%d]", (int)enc_ret.encoded); + return OGS_ERROR; } dec_ret = aper_decode(NULL, td, (void **)&dst, @@ -203,9 +198,9 @@ status_t s1ap_copy_ie(const asn_TYPE_descriptor_t *td, void *src, void *dst) if (dec_ret.code != RC_OK) { - d_error("aper_decode() failed[%d]", dec_ret.code); - return CORE_ERROR; + ogs_error("aper_decode() failed[%d]", dec_ret.code); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } diff --git a/src/mme/s1ap_conv.h b/src/mme/s1ap_conv.h index c6de051ea..617d40d99 100644 --- a/src/mme/s1ap_conv.h +++ b/src/mme/s1ap_conv.h @@ -1,33 +1,33 @@ #ifndef __S1AP_CONV_H__ #define __S1AP_CONV_H__ -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) s1ap_uint8_to_OCTET_STRING( - c_uint8_t uint8, OCTET_STRING_t *octet_string); -CORE_DECLARE(void) s1ap_uint16_to_OCTET_STRING( - c_uint16_t uint16, OCTET_STRING_t *octet_string); -CORE_DECLARE(void) s1ap_uint32_to_OCTET_STRING( - c_uint32_t uint32, OCTET_STRING_t *octet_string); +void s1ap_uint8_to_OCTET_STRING( + uint8_t uint8, OCTET_STRING_t *octet_string); +void s1ap_uint16_to_OCTET_STRING( + uint16_t uint16, OCTET_STRING_t *octet_string); +void s1ap_uint32_to_OCTET_STRING( + uint32_t uint32, OCTET_STRING_t *octet_string); -CORE_DECLARE(void) s1ap_buffer_to_OCTET_STRING( +void s1ap_buffer_to_OCTET_STRING( void *buf, int size, S1AP_TBCD_STRING_t *tbcd_string); -CORE_DECLARE(void) s1ap_uint32_to_ENB_ID( - S1AP_ENB_ID_PR present, c_uint32_t enb_id, S1AP_ENB_ID_t *eNB_ID); -CORE_DECLARE(void) s1ap_ENB_ID_to_uint32( - S1AP_ENB_ID_t *eNB_ID, c_uint32_t *uint32); +void s1ap_uint32_to_ENB_ID( + S1AP_ENB_ID_PR present, uint32_t enb_id, S1AP_ENB_ID_t *eNB_ID); +void s1ap_ENB_ID_to_uint32( + S1AP_ENB_ID_t *eNB_ID, uint32_t *uint32); -CORE_DECLARE(status_t) s1ap_BIT_STRING_to_ip( +int s1ap_BIT_STRING_to_ip( BIT_STRING_t *bit_string, ip_t *ip); -CORE_DECLARE(status_t) s1ap_ip_to_BIT_STRING( +int s1ap_ip_to_BIT_STRING( ip_t *ip, BIT_STRING_t *bit_string); -CORE_DECLARE(status_t) s1ap_copy_ie( +int s1ap_copy_ie( const asn_TYPE_descriptor_t *td, void *src, void *dst); #ifdef __cplusplus diff --git a/src/mme/s1ap_handler.c b/src/mme/s1ap_handler.c index 149f06c32..b4f0944b7 100644 --- a/src/mme/s1ap_handler.c +++ b/src/mme/s1ap_handler.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _s1ap_handler - -#include "core_debug.h" - #include "mme_event.h" #include "mme_kdf.h" @@ -19,7 +15,7 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; int i, j; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -30,21 +26,21 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) S1AP_SupportedTAs_t *SupportedTAs = NULL; S1AP_PagingDRX_t *PagingDRX = NULL; - pkbuf_t *s1apbuf = NULL; - c_uint32_t enb_id; + ogs_pkbuf_t *s1apbuf = NULL; + uint32_t enb_id; S1AP_Cause_PR group = S1AP_Cause_PR_NOTHING; long cause = 0; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); S1SetupRequest = &initiatingMessage->value.choice.S1SetupRequest; - d_assert(S1SetupRequest, return,); + ogs_assert(S1SetupRequest); - d_trace(3, "[MME] S1-Setup request\n"); + ogs_debug("[MME] S1-Setup request"); for (i = 0; i < S1SetupRequest->protocolIEs.list.count; i++) { @@ -65,17 +61,17 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) } } - d_assert(Global_ENB_ID, return,); + ogs_assert(Global_ENB_ID); s1ap_ENB_ID_to_uint32(&Global_ENB_ID->eNB_ID, &enb_id); - d_trace(5, " IP[%s] ENB_ID[%d]\n", CORE_ADDR(enb->addr, buf), enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", OGS_ADDR(enb->addr, buf), enb_id); if (PagingDRX) - d_trace(5, " PagingDRX[%ld]\n", *PagingDRX); + ogs_debug(" PagingDRX[%ld]", *PagingDRX); mme_enb_set_enb_id(enb, enb_id); - d_assert(SupportedTAs, return,); + ogs_assert(SupportedTAs); /* Parse Supported TA */ enb->num_of_supported_ta_list = 0; for (i = 0; i < SupportedTAs->list.count; i++) @@ -85,26 +81,26 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) SupportedTAs_Item = (S1AP_SupportedTAs_Item_t *)SupportedTAs->list.array[i]; - d_assert(SupportedTAs_Item, return,); + ogs_assert(SupportedTAs_Item); tAC = &SupportedTAs_Item->tAC; - d_assert(tAC, return,); + ogs_assert(tAC); for (j = 0; j < SupportedTAs_Item->broadcastPLMNs.list.count; j++) { S1AP_PLMNidentity_t *pLMNidentity = NULL; pLMNidentity = (S1AP_PLMNidentity_t *) SupportedTAs_Item->broadcastPLMNs.list.array[j]; - d_assert(pLMNidentity, return,); + ogs_assert(pLMNidentity); memcpy(&enb->supported_ta_list[enb->num_of_supported_ta_list].tac, - tAC->buf, sizeof(c_uint16_t)); + tAC->buf, sizeof(uint16_t)); enb->supported_ta_list[enb->num_of_supported_ta_list].tac = ntohs(enb->supported_ta_list [enb->num_of_supported_ta_list].tac); memcpy(&enb->supported_ta_list [enb->num_of_supported_ta_list].plmn_id, pLMNidentity->buf, sizeof(plmn_id_t)); - d_trace(5, " PLMN_ID[MCC:%d MNC:%d] TAC[%d]\n", + ogs_debug(" PLMN_ID[MCC:%d MNC:%d] TAC[%d]", plmn_id_mcc(&enb->supported_ta_list [enb->num_of_supported_ta_list].plmn_id), plmn_id_mnc(&enb->supported_ta_list @@ -116,8 +112,8 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) if (enb->num_of_supported_ta_list == 0) { - d_warn("S1-Setup failure:"); - d_warn(" No supported TA exist in S1-Setup request"); + ogs_warn("S1-Setup failure:"); + ogs_warn(" No supported TA exist in S1-Setup request"); group = S1AP_Cause_PR_misc; cause = S1AP_CauseMisc_unspecified; } @@ -131,15 +127,15 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) if (served_tai_index >= 0 && served_tai_index < MAX_NUM_OF_SERVED_TAI) { - d_trace(5, " SERVED_TAI_INDEX[%d]\n", served_tai_index); + ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); break; } } if (served_tai_index < 0) { - d_warn("S1-Setup failure:"); - d_warn(" Cannot find Served TAI. Check 'mme.tai' configuration"); + ogs_warn("S1-Setup failure:"); + ogs_warn(" Cannot find Served TAI. Check 'mme.tai' configuration"); group = S1AP_Cause_PR_misc; cause = S1AP_CauseMisc_unknown_PLMN; } @@ -147,27 +143,25 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message) if (group == S1AP_Cause_PR_NOTHING) { - d_trace(3, "[MME] S1-Setup response\n"); - d_assert(s1ap_build_setup_rsp(&s1apbuf) == CORE_OK, - return, "s1ap_build_setup_rsp() failed"); + ogs_debug("[MME] S1-Setup response"); + ogs_assert(s1ap_build_setup_rsp(&s1apbuf) == OGS_OK); } else { - d_trace(3, "[MME] S1-Setup failure\n"); - d_assert(s1ap_build_setup_failure( - &s1apbuf, group, cause, S1AP_TimeToWait_v10s) == CORE_OK, - return, "s1ap_build_setup_failure() failed"); + ogs_debug("[MME] S1-Setup failure"); + ogs_assert(s1ap_build_setup_failure( + &s1apbuf, group, cause, S1AP_TimeToWait_v10s) == OGS_OK); } - d_assert(s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == CORE_OK,, - "s1ap_send_to_enb() failed"); + ogs_assert( + s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK); } void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; + int rv; int i; - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; S1AP_InitiatingMessage_t *initiatingMessage = NULL; S1AP_InitialUEMessage_t *InitialUEMessage = NULL; @@ -185,16 +179,16 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message) enb_ue_t *enb_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); InitialUEMessage = &initiatingMessage->value.choice.InitialUEMessage; - d_assert(InitialUEMessage, return,); + ogs_assert(InitialUEMessage); - d_trace(3, "[MME] Initial UE Message\n"); + ogs_debug("[MME] Initial UE Message"); for (i = 0; i < InitialUEMessage->protocolIEs.list.count; i++) { @@ -221,15 +215,15 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message) } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(ENB_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); if (!enb_ue) { enb_ue = enb_ue_add(enb); - d_assert(enb_ue, return, "Null param"); + ogs_assert(enb_ue); enb_ue->enb_ue_s1ap_id = *ENB_UE_S1AP_ID; @@ -255,12 +249,12 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message) mme_ue = mme_ue_find_by_guti(&guti); if (!mme_ue) { - d_warn("Unknown UE by S_TMSI[G:%d,C:%d,M_TMSI:0x%x]", + ogs_warn("Unknown UE by S_TMSI[G:%d,C:%d,M_TMSI:0x%x]", guti.mme_gid, guti.mme_code, guti.m_tmsi); } else { - d_trace(5, " S_TMSI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]\n", + ogs_debug(" S_TMSI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]", mme_ue->guti.mme_gid, mme_ue->guti.mme_code, mme_ue->guti.m_tmsi, @@ -271,73 +265,52 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message) * older S1(enb_ue_t) context */ if (ECM_CONNECTED(mme_ue)) { -#if 1 /* IMPLICIT_S1_RELEASE */ /* Implcit S1 release */ - d_trace(5, "Implicit S1 release\n"); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug("Implicit S1 release"); + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", mme_ue->enb_ue->enb_ue_s1ap_id, mme_ue->enb_ue->mme_ue_s1ap_id); rv = enb_ue_remove(mme_ue->enb_ue); - d_assert(rv == CORE_OK,,); - -#else /* S1_HOLDING_TIMER */ - - /* Previous S1(enb_ue_t) context the holding timer(30secs) - * is started. - * Newly associated S1(enb_ue_t) context holding timer - * is stopped. */ - d_trace(5, "Start S1 Holding Timer\n"); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", - mme_ue->enb_ue->enb_ue_s1ap_id, - mme_ue->enb_ue->mme_ue_s1ap_id); - - /* De-associate S1 with NAS/EMM */ - rv = enb_ue_deassociate(mme_ue->enb_ue); - d_assert(rv == CORE_OK,,); - - tm_start(mme_ue->enb_ue->holding_timer); -#endif + ogs_assert(rv == OGS_OK); } - tm_stop(enb_ue->holding_timer); mme_ue_associate_enb_ue(mme_ue, enb_ue); } } } - d_assert(TAI, return,); + ogs_assert(TAI); pLMNidentity = &TAI->pLMNidentity; - d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,); + ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t)); tAC = &TAI->tAC; - d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,); + ogs_assert(tAC && tAC->size == sizeof(uint16_t)); memcpy(&enb_ue->nas.tai.plmn_id, pLMNidentity->buf, sizeof(enb_ue->nas.tai.plmn_id)); memcpy(&enb_ue->nas.tai.tac, tAC->buf, sizeof(enb_ue->nas.tai.tac)); enb_ue->nas.tai.tac = ntohs(enb_ue->nas.tai.tac); - d_assert(EUTRAN_CGI, return,); + ogs_assert(EUTRAN_CGI); pLMNidentity = &EUTRAN_CGI->pLMNidentity; - d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,); + ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t)); cell_ID = &EUTRAN_CGI->cell_ID; - d_assert(cell_ID, return,); + ogs_assert(cell_ID); memcpy(&enb_ue->nas.e_cgi.plmn_id, pLMNidentity->buf, sizeof(enb_ue->nas.e_cgi.plmn_id)); memcpy(&enb_ue->nas.e_cgi.cell_id, cell_ID->buf, sizeof(enb_ue->nas.e_cgi.cell_id)); enb_ue->nas.e_cgi.cell_id = (ntohl(enb_ue->nas.e_cgi.cell_id) >> 4); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d] TAC[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d] TAC[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id, enb_ue->nas.tai.tac); - d_assert(s1ap_send_to_nas(enb_ue, - S1AP_ProcedureCode_id_initialUEMessage, NAS_PDU) == CORE_OK,, - "s1ap_send_to_nas failed"); + ogs_assert(s1ap_send_to_nas(enb_ue, + S1AP_ProcedureCode_id_initialUEMessage, NAS_PDU) == OGS_OK); } void s1ap_handle_uplink_nas_transport( mme_enb_t *enb, s1ap_message_t *message) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -349,16 +322,16 @@ void s1ap_handle_uplink_nas_transport( enb_ue_t *enb_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); UplinkNASTransport = &initiatingMessage->value.choice.UplinkNASTransport; - d_assert(UplinkNASTransport, return,); + ogs_assert(UplinkNASTransport); - d_trace(3, "[MME] Uplink NAS transport\n"); + ogs_debug("[MME] Uplink NAS transport"); for (i = 0; i < UplinkNASTransport->protocolIEs.list.count; i++) { @@ -376,26 +349,24 @@ void s1ap_handle_uplink_nas_transport( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(ENB_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(enb_ue, return, "No UE Context[ENB_UE_S1AP_ID:%d]", - *ENB_UE_S1AP_ID); + ogs_assert(enb_ue); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - d_assert(s1ap_send_to_nas(enb_ue, - S1AP_ProcedureCode_id_uplinkNASTransport, NAS_PDU) == CORE_OK,, - "s1ap_send_to_nas failed"); + ogs_assert(s1ap_send_to_nas(enb_ue, + S1AP_ProcedureCode_id_uplinkNASTransport, NAS_PDU) == OGS_OK); } void s1ap_handle_ue_capability_info_indication( mme_enb_t *enb, s1ap_message_t *message) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -407,17 +378,17 @@ void s1ap_handle_ue_capability_info_indication( enb_ue_t *enb_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); UECapabilityInfoIndication = &initiatingMessage->value.choice.UECapabilityInfoIndication; - d_assert(UECapabilityInfoIndication, return,); + ogs_assert(UECapabilityInfoIndication); - d_trace(3, "[MME] UE capability info indication\n"); + ogs_debug("[MME] UE capability info indication"); for (i = 0; i < UECapabilityInfoIndication->protocolIEs.list.count; i++) { @@ -435,19 +406,19 @@ void s1ap_handle_ue_capability_info_indication( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(ENB_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(enb_ue, return, "No UE Context[%d]", *ENB_UE_S1AP_ID); + ogs_assert(enb_ue); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); if (enb_ue->mme_ue) { - d_assert(UERadioCapability, return,); + ogs_assert(UERadioCapability); S1AP_STORE_DATA(&enb_ue->mme_ue->ueRadioCapability, UERadioCapability); } } @@ -455,8 +426,8 @@ void s1ap_handle_ue_capability_info_indication( void s1ap_handle_initial_context_setup_response( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -469,17 +440,17 @@ void s1ap_handle_initial_context_setup_response( mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); successfulOutcome = message->choice.successfulOutcome; - d_assert(successfulOutcome, return,); + ogs_assert(successfulOutcome); InitialContextSetupResponse = &successfulOutcome->value.choice.InitialContextSetupResponse; - d_assert(InitialContextSetupResponse, return,); + ogs_assert(InitialContextSetupResponse); - d_trace(3, "[MME] Initial context setup response\n"); + ogs_debug("[MME] Initial context setup response"); for (i = 0; i < InitialContextSetupResponse->protocolIEs.list.count; i++) { @@ -498,19 +469,19 @@ void s1ap_handle_initial_context_setup_response( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(ENB_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(enb_ue, return, "No UE Context[%d]", *ENB_UE_S1AP_ID); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, return,); + ogs_assert(mme_ue); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - d_assert(E_RABSetupListCtxtSURes, return,); + ogs_assert(E_RABSetupListCtxtSURes); for (i = 0; i < E_RABSetupListCtxtSURes->list.count; i++) { S1AP_E_RABSetupItemCtxtSUResIEs_t *ie2 = NULL; @@ -521,36 +492,36 @@ void s1ap_handle_initial_context_setup_response( ie2 = (S1AP_E_RABSetupItemCtxtSUResIEs_t *) E_RABSetupListCtxtSURes->list.array[i]; - d_assert(ie2, return,); + ogs_assert(ie2); e_rab = &ie2->value.choice.E_RABSetupItemCtxtSURes; - d_assert(e_rab, return, "Null param"); + ogs_assert(e_rab); sess = mme_sess_find_by_ebi(mme_ue, e_rab->e_RAB_ID); - d_assert(sess, return, "Null param"); + ogs_assert(sess); bearer = mme_default_bearer_in_sess(sess); - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf, sizeof(bearer->enb_s1u_teid)); bearer->enb_s1u_teid = ntohl(bearer->enb_s1u_teid); rv = s1ap_BIT_STRING_to_ip( &e_rab->transportLayerAddress, &bearer->enb_s1u_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); - d_trace(5, " EBI[%d] ENB-S1U-TEID[%d]\n", + ogs_debug(" EBI[%d] ENB-S1U-TEID[%d]", bearer->ebi, bearer->enb_s1u_teid); - if (FSM_CHECK(&bearer->sm, esm_state_active)) + if (OGS_FSM_CHECK(&bearer->sm, esm_state_active)) { - d_trace(5, " NAS_EPS Type[%d]\n", mme_ue->nas_eps.type); + ogs_debug(" NAS_EPS Type[%d]", mme_ue->nas_eps.type); int uli_presence = 0; if (mme_ue->nas_eps.type != MME_EPS_TYPE_ATTACH_REQUEST) { - d_trace(5, " ### ULI PRESENT ###\n"); + ogs_debug(" ### ULI PRESENT ###"); uli_presence = 1; } rv = mme_gtp_send_modify_bearer_request(bearer, uli_presence); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); } } } @@ -558,8 +529,8 @@ void s1ap_handle_initial_context_setup_response( void s1ap_handle_initial_context_setup_failure( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL; @@ -572,17 +543,17 @@ void s1ap_handle_initial_context_setup_failure( mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); unsuccessfulOutcome = message->choice.unsuccessfulOutcome; - d_assert(unsuccessfulOutcome, return,); + ogs_assert(unsuccessfulOutcome); InitialContextSetupFailure = &unsuccessfulOutcome->value.choice.InitialContextSetupFailure; - d_assert(InitialContextSetupFailure, return,); + ogs_assert(InitialContextSetupFailure); - d_trace(3, "[MME] Initial context setup failure\n"); + ogs_debug("[MME] Initial context setup failure"); for (i = 0; i < InitialContextSetupFailure->protocolIEs.list.count; i++) { @@ -600,30 +571,30 @@ void s1ap_handle_initial_context_setup_failure( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(ENB_UE_S1AP_ID, return,); - d_assert(Cause, return,); + ogs_assert(ENB_UE_S1AP_ID); + ogs_assert(Cause); enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); if (enb_ue == NULL) { - d_warn("Initial context setup failure : cannot find eNB-UE-S1AP-ID[%d]", - *ENB_UE_S1AP_ID); + ogs_warn("Initial context setup failure : cannot find eNB-UE-S1AP-ID[%d]", + (int)*ENB_UE_S1AP_ID); return; } mme_ue = enb_ue->mme_ue; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - d_trace(5, " Cause[Group:%d Cause:%d]\n", - Cause->present, Cause->choice.radioNetwork); + ogs_debug(" Cause[Group:%d Cause:%d]", + Cause->present, (int)Cause->choice.radioNetwork); - d_assert(mme_ue,,); - if (mme_ue && FSM_CHECK(&mme_ue->sm, emm_state_registered)) + ogs_assert(mme_ue); + if (mme_ue && OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { - d_trace(5, " EMM-Registered\n"); + ogs_debug(" EMM-Registered"); /* * 19.2.2.3 in Spec 36.300 @@ -638,19 +609,18 @@ void s1ap_handle_initial_context_setup_failure( } else { - d_trace(5, " NOT EMM-Registered\n"); - d_assert(mme_ue,,); + ogs_debug(" NOT EMM-Registered"); + ogs_assert(mme_ue); rv = mme_send_delete_session_or_ue_context_release(mme_ue, enb_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_ue_context_release() failed"); + ogs_assert(rv == OGS_OK); } } void s1ap_handle_e_rab_setup_response( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -663,16 +633,16 @@ void s1ap_handle_e_rab_setup_response( enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); successfulOutcome = message->choice.successfulOutcome; - d_assert(successfulOutcome, return,); + ogs_assert(successfulOutcome); E_RABSetupResponse = &successfulOutcome->value.choice.E_RABSetupResponse; - d_assert(E_RABSetupResponse, return,); + ogs_assert(E_RABSetupResponse); - d_trace(3, "[MME] E-RAB setup response\n"); + ogs_debug("[MME] E-RAB setup response"); for (i = 0; i < E_RABSetupResponse->protocolIEs.list.count; i++) { @@ -691,19 +661,19 @@ void s1ap_handle_e_rab_setup_response( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(ENB_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(enb_ue, return, "No UE Context[%d]", *ENB_UE_S1AP_ID); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, return,); + ogs_assert(mme_ue); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - d_assert(E_RABSetupListBearerSURes, return,); + ogs_assert(E_RABSetupListBearerSURes); for (i = 0; i < E_RABSetupListBearerSURes->list.count; i++) { S1AP_E_RABSetupItemBearerSUResIEs_t *ie2 = NULL; @@ -713,40 +683,40 @@ void s1ap_handle_e_rab_setup_response( ie2 = (S1AP_E_RABSetupItemBearerSUResIEs_t *) E_RABSetupListBearerSURes->list.array[i]; - d_assert(ie2, return,); + ogs_assert(ie2); e_rab = &ie2->value.choice.E_RABSetupItemBearerSURes; - d_assert(e_rab, return, "Null param"); + ogs_assert(e_rab); bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID); - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf, sizeof(bearer->enb_s1u_teid)); bearer->enb_s1u_teid = ntohl(bearer->enb_s1u_teid); rv = s1ap_BIT_STRING_to_ip( &e_rab->transportLayerAddress, &bearer->enb_s1u_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); - d_trace(5, " EBI[%d]\n", bearer->ebi); + ogs_debug(" EBI[%d]", bearer->ebi); - if (FSM_CHECK(&bearer->sm, esm_state_active)) + if (OGS_FSM_CHECK(&bearer->sm, esm_state_active)) { - status_t rv; + int rv; mme_bearer_t *linked_bearer = mme_linked_bearer(bearer); - d_assert(linked_bearer, return, "Null param"); - d_trace(5, " Linked-EBI[%d]\n", linked_bearer->ebi); + ogs_assert(linked_bearer); + ogs_debug(" Linked-EBI[%d]", linked_bearer->ebi); if (bearer->ebi == linked_bearer->ebi) { rv = mme_gtp_send_modify_bearer_request(bearer, 0); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); } else { rv = mme_gtp_send_create_bearer_response(bearer); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); } } } @@ -755,8 +725,8 @@ void s1ap_handle_e_rab_setup_response( void s1ap_handle_ue_context_release_request( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -770,17 +740,17 @@ void s1ap_handle_ue_context_release_request( enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); UEContextReleaseRequest = &initiatingMessage->value.choice.UEContextReleaseRequest; - d_assert(UEContextReleaseRequest, return,); + ogs_assert(UEContextReleaseRequest); - d_trace(3, "[MME] UE Context release request\n"); + ogs_debug("[MME] UE Context release request"); for (i = 0; i < UEContextReleaseRequest->protocolIEs.list.count; i++) { @@ -801,28 +771,29 @@ void s1ap_handle_ue_context_release_request( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(MME_UE_S1AP_ID, return,); + ogs_assert(MME_UE_S1AP_ID); enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID); if (!enb_ue) { - d_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]", *MME_UE_S1AP_ID); + ogs_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]", + (int)*MME_UE_S1AP_ID); rv = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID, S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id); - d_assert(rv == CORE_OK, return, "s1ap send error"); + ogs_assert(rv == OGS_OK); return; } - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - d_assert(Cause, return,); - d_trace(5, " Cause[Group:%d Cause:%d]\n", - Cause->present, Cause->choice.radioNetwork); + ogs_assert(Cause); + ogs_debug(" Cause[Group:%d Cause:%d]", + Cause->present, (int)Cause->choice.radioNetwork); switch(Cause->present) { @@ -832,47 +803,45 @@ void s1ap_handle_ue_context_release_request( case S1AP_Cause_PR_misc: break; case S1AP_Cause_PR_nas: - d_warn("NAS-Cause[%d]", Cause->choice.nas); + ogs_warn("NAS-Cause[%d]", (int)Cause->choice.nas); break; default: - d_warn("Invalid cause group[%d]", Cause->present); + ogs_warn("Invalid cause group[%d]", Cause->present); break; } mme_ue = enb_ue->mme_ue; if (mme_ue) { - if (FSM_CHECK(&mme_ue->sm, emm_state_registered)) + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { - d_trace(5, " EMM-Registered\n"); + ogs_debug(" EMM-Registered"); rv = mme_send_release_access_bearer_or_ue_context_release( mme_ue, enb_ue); - d_assert(rv == CORE_OK,, "mme_send_release_access_bearer_or_" - "ue_context_release() failed"); + ogs_assert(rv == OGS_OK); } else { - d_trace(5, " NOT EMM-Registered\n"); + ogs_debug(" NOT EMM-Registered"); rv = mme_send_delete_session_or_ue_context_release(mme_ue, enb_ue); - d_assert(rv == CORE_OK,, - "mme_send_delete_session_or_ue_context_release() failed"); + ogs_assert(rv == OGS_OK); } } else { - d_trace(5, " S1 Context Not Associated\n"); + ogs_debug(" S1 Context Not Associated"); rv = s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_NO_ACTION, 0); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } } void s1ap_handle_ue_context_release_complete( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -884,17 +853,17 @@ void s1ap_handle_ue_context_release_complete( mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); successfulOutcome = message->choice.successfulOutcome; - d_assert(successfulOutcome, return,); + ogs_assert(successfulOutcome); UEContextReleaseComplete = &successfulOutcome->value.choice.UEContextReleaseComplete; - d_assert(UEContextReleaseComplete, return,); + ogs_assert(UEContextReleaseComplete); - d_trace(3, "[MME] UE Context release complete\n"); + ogs_debug("[MME] UE Context release complete"); for (i = 0; i < UEContextReleaseComplete->protocolIEs.list.count; i++) { @@ -909,89 +878,88 @@ void s1ap_handle_ue_context_release_complete( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(MME_UE_S1AP_ID, return,); + ogs_assert(MME_UE_S1AP_ID); enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID); if (!enb_ue) { - d_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]", *MME_UE_S1AP_ID); + ogs_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]", + (int)*MME_UE_S1AP_ID); rv = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL, S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id); - d_assert(rv == CORE_OK, return, "s1ap send error"); + ogs_assert(rv == OGS_OK); return; } mme_ue = enb_ue->mme_ue; - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); switch (enb_ue->ue_ctx_rel_action) { case S1AP_UE_CTX_REL_NO_ACTION: { - d_trace(5, " No Action\n"); + ogs_debug(" No Action"); rv = enb_ue_remove(enb_ue); - d_assert(rv == CORE_OK,, "enb_ue_remove() failed"); + ogs_assert(rv == OGS_OK); break; } case S1AP_UE_CTX_REL_S1_NORMAL_RELEASE: { - d_trace(5, " Action: S1 normal release\n"); + ogs_debug(" Action: S1 normal release"); rv = enb_ue_remove(enb_ue); - d_assert(rv == CORE_OK,, "enb_ue_remove() failed"); + ogs_assert(rv == OGS_OK); - d_assert(mme_ue,,); + ogs_assert(mme_ue); rv = mme_ue_deassociate(mme_ue); - d_assert(rv == CORE_OK,, "mme_ue_deassociate() failed"); + ogs_assert(rv == OGS_OK); break; } case S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE: { - d_trace(5, " Action: UE context remove()\n"); + ogs_debug(" Action: UE context remove()"); rv = enb_ue_remove(enb_ue); - d_assert(rv == CORE_OK,, "enb_ue_removeI() failed"); + ogs_assert(rv == OGS_OK); - d_assert(mme_ue,,); + ogs_assert(mme_ue); rv = mme_ue_remove(mme_ue); - d_assert(rv == CORE_OK,, "mme_ue_remove() failed"); + ogs_assert(rv == OGS_OK); break; } case S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL: { - d_trace(5, " Action: Delete indirect tunnel\n"); + ogs_debug(" Action: Delete indirect tunnel"); rv = source_ue_deassociate_target_ue(enb_ue); - d_assert(rv == CORE_OK,, - "source_ue_deassociate_target_ue() failed"); + ogs_assert(rv == OGS_OK); rv = enb_ue_remove(enb_ue); - d_assert(rv == CORE_OK,, "enb_ue_removeI() failed"); + ogs_assert(rv == OGS_OK); - d_assert(mme_ue,,); + ogs_assert(mme_ue); if (mme_ue_have_indirect_tunnel(mme_ue)) { rv = mme_gtp_send_delete_indirect_data_forwarding_tunnel_request(mme_ue); - d_assert(rv == CORE_OK,, "mme_gtp_send_delete_indirect_data_" - "forwarding_tunnel_request() failed"); + ogs_assert(rv == OGS_OK); } else { - d_warn("Check your eNodeB"); - d_warn(" There is no INDIRECT TUNNEL"); - d_warn(" Packet could be dropped during S1-Handover"); + ogs_warn("Check your eNodeB"); + ogs_warn(" There is no INDIRECT TUNNEL"); + ogs_warn(" Packet could be dropped during S1-Handover"); rv = mme_ue_clear_indirect_tunnel(mme_ue); - d_assert(rv == CORE_OK,, - "mme_ue_clear_indirect_tunnel() failed"); + ogs_assert(rv == OGS_OK); } break; } default: { - d_assert(0,, "Invalid Action[%d]", enb_ue->ue_ctx_rel_action); + ogs_fatal("Invalid Action[%d]", enb_ue->ue_ctx_rel_action); + ogs_assert_if_reached(); break; } } @@ -999,11 +967,11 @@ void s1ap_handle_ue_context_release_complete( void s1ap_handle_paging(mme_ue_t *mme_ue) { - pkbuf_t *s1apbuf = NULL; - hash_index_t *hi = NULL; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_hash_index_t *hi = NULL; mme_enb_t *enb = NULL; int i; - status_t rv; + int rv; /* Find enB with matched TAI */ for (hi = mme_enb_first(); hi; hi = mme_enb_next(hi)) @@ -1018,33 +986,56 @@ void s1ap_handle_paging(mme_ue_t *mme_ue) { s1apbuf = mme_ue->last_paging_msg; /* Save it for later use */ - mme_ue->last_paging_msg = pkbuf_copy(s1apbuf); + mme_ue->last_paging_msg = ogs_pkbuf_copy(s1apbuf); } else { /* Buidl S1Ap Paging message */ rv = s1ap_build_paging(&s1apbuf, mme_ue); - d_assert(rv == CORE_OK && s1apbuf, return, - "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); /* Save it for later use */ - mme_ue->last_paging_msg = pkbuf_copy(s1apbuf); + mme_ue->last_paging_msg = ogs_pkbuf_copy(s1apbuf); } /* Send to enb */ - d_assert(s1ap_send_to_enb( - enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == CORE_OK, - return, "s1ap send error"); + ogs_assert(s1ap_send_to_enb( + enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK); } } } } +void s1ap_t3413_timeout(void *data) +{ + mme_ue_t *mme_ue = data; + ogs_assert(mme_ue); + + if (mme_ue->max_paging_retry >= MAX_NUM_OF_PAGING) + { + /* Paging failed */ + ogs_warn("[EMM] Paging to IMSI[%s] failed. Stop paging", + mme_ue->imsi_bcd); + if (mme_ue->last_paging_msg) + { + ogs_pkbuf_free(mme_ue->last_paging_msg); + mme_ue->last_paging_msg = NULL; + } + } + else + { + mme_ue->max_paging_retry++; + s1ap_handle_paging(mme_ue); + /* Start T3413 */ + ogs_timer_start(mme_ue->t3413, mme_self()->t3413_value); + } +} + void s1ap_handle_path_switch_request( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1063,22 +1054,22 @@ void s1ap_handle_path_switch_request( S1AP_TAC_t *tAC = NULL; S1AP_EncryptionAlgorithms_t *encryptionAlgorithms = NULL; S1AP_IntegrityProtectionAlgorithms_t *integrityProtectionAlgorithms = NULL; - c_uint16_t eea = 0, eia = 0; + uint16_t eea = 0, eia = 0; enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); PathSwitchRequest = &initiatingMessage->value.choice.PathSwitchRequest; - d_assert(PathSwitchRequest, return,); + ogs_assert(PathSwitchRequest); - d_trace(3, "[MME] Path switch request\n"); + ogs_debug("[MME] Path switch request"); for (i = 0; i < PathSwitchRequest->protocolIEs.list.count; i++) { @@ -1109,51 +1100,51 @@ void s1ap_handle_path_switch_request( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(EUTRAN_CGI, return,); + ogs_assert(EUTRAN_CGI); pLMNidentity = &EUTRAN_CGI->pLMNidentity; - d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,); + ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t)); cell_ID = &EUTRAN_CGI->cell_ID; - d_assert(cell_ID, return,); + ogs_assert(cell_ID); - d_assert(TAI, return,); + ogs_assert(TAI); pLMNidentity = &TAI->pLMNidentity; - d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,); + ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t)); tAC = &TAI->tAC; - d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,); + ogs_assert(tAC && tAC->size == sizeof(uint16_t)); - d_assert(UESecurityCapabilities, return,); + ogs_assert(UESecurityCapabilities); encryptionAlgorithms = &UESecurityCapabilities->encryptionAlgorithms; integrityProtectionAlgorithms = &UESecurityCapabilities->integrityProtectionAlgorithms; - d_assert(MME_UE_S1AP_ID, return,); - d_assert(ENB_UE_S1AP_ID, return,); + ogs_assert(MME_UE_S1AP_ID); + ogs_assert(ENB_UE_S1AP_ID); enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID); if (!enb_ue) { - d_error("Cannot find UE from sourceMME-UE-S1AP-ID[%d] and eNB[%s:%d]", - *MME_UE_S1AP_ID, CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_error("Cannot find UE from sourceMME-UE-S1AP-ID[%d] and eNB[%s:%d]", + (int)*MME_UE_S1AP_ID, OGS_ADDR(enb->addr, buf), enb->enb_id); rv = s1ap_build_path_switch_failure(&s1apbuf, *ENB_UE_S1AP_ID, *MME_UE_S1AP_ID, S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id); - d_assert(rv == CORE_OK && s1apbuf, return, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return; } - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, return, "Null param"); + ogs_assert(mme_ue); if (SECURITY_CONTEXT_IS_VALID(mme_ue)) { @@ -1165,10 +1156,10 @@ void s1ap_handle_path_switch_request( rv = s1ap_build_path_switch_failure(&s1apbuf, *ENB_UE_S1AP_ID, *MME_UE_S1AP_ID, S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure); - d_assert(rv == CORE_OK && s1apbuf, return, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb_ue(enb_ue, s1apbuf); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return; } @@ -1185,14 +1176,18 @@ void s1ap_handle_path_switch_request( sizeof(enb_ue->nas.e_cgi.cell_id)); enb_ue->nas.e_cgi.cell_id = (ntohl(enb_ue->nas.e_cgi.cell_id) >> 4); - d_trace(5, " OLD TAI[PLMN_ID:0x%x,TAC:%d]\n", - mme_ue->tai.plmn_id, mme_ue->tai.tac); - d_trace(5, " OLD E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - mme_ue->e_cgi.plmn_id, mme_ue->e_cgi.cell_id); - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - enb_ue->nas.tai.plmn_id, enb_ue->nas.tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - enb_ue->nas.e_cgi.plmn_id, enb_ue->nas.e_cgi.cell_id); + ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), + mme_ue->tai.tac); + ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), + mme_ue->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&enb_ue->nas.tai.plmn_id), + enb_ue->nas.tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&enb_ue->nas.e_cgi.plmn_id), + enb_ue->nas.e_cgi.cell_id); /* Copy TAI and ECGI from enb_ue */ memcpy(&mme_ue->tai, &enb_ue->nas.tai, sizeof(tai_t)); @@ -1208,7 +1203,7 @@ void s1ap_handle_path_switch_request( mme_ue->ue_network_capability.eia = eia >> 9; mme_ue->ue_network_capability.eia0 = 0; - d_assert(E_RABToBeSwitchedDLList, return,); + ogs_assert(E_RABToBeSwitchedDLList); for (i = 0; i < E_RABToBeSwitchedDLList->list.count; i++) { S1AP_E_RABToBeSwitchedDLItemIEs_t *ie2 = NULL; @@ -1218,26 +1213,26 @@ void s1ap_handle_path_switch_request( ie2 = (S1AP_E_RABToBeSwitchedDLItemIEs_t *) E_RABToBeSwitchedDLList->list.array[i]; - d_assert(ie2, return,); + ogs_assert(ie2); e_rab = &ie2->value.choice.E_RABToBeSwitchedDLItem; - d_assert(e_rab, return, "Null param"); + ogs_assert(e_rab); bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID); - d_assert(bearer, return, "Cannot find e_RAB_ID[%d]", e_rab->e_RAB_ID); + ogs_assert(bearer); memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf, sizeof(bearer->enb_s1u_teid)); bearer->enb_s1u_teid = ntohl(bearer->enb_s1u_teid); rv = s1ap_BIT_STRING_to_ip( &e_rab->transportLayerAddress, &bearer->enb_s1u_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); GTP_COUNTER_INCREMENT( mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_PATH_SWITCH); rv = mme_gtp_send_modify_bearer_request(bearer, 1); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); } /* Switch to enb */ @@ -1245,10 +1240,10 @@ void s1ap_handle_path_switch_request( } void s1ap_handle_enb_configuration_transfer( - mme_enb_t *enb, s1ap_message_t *message, pkbuf_t *pkbuf) + mme_enb_t *enb, s1ap_message_t *message, ogs_pkbuf_t *pkbuf) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1257,17 +1252,17 @@ void s1ap_handle_enb_configuration_transfer( S1AP_ENBConfigurationTransferIEs_t *ie = NULL; S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); ENBConfigurationTransfer = &initiatingMessage->value.choice.ENBConfigurationTransfer; - d_assert(ENBConfigurationTransfer, return,); + ogs_assert(ENBConfigurationTransfer); - d_trace(3, "[MME] ENB configuration transfer\n"); + ogs_debug("[MME] ENB configuration transfer"); for (i = 0; i < ENBConfigurationTransfer->protocolIEs.list.count; i++) { ie = ENBConfigurationTransfer->protocolIEs.list.array[i]; @@ -1282,8 +1277,8 @@ void s1ap_handle_enb_configuration_transfer( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); if (SONConfigurationTransfer) { @@ -1293,8 +1288,8 @@ void s1ap_handle_enb_configuration_transfer( &SONConfigurationTransfer->sourceeNB_ID; mme_enb_t *target_enb = NULL; - c_uint32_t source_enb_id, target_enb_id; - c_uint16_t source_tac, target_tac; + uint32_t source_enb_id, target_enb_id; + uint16_t source_tac, target_tac; s1ap_ENB_ID_to_uint32( &sourceeNB_ID->global_ENB_ID.eNB_ID, &source_enb_id); @@ -1308,13 +1303,13 @@ void s1ap_handle_enb_configuration_transfer( sizeof(target_tac)); target_tac = ntohs(target_tac); - d_trace(5, " Source : ENB_ID[%s:%d], TAC[%d]\n", + ogs_debug(" Source : ENB_ID[%s:%d], TAC[%d]", sourceeNB_ID->global_ENB_ID.eNB_ID.present == S1AP_ENB_ID_PR_homeENB_ID ? "Home" : sourceeNB_ID->global_ENB_ID.eNB_ID.present == S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others", source_enb_id, source_tac); - d_trace(5, " Target : ENB_ID[%s:%d], TAC[%d]\n", + ogs_debug(" Target : ENB_ID[%s:%d], TAC[%d]", targeteNB_ID->global_ENB_ID.eNB_ID.present == S1AP_ENB_ID_PR_homeENB_ID ? "Home" : targeteNB_ID->global_ENB_ID.eNB_ID.present == @@ -1324,21 +1319,21 @@ void s1ap_handle_enb_configuration_transfer( target_enb = mme_enb_find_by_enb_id(target_enb_id); if (target_enb == NULL) { - d_warn("eNB configuration transfer : cannot find target eNB-id[%d]", + ogs_warn("eNB configuration transfer : cannot find target eNB-id[%d]", target_enb_id); return; } rv = s1ap_send_mme_configuration_transfer( target_enb, SONConfigurationTransfer); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); } } void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1353,21 +1348,21 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message) S1AP_Source_ToTarget_TransparentContainer_t *Source_ToTarget_TransparentContainer = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); HandoverRequired = &initiatingMessage->value.choice.HandoverRequired; - d_assert(HandoverRequired, return,); + ogs_assert(HandoverRequired); enb_ue_t *source_ue = NULL; mme_ue_t *mme_ue = NULL; mme_enb_t *target_enb = NULL; - c_uint32_t target_enb_id = 0; + uint32_t target_enb_id = 0; - d_trace(3, "[MME] Handover required\n"); + ogs_debug("[MME] Handover required"); for (i = 0; i < HandoverRequired->protocolIEs.list.count; i++) { ie = HandoverRequired->protocolIEs.list.array[i]; @@ -1397,10 +1392,10 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message) } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(TargetID, return,); + ogs_assert(TargetID); switch(TargetID->present) { case S1AP_TargetID_PR_targeteNB_ID: @@ -1412,7 +1407,7 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message) } default: { - d_error("Not implemented(%d)", TargetID->present); + ogs_error("Not implemented(%d)", TargetID->present); return; } } @@ -1420,27 +1415,22 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message) target_enb = mme_enb_find_by_enb_id(target_enb_id); if (target_enb == NULL) { - d_warn("Handover required : cannot find target eNB-id[%d]", + ogs_warn("Handover required : cannot find target eNB-id[%d]", target_enb_id); return; } - d_assert(ENB_UE_S1AP_ID, return,); - d_assert(MME_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); + ogs_assert(MME_UE_S1AP_ID); source_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(source_ue, return, - "Cannot find UE for eNB-UE-S1AP-ID[%d] and eNB[%s:%d]", - *ENB_UE_S1AP_ID, - CORE_ADDR(enb->addr, buf), enb->enb_id); - d_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID, return, - "Conflict MME-UE-S1AP-ID : %d != %d\n", - source_ue->mme_ue_s1ap_id, *MME_UE_S1AP_ID); + ogs_assert(source_ue); + ogs_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); mme_ue = source_ue->mme_ue; - d_assert(mme_ue, return,); + ogs_assert(mme_ue); if (SECURITY_CONTEXT_IS_VALID(mme_ue)) { @@ -1449,28 +1439,28 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message) } else { - d_assert(Cause, return,); + ogs_assert(Cause); rv = s1ap_send_handover_preparation_failure(source_ue, Cause); - d_assert(rv == CORE_OK, return, "s1ap send error"); + ogs_assert(rv == OGS_OK); return; } - d_assert(HandoverType, return,); + ogs_assert(HandoverType); source_ue->handover_type = *HandoverType; rv = s1ap_send_handover_request(mme_ue, target_enb, ENB_UE_S1AP_ID, MME_UE_S1AP_ID, HandoverType, Cause, Source_ToTarget_TransparentContainer); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); } void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -1487,17 +1477,17 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message) enb_ue_t *target_ue = NULL; mme_ue_t *mme_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); successfulOutcome = message->choice.successfulOutcome; - d_assert(successfulOutcome, return,); + ogs_assert(successfulOutcome); HandoverRequestAcknowledge = &successfulOutcome->value.choice.HandoverRequestAcknowledge; - d_assert(HandoverRequestAcknowledge, return,); + ogs_assert(HandoverRequestAcknowledge); - d_trace(3, "[MME] Handover request acknowledge\n"); + ogs_debug("[MME] Handover request acknowledge"); for (i = 0; i < HandoverRequestAcknowledge->protocolIEs.list.count; i++) { ie = HandoverRequestAcknowledge->protocolIEs.list.array[i]; @@ -1520,30 +1510,27 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message) break; } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(MME_UE_S1AP_ID, return,); - d_assert(ENB_UE_S1AP_ID, return,); - d_assert(E_RABAdmittedList, return,); - d_assert(Target_ToSource_TransparentContainer, return,); + ogs_assert(MME_UE_S1AP_ID); + ogs_assert(ENB_UE_S1AP_ID); + ogs_assert(E_RABAdmittedList); + ogs_assert(Target_ToSource_TransparentContainer); target_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID); - d_assert(target_ue, return, - "Cannot find UE for MME-UE-S1AP-ID[%d] and eNB[%s:%d]", - *MME_UE_S1AP_ID, - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_assert(target_ue); target_ue->enb_ue_s1ap_id = *ENB_UE_S1AP_ID; source_ue = target_ue->source_ue; - d_assert(source_ue, return,); + ogs_assert(source_ue); mme_ue = source_ue->mme_ue; - d_assert(mme_ue, return,); + ogs_assert(mme_ue); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id); for (i = 0; i < E_RABAdmittedList->list.count; i++) @@ -1554,43 +1541,43 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message) mme_bearer_t *bearer = NULL; ie2 = (S1AP_E_RABAdmittedItemIEs_t *)E_RABAdmittedList->list.array[i]; - d_assert(ie2, return,); + ogs_assert(ie2); e_rab = &ie2->value.choice.E_RABAdmittedItem; - d_assert(e_rab, return,); + ogs_assert(e_rab); bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID); - d_assert(bearer, return,); + ogs_assert(bearer); memcpy(&bearer->target_s1u_teid, e_rab->gTP_TEID.buf, sizeof(bearer->target_s1u_teid)); bearer->target_s1u_teid = ntohl(bearer->target_s1u_teid); rv = s1ap_BIT_STRING_to_ip( &e_rab->transportLayerAddress, &bearer->target_s1u_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); if (e_rab->dL_transportLayerAddress && e_rab->dL_gTP_TEID) { - d_assert(e_rab->dL_gTP_TEID->buf, return,); - d_assert(e_rab->dL_transportLayerAddress->buf, return,); + ogs_assert(e_rab->dL_gTP_TEID->buf); + ogs_assert(e_rab->dL_transportLayerAddress->buf); memcpy(&bearer->enb_dl_teid, e_rab->dL_gTP_TEID->buf, sizeof(bearer->enb_dl_teid)); bearer->enb_dl_teid = ntohl(bearer->enb_dl_teid); rv = s1ap_BIT_STRING_to_ip( e_rab->dL_transportLayerAddress, &bearer->enb_dl_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } if (e_rab->uL_TransportLayerAddress && e_rab->uL_GTP_TEID) { - d_assert(e_rab->uL_GTP_TEID->buf, return,); - d_assert(e_rab->uL_TransportLayerAddress->buf, return,); + ogs_assert(e_rab->uL_GTP_TEID->buf); + ogs_assert(e_rab->uL_TransportLayerAddress->buf); memcpy(&bearer->enb_ul_teid, e_rab->uL_GTP_TEID->buf, sizeof(bearer->enb_ul_teid)); bearer->enb_ul_teid = ntohl(bearer->enb_ul_teid); rv = s1ap_BIT_STRING_to_ip( e_rab->uL_TransportLayerAddress, &bearer->enb_ul_ip); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } } @@ -1600,19 +1587,19 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message) { rv = mme_gtp_send_create_indirect_data_forwarding_tunnel_request( mme_ue); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); } else { rv = s1ap_send_handover_command(source_ue); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); } } void s1ap_handle_handover_failure(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL; @@ -1625,16 +1612,16 @@ void s1ap_handle_handover_failure(mme_enb_t *enb, s1ap_message_t *message) enb_ue_t *target_ue = NULL; enb_ue_t *source_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); unsuccessfulOutcome = message->choice.unsuccessfulOutcome; - d_assert(unsuccessfulOutcome, return,); + ogs_assert(unsuccessfulOutcome); HandoverFailure = &unsuccessfulOutcome->value.choice.HandoverFailure; - d_assert(HandoverFailure, return,); + ogs_assert(HandoverFailure); - d_trace(3, "[MME] Handover failure\n"); + ogs_debug("[MME] Handover failure"); for (i = 0; i < HandoverFailure->protocolIEs.list.count; i++) { ie = HandoverFailure->protocolIEs.list.array[i]; @@ -1651,40 +1638,37 @@ void s1ap_handle_handover_failure(mme_enb_t *enb, s1ap_message_t *message) } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(MME_UE_S1AP_ID, return,); - d_assert(Cause, return,); + ogs_assert(MME_UE_S1AP_ID); + ogs_assert(Cause); target_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID); - d_assert(target_ue, return, - "Cannot find UE for MME-UE-S1AP-ID[%d] and eNB[%s:%d]", - *MME_UE_S1AP_ID, - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_assert(target_ue); source_ue = target_ue->source_ue; - d_assert(source_ue, return,); + ogs_assert(source_ue); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id); rv = s1ap_send_handover_preparation_failure(source_ue, Cause); - d_assert(rv == CORE_OK, return, "s1ap send error"); + ogs_assert(rv == OGS_OK); rv = s1ap_send_ue_context_release_command( target_ue, S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system, S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, 0); - d_assert(rv == CORE_OK, return, "s1ap send error"); + ogs_assert(rv == OGS_OK); } void s1ap_handle_handover_cancel(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1698,16 +1682,16 @@ void s1ap_handle_handover_cancel(mme_enb_t *enb, s1ap_message_t *message) enb_ue_t *source_ue = NULL; enb_ue_t *target_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); HandoverCancel = &initiatingMessage->value.choice.HandoverCancel; - d_assert(HandoverCancel, return,); + ogs_assert(HandoverCancel); - d_trace(3, "[MME] Handover cancel\n"); + ogs_debug("[MME] Handover cancel"); for (i = 0; i < HandoverCancel->protocolIEs.list.count; i++) { ie = HandoverCancel->protocolIEs.list.array[i]; @@ -1726,49 +1710,45 @@ void s1ap_handle_handover_cancel(mme_enb_t *enb, s1ap_message_t *message) break; } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(MME_UE_S1AP_ID, return,); - d_assert(ENB_UE_S1AP_ID, return,); - d_assert(Cause, return,); + ogs_assert(MME_UE_S1AP_ID); + ogs_assert(ENB_UE_S1AP_ID); + ogs_assert(Cause); source_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(source_ue, return, - "Cannot find UE for eNB-UE-S1AP-ID[%d] and eNB[%s:%d]", - *ENB_UE_S1AP_ID, - CORE_ADDR(enb->addr, buf), enb->enb_id); - d_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID, return, - "Conflict MME-UE-S1AP-ID : %d != %d\n", - source_ue->mme_ue_s1ap_id, *MME_UE_S1AP_ID); + ogs_assert(source_ue); + ogs_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID); target_ue = source_ue->target_ue; - d_assert(target_ue, return,); + ogs_assert(target_ue); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id); rv = s1ap_send_handover_cancel_ack(source_ue); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); rv = s1ap_send_ue_context_release_command( target_ue, S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_handover_cancelled, - S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, 300); - d_assert(rv == CORE_OK, return, "s1ap send error"); + S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, + ogs_time_from_msec(300)); + ogs_assert(rv == OGS_OK); - d_trace(3, "[MME] Handover Cancel : " - "UE[eNB-UE-S1AP-ID(%d)] --> eNB[%s:%d]\n", + ogs_debug("[MME] Handover Cancel : " + "UE[eNB-UE-S1AP-ID(%d)] --> eNB[%s:%d]", source_ue->enb_ue_s1ap_id, - CORE_ADDR(enb->addr, buf), enb->enb_id); + OGS_ADDR(enb->addr, buf), enb->enb_id); } void s1ap_handle_enb_status_transfer(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1782,16 +1762,16 @@ void s1ap_handle_enb_status_transfer(mme_enb_t *enb, s1ap_message_t *message) enb_ue_t *source_ue = NULL, *target_ue = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); ENBStatusTransfer = &initiatingMessage->value.choice.ENBStatusTransfer; - d_assert(ENBStatusTransfer, return,); + ogs_assert(ENBStatusTransfer); - d_trace(3, "[MME] ENB status transfer\n"); + ogs_debug("[MME] ENB status transfer"); for (i = 0; i < ENBStatusTransfer->protocolIEs.list.count; i++) { ie = ENBStatusTransfer->protocolIEs.list.array[i]; @@ -1811,39 +1791,34 @@ void s1ap_handle_enb_status_transfer(mme_enb_t *enb, s1ap_message_t *message) break; } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(MME_UE_S1AP_ID, return,); - d_assert(ENB_UE_S1AP_ID, return,); - d_assert(ENB_StatusTransfer_TransparentContainer, return,); + ogs_assert(MME_UE_S1AP_ID); + ogs_assert(ENB_UE_S1AP_ID); + ogs_assert(ENB_StatusTransfer_TransparentContainer); source_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(source_ue, return, - "Cannot find UE for eNB-UE-S1AP-ID[%d] and eNB[%s:%d]", - *ENB_UE_S1AP_ID, - CORE_ADDR(enb->addr, buf), enb->enb_id); - d_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID, return, - "Conflict MME-UE-S1AP-ID : %d != %d\n", - source_ue->mme_ue_s1ap_id, *MME_UE_S1AP_ID); + ogs_assert(source_ue); + ogs_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID); target_ue = source_ue->target_ue; - d_assert(target_ue, return,); + ogs_assert(target_ue); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id); rv = s1ap_send_mme_status_transfer(target_ue, ENB_StatusTransfer_TransparentContainer); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); } void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1865,16 +1840,16 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message) mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); HandoverNotify = &initiatingMessage->value.choice.HandoverNotify; - d_assert(HandoverNotify, return,); + ogs_assert(HandoverNotify); - d_trace(3, "[MME] Handover notification\n"); + ogs_debug("[MME] Handover notification"); for (i = 0; i < HandoverNotify->protocolIEs.list.count; i++) { ie = HandoverNotify->protocolIEs.list.array[i]; @@ -1896,40 +1871,35 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message) break; } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(EUTRAN_CGI, return,); + ogs_assert(EUTRAN_CGI); pLMNidentity = &EUTRAN_CGI->pLMNidentity; - d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,); + ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t)); cell_ID = &EUTRAN_CGI->cell_ID; - d_assert(cell_ID, return,); + ogs_assert(cell_ID); - d_assert(TAI, return,); + ogs_assert(TAI); pLMNidentity = &TAI->pLMNidentity; - d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,); + ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t)); tAC = &TAI->tAC; - d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,); + ogs_assert(tAC && tAC->size == sizeof(uint16_t)); - d_assert(ENB_UE_S1AP_ID, return,); - d_assert(MME_UE_S1AP_ID, return,); + ogs_assert(ENB_UE_S1AP_ID); + ogs_assert(MME_UE_S1AP_ID); target_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID); - d_assert(target_ue, return, - "Cannot find UE for eNB-UE-S1AP-ID[%d] and eNB[%s:%d]", - *ENB_UE_S1AP_ID, - CORE_ADDR(enb->addr, buf), enb->enb_id); - d_assert(target_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID, return, - "Conflict MME-UE-S1AP-ID : %d != %d\n", - target_ue->mme_ue_s1ap_id, *MME_UE_S1AP_ID); + ogs_assert(target_ue); + ogs_assert(target_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID); source_ue = target_ue->source_ue; - d_assert(source_ue, return,); + ogs_assert(source_ue); mme_ue = source_ue->mme_ue; - d_assert(mme_ue, return,); + ogs_assert(mme_ue); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id); mme_ue_associate_enb_ue(mme_ue, target_ue); @@ -1945,14 +1915,18 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message) sizeof(target_ue->nas.e_cgi.cell_id)); target_ue->nas.e_cgi.cell_id = (ntohl(target_ue->nas.e_cgi.cell_id) >> 4); - d_trace(5, " OLD TAI[PLMN_ID:0x%x,TAC:%d]\n", - mme_ue->tai.plmn_id, mme_ue->tai.tac); - d_trace(5, " OLD E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - mme_ue->e_cgi.plmn_id, mme_ue->e_cgi.cell_id); - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - target_ue->nas.tai.plmn_id, target_ue->nas.tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - target_ue->nas.e_cgi.plmn_id, target_ue->nas.e_cgi.cell_id); + ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&mme_ue->tai.plmn_id), + mme_ue->tai.tac); + ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), + mme_ue->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&target_ue->nas.tai.plmn_id), + target_ue->nas.tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&target_ue->nas.e_cgi.plmn_id), + target_ue->nas.e_cgi.cell_id); /* Copy TAI and ECGI from enb_ue */ memcpy(&mme_ue->tai, &target_ue->nas.tai, sizeof(tai_t)); @@ -1971,7 +1945,7 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message) mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_HANDOVER_NOTIFY); rv = mme_gtp_send_modify_bearer_request(bearer, 1); - d_assert(rv == CORE_OK, return, "gtp send failed"); + ogs_assert(rv == OGS_OK); bearer = mme_bearer_next(bearer); } @@ -1982,8 +1956,8 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message) void s1ap_handle_s1_reset( mme_enb_t *enb, s1ap_message_t *message) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; int i; S1AP_InitiatingMessage_t *initiatingMessage = NULL; @@ -1994,16 +1968,16 @@ void s1ap_handle_s1_reset( S1AP_ResetType_t *ResetType = NULL; S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); initiatingMessage = message->choice.initiatingMessage; - d_assert(initiatingMessage, return,); + ogs_assert(initiatingMessage); Reset = &initiatingMessage->value.choice.Reset; - d_assert(Reset, return,); + ogs_assert(Reset); - d_trace(3, "[MME] Reset\n"); + ogs_debug("[MME] Reset"); for (i = 0; i < Reset->protocolIEs.list.count; i++) { @@ -2021,12 +1995,12 @@ void s1ap_handle_s1_reset( } } - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); - d_assert(Cause, return,); - d_trace(5, " Cause[Group:%d Cause:%d]\n", - Cause->present, Cause->choice.radioNetwork); + ogs_assert(Cause); + ogs_debug(" Cause[Group:%d Cause:%d]", + Cause->present, (int)Cause->choice.radioNetwork); switch(Cause->present) { @@ -2036,29 +2010,29 @@ void s1ap_handle_s1_reset( case S1AP_Cause_PR_misc: break; case S1AP_Cause_PR_nas: - d_warn("NAS-Cause[%d]", Cause->choice.nas); + ogs_warn("NAS-Cause[%d]", (int)Cause->choice.nas); default: - d_warn("Invalid cause group[%d]", Cause->present); + ogs_warn("Invalid cause group[%d]", Cause->present); break; } - d_assert(ResetType, return,); + ogs_assert(ResetType); switch(ResetType->present) { case S1AP_ResetType_PR_s1_Interface: { - d_trace(5, " S1AP_ResetType_PR_s1_Interface\n"); + ogs_debug(" S1AP_ResetType_PR_s1_Interface"); rv = enb_ue_remove_in_enb(enb); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); break; } case S1AP_ResetType_PR_partOfS1_Interface: { - d_trace(5, " S1AP_ResetType_PR_partOfS1_Interface\n"); + ogs_debug(" S1AP_ResetType_PR_partOfS1_Interface"); partOfS1_Interface = ResetType->choice.partOfS1_Interface; - d_assert(partOfS1_Interface, return,); + ogs_assert(partOfS1_Interface); for (i = 0; i < partOfS1_Interface->list.count; i++) { S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie2 = NULL; @@ -2068,14 +2042,14 @@ void s1ap_handle_s1_reset( ie2 = (S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *) partOfS1_Interface->list.array[i]; - d_assert(ie2, return,); + ogs_assert(ie2); item = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem; - d_assert(item, return,); + ogs_assert(item); - d_trace(5, " MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]\n", - item->mME_UE_S1AP_ID ? *item->mME_UE_S1AP_ID : -1, - item->eNB_UE_S1AP_ID ? *item->eNB_UE_S1AP_ID : -1); + ogs_debug(" MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]", + item->mME_UE_S1AP_ID ? (int)*item->mME_UE_S1AP_ID : -1, + item->eNB_UE_S1AP_ID ? (int)*item->eNB_UE_S1AP_ID : -1); if (item->mME_UE_S1AP_ID) enb_ue = enb_ue_find_by_mme_ue_s1ap_id( @@ -2086,73 +2060,73 @@ void s1ap_handle_s1_reset( if (enb_ue == NULL) { - d_warn("Cannot find S1 Context " - "(MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d])\n", - item->mME_UE_S1AP_ID ? *item->mME_UE_S1AP_ID : -1, - item->eNB_UE_S1AP_ID ? *item->eNB_UE_S1AP_ID : -1); + ogs_warn("Cannot find S1 Context " + "(MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d])", + item->mME_UE_S1AP_ID ? (int)*item->mME_UE_S1AP_ID : -1, + item->eNB_UE_S1AP_ID ? (int)*item->eNB_UE_S1AP_ID : -1); continue; } rv = enb_ue_remove(enb_ue); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); } break; } default: - d_warn("Invalid ResetType[%d]", ResetType->present); + ogs_warn("Invalid ResetType[%d]", ResetType->present); break; } rv = s1ap_send_s1_reset_ack(enb, partOfS1_Interface); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); } void s1ap_handle_write_replace_warning_response( mme_enb_t *enb, s1ap_message_t *message) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; S1AP_WriteReplaceWarningResponse_t *WriteReplaceWarningResponse = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); successfulOutcome = message->choice.successfulOutcome; - d_assert(successfulOutcome, return,); + ogs_assert(successfulOutcome); WriteReplaceWarningResponse = &successfulOutcome->value.choice.WriteReplaceWarningResponse; - d_assert(WriteReplaceWarningResponse, return,); + ogs_assert(WriteReplaceWarningResponse); - d_trace(3, "[MME] Write replace warning response\n"); + ogs_debug("[MME] Write replace warning response"); - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); } void s1ap_handle_kill_response( mme_enb_t *enb, s1ap_message_t *message) { - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; S1AP_KillResponse_t *KillResponse = NULL; - d_assert(enb, return,); - d_assert(enb->sock, return,); + ogs_assert(enb); + ogs_assert(enb->sock); - d_assert(message, return,); + ogs_assert(message); successfulOutcome = message->choice.successfulOutcome; - d_assert(successfulOutcome, return,); + ogs_assert(successfulOutcome); KillResponse = &successfulOutcome->value.choice.KillResponse; - d_assert(KillResponse, return,); + ogs_assert(KillResponse); - d_trace(3, "[MME] Kill response\n"); + ogs_debug("[MME] Kill response"); - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); } diff --git a/src/mme/s1ap_handler.h b/src/mme/s1ap_handler.h index d5ccc6057..b2805b695 100644 --- a/src/mme/s1ap_handler.h +++ b/src/mme/s1ap_handler.h @@ -1,7 +1,7 @@ #ifndef __S1AP_HANDLER_H__ #define __S1AP_HANDLER_H__ -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #include "mme_context.h" @@ -9,53 +9,54 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) s1ap_handle_s1_setup_request( +void s1ap_handle_s1_setup_request( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_initial_ue_message( +void s1ap_handle_initial_ue_message( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_uplink_nas_transport( +void s1ap_handle_uplink_nas_transport( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_ue_capability_info_indication( +void s1ap_handle_ue_capability_info_indication( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_initial_context_setup_response( +void s1ap_handle_initial_context_setup_response( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_initial_context_setup_failure( +void s1ap_handle_initial_context_setup_failure( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_e_rab_setup_response( +void s1ap_handle_e_rab_setup_response( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_ue_context_release_request( +void s1ap_handle_ue_context_release_request( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_ue_context_release_complete( +void s1ap_handle_ue_context_release_complete( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_paging(mme_ue_t *mme_ue); +void s1ap_handle_paging(mme_ue_t *mme_ue); +void s1ap_t3413_timeout(void *data); -CORE_DECLARE(void) s1ap_handle_path_switch_request( +void s1ap_handle_path_switch_request( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_handover_required( +void s1ap_handle_handover_required( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_handover_request_ack( +void s1ap_handle_handover_request_ack( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_handover_failure( +void s1ap_handle_handover_failure( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_handover_cancel( +void s1ap_handle_handover_cancel( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_enb_status_transfer( +void s1ap_handle_enb_status_transfer( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_enb_configuration_transfer( - mme_enb_t *enb, s1ap_message_t *message, pkbuf_t *pkbuf); -CORE_DECLARE(void) s1ap_handle_handover_notification( +void s1ap_handle_enb_configuration_transfer( + mme_enb_t *enb, s1ap_message_t *message, ogs_pkbuf_t *pkbuf); +void s1ap_handle_handover_notification( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_s1_reset( +void s1ap_handle_s1_reset( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_write_replace_warning_response( +void s1ap_handle_write_replace_warning_response( mme_enb_t *enb, s1ap_message_t *message); -CORE_DECLARE(void) s1ap_handle_kill_response( +void s1ap_handle_kill_response( mme_enb_t *enb, s1ap_message_t *message); #ifdef __cplusplus } diff --git a/src/mme/s1ap_lksctp.c b/src/mme/s1ap_lksctp.c new file mode 100644 index 000000000..8ae006001 --- /dev/null +++ b/src/mme/s1ap_lksctp.c @@ -0,0 +1,289 @@ +#include "ogs-sctp.h" + +#include "mme_event.h" + +#include "s1ap_path.h" + +static void accept_handler(short when, ogs_socket_t fd, void *data); + +int s1ap_init(int sctp_streams, uint16_t port) +{ + ogs_sctp_set_num_ostreams(sctp_streams); + return OGS_OK; +} + +int s1ap_final() +{ + return OGS_OK; +} + +void s1ap_server(ogs_socknode_t *snode, int type) +{ + char buf[OGS_ADDRSTRLEN]; + + ogs_assert(snode); + + snode->sock = ogs_sctp_server(type, snode->list); + ogs_assert(snode->sock); + + snode->poll = ogs_pollset_add(mme_self()->pollset, + OGS_POLLIN, snode->sock->fd, accept_handler, snode->sock); + ogs_assert(snode->poll); + + ogs_info("s1ap_server() [%s]:%d", + OGS_ADDR(snode->list, buf), OGS_PORT(snode->list)); +} + +void s1ap_closesocket(ogs_sock_t *sock) +{ + ogs_assert(sock); + ogs_sock_destroy(sock); +} + +void s1ap_delete(ogs_socknode_t *snode) +{ + ogs_assert(snode); + + ogs_pollset_remove(snode->poll); + s1ap_closesocket(snode->sock); +} + +int s1ap_send(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf, + ogs_sockaddr_t *addr, uint16_t stream_no) +{ + int sent; + + ogs_assert(sock); + ogs_assert(pkbuf); + + sent = ogs_sctp_sendmsg(sock, pkbuf->data, pkbuf->len, + addr, SCTP_S1AP_PPID, stream_no); + if (sent < 0 || sent != pkbuf->len) + { + ogs_error("ogs_sctp_sendmsg error (%d:%s)", errno, strerror(errno)); + return OGS_ERROR; + } + ogs_pkbuf_free(pkbuf); + + return OGS_OK; +} + +int s1ap_recv(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf) +{ + int size; + + ogs_assert(sock); + ogs_assert(pkbuf); + + size = ogs_sctp_recvdata(sock, pkbuf->data, MAX_SDU_LEN, NULL, NULL); + if (size <= 0) + { + ogs_error("s1ap_recv() failed"); + return OGS_ERROR; + } + + ogs_pkbuf_trim(pkbuf, size); + return OGS_OK;; +} + +static void accept_handler(short when, ogs_socket_t fd, void *data) +{ + char buf[OGS_ADDRSTRLEN]; + ogs_sock_t *sock = data; + ogs_sock_t *new = NULL; + + ogs_assert(sock); + ogs_assert(fd != INVALID_SOCKET); + + new = ogs_sock_accept(sock); + if (new) + { + ogs_sockaddr_t *addr = NULL; + mme_event_t *e = NULL; + + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); + memcpy(addr, &new->remote_addr, sizeof(ogs_sockaddr_t)); + + ogs_info("eNB-S1 accepted[%s]:%d in s1_path module", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + + e = mme_event_new(MME_EVT_S1AP_LO_ACCEPT); + ogs_assert(e); + e->enb_sock = new; + e->enb_addr = addr; + mme_event_send(e); + } + else + { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "accept() failed"); + } +} + +void s1ap_recv_handler(short when, ogs_socket_t fd, void *data) +{ + ogs_pkbuf_t *pkbuf; + int size; + mme_event_t *e = NULL; + ogs_sock_t *sock = data; + ogs_sockaddr_t *addr = NULL; + ogs_sctp_info_t sinfo; + int flags = 0; + + ogs_assert(sock); + ogs_assert(fd != INVALID_SOCKET); + + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); +#if DEPRECATED + if (pkbuf == NULL) + { + char tmp_buf[MAX_SDU_LEN]; + + d_fatal("Can't allocate pkbuf"); + + /* Read data from socket to exit from select */ + ogs_recv(fd, tmp_buf, MAX_SDU_LEN, 0); + + return; + } +#endif + ogs_pkbuf_put(pkbuf, MAX_SDU_LEN); + size = ogs_sctp_recvmsg( + sock, pkbuf->data, pkbuf->len, NULL, &sinfo, &flags); + if (size < 0) + { + ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s)", + size, errno, strerror(errno)); + return; + } + + if (flags & MSG_NOTIFICATION) + { + union sctp_notification *not = + (union sctp_notification *)pkbuf->data; + + switch(not->sn_header.sn_type) + { + case SCTP_ASSOC_CHANGE : + { + ogs_debug("SCTP_ASSOC_CHANGE:" + "[T:%d, F:0x%x, S:%d, I/O:%d/%d]", + not->sn_assoc_change.sac_type, + not->sn_assoc_change.sac_flags, + not->sn_assoc_change.sac_state, + not->sn_assoc_change.sac_inbound_streams, + not->sn_assoc_change.sac_outbound_streams); + + if (not->sn_assoc_change.sac_state == SCTP_COMM_UP) + { + ogs_debug("SCTP_COMM_UP"); + + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); + memcpy(addr, &sock->remote_addr, sizeof(ogs_sockaddr_t)); + + e = mme_event_new(MME_EVT_S1AP_LO_SCTP_COMM_UP); + ogs_assert(e); + e->enb_sock = sock; + e->enb_addr = addr; + e->inbound_streams = + not->sn_assoc_change.sac_inbound_streams; + e->outbound_streams = + not->sn_assoc_change.sac_outbound_streams; + mme_event_send(e); + } + else if (not->sn_assoc_change.sac_state == SCTP_SHUTDOWN_COMP || + not->sn_assoc_change.sac_state == SCTP_COMM_LOST) + { + + if (not->sn_assoc_change.sac_state == SCTP_SHUTDOWN_COMP) + ogs_debug("SCTP_SHUTDOWN_COMP"); + if (not->sn_assoc_change.sac_state == SCTP_COMM_LOST) + ogs_debug("SCTP_COMM_LOST"); + + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); + memcpy(addr, &sock->remote_addr, sizeof(ogs_sockaddr_t)); + + e = mme_event_new(MME_EVT_S1AP_LO_CONNREFUSED); + ogs_assert(e); + e->enb_sock = sock; + e->enb_addr = addr; + mme_event_send(e); + } + break; + } + case SCTP_SHUTDOWN_EVENT : + { + ogs_debug("SCTP_SHUTDOWN_EVENT:[T:%d, F:0x%x, L:%d]", + not->sn_shutdown_event.sse_type, + not->sn_shutdown_event.sse_flags, + not->sn_shutdown_event.sse_length); + + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); + memcpy(addr, &sock->remote_addr, sizeof(ogs_sockaddr_t)); + + e = mme_event_new(MME_EVT_S1AP_LO_CONNREFUSED); + ogs_assert(e); + e->enb_sock = sock; + e->enb_addr = addr; + mme_event_send(e); + break; + } + case SCTP_PEER_ADDR_CHANGE: + { + ogs_warn("SCTP_PEER_ADDR_CHANGE:[T:%d, F:0x%x, S:%d]", + not->sn_paddr_change.spc_type, + not->sn_paddr_change.spc_flags, + not->sn_paddr_change.spc_error); + break; + } + case SCTP_REMOTE_ERROR: + { + ogs_warn("SCTP_REMOTE_ERROR:[T:%d, F:0x%x, S:%d]", + not->sn_remote_error.sre_type, + not->sn_remote_error.sre_flags, + not->sn_remote_error.sre_error); + break; + } + case SCTP_SEND_FAILED : + { + ogs_error("SCTP_SEND_FAILED:[T:%d, F:0x%x, S:%d]", + not->sn_send_failed.ssf_type, + not->sn_send_failed.ssf_flags, + not->sn_send_failed.ssf_error); + break; + } + default : + { + ogs_error("Discarding event with unknown flags:0x%x type:0x%x", + flags, not->sn_header.sn_type); + break; + } + } + } + else if (flags & MSG_EOR) + { + ogs_pkbuf_trim(pkbuf, size); + + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); + memcpy(addr, &sock->remote_addr, sizeof(ogs_sockaddr_t)); + + e = mme_event_new(MME_EVT_S1AP_MESSAGE); + ogs_assert(e); + e->enb_sock = sock; + e->enb_addr = addr; + e->pkbuf = pkbuf; + mme_event_send(e); + + return; + } + else + { + ogs_assert_if_reached(); + } + + ogs_pkbuf_free(pkbuf); +} diff --git a/src/mme/s1ap_path.c b/src/mme/s1ap_path.c index 36bed51e5..6703b3408 100644 --- a/src/mme/s1ap_path.c +++ b/src/mme/s1ap_path.c @@ -1,8 +1,3 @@ -#define TRACE_MODULE _s1ap_path - -#include "core_debug.h" -#include "core_thread.h" - #include "mme_event.h" #include "nas_security.h" @@ -12,167 +7,161 @@ #include "s1ap_build.h" #include "s1ap_path.h" -static status_t s1ap_server_list(list_t *list, int type); -static status_t s1ap_delete_list(list_t *list); +static int s1ap_server_list(ogs_list_t *list, int type); +static int s1ap_delete_list(ogs_list_t *list); -status_t s1ap_open(void) +int s1ap_open(void) { - status_t rv; -#if USE_USRSCTP != 1 + int rv; +#if HAVE_USRSCTP != 1 int type = SOCK_STREAM; #else int type = SOCK_SEQPACKET; #endif rv = s1ap_server_list(&mme_self()->s1ap_list, type); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_server_list(&mme_self()->s1ap_list6, type); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t s1ap_close() +int s1ap_close() { s1ap_delete_list(&mme_self()->s1ap_list); s1ap_delete_list(&mme_self()->s1ap_list6); - return CORE_OK; + return OGS_OK; } -static status_t s1ap_server_list(list_t *list, int type) +static int s1ap_server_list(ogs_list_t *list, int type) { - status_t rv; - sock_node_t *snode = NULL; + ogs_socknode_t *snode = NULL; - d_assert(list, return CORE_ERROR,); + ogs_assert(list); - for (snode = list_first(list); snode; snode = list_next(snode)) - { - rv = s1ap_server(snode, type); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } + ogs_list_for_each(list, snode) + s1ap_server(snode, type); - return CORE_OK; + return OGS_OK; } -static status_t s1ap_delete_list(list_t *list) +static int s1ap_delete_list(ogs_list_t *list) { - sock_node_t *snode = NULL; + ogs_socknode_t *snode = NULL; - for (snode = list_first(list); snode; snode = list_next(snode)) - { - s1ap_delete(snode->sock); - } + ogs_list_for_each(list, snode) + s1ap_delete(snode); - return CORE_OK; + return OGS_OK; } -status_t s1ap_send_to_enb(mme_enb_t *enb, pkbuf_t *pkbuf, c_uint16_t stream_no) +int s1ap_send_to_enb(mme_enb_t *enb, ogs_pkbuf_t *pkbuf, uint16_t stream_no) { - char buf[CORE_ADDRSTRLEN]; - status_t rv; + char buf[OGS_ADDRSTRLEN]; + int rv; - d_assert(enb, return CORE_ERROR,); - d_assert(pkbuf, return CORE_ERROR,); - d_assert(enb->sock, return CORE_ERROR,); + ogs_assert(enb); + ogs_assert(pkbuf); + ogs_assert(enb->sock); - d_trace(5, " IP[%s] ENB_ID[%d]\n", - CORE_ADDR(enb->addr, buf), enb->enb_id); + ogs_debug(" IP[%s] ENB_ID[%d]", + OGS_ADDR(enb->addr, buf), enb->enb_id); rv = s1ap_send(enb->sock, pkbuf, enb->sock_type == SOCK_STREAM ? NULL : enb->addr, stream_no); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1_send error"); - pkbuf_free(pkbuf); + ogs_error("s1_send error"); + ogs_pkbuf_free(pkbuf); } - return CORE_OK;; + return OGS_OK;; } -status_t s1ap_send_to_enb_ue(enb_ue_t *enb_ue, pkbuf_t *pkbuf) +int s1ap_send_to_enb_ue(enb_ue_t *enb_ue, ogs_pkbuf_t *pkbuf) { mme_enb_t *enb = NULL; mme_ue_t *mme_ue = NULL; - d_assert(enb_ue, return CORE_ERROR,); + ogs_assert(enb_ue); enb = enb_ue->enb; - d_assert(enb, return CORE_ERROR,); + ogs_assert(enb); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); return s1ap_send_to_enb(enb, pkbuf, mme_ue->ostream_id); } -status_t s1ap_delayed_send_to_enb_ue( - enb_ue_t *enb_ue, pkbuf_t *pkbuf, c_uint32_t duration) +int s1ap_delayed_send_to_enb_ue( + enb_ue_t *enb_ue, ogs_pkbuf_t *pkbuf, ogs_time_t duration) { - tm_block_id timer = 0; - - d_assert(enb_ue, return CORE_ERROR,); - d_assert(pkbuf, return CORE_ERROR,); + ogs_assert(enb_ue); + ogs_assert(pkbuf); if (duration) { - timer = timer_create( - &mme_self()->tm_service, MME_EVT_S1AP_DELAYED_SEND, duration); - d_assert(timer, return CORE_ERROR,); + mme_event_t *e = NULL; - timer_set_param1(timer, (c_uintptr_t)enb_ue->index); - timer_set_param2(timer, (c_uintptr_t)pkbuf); - timer_set_param3(timer, timer); + e = mme_event_new(MME_EVT_S1AP_DELAYED_SEND); + ogs_assert(e); + e->timer = ogs_timer_add(mme_self()->timer_mgr, mme_event_timeout, e); + ogs_assert(e->timer); + e->pkbuf = pkbuf; + e->enb_ue = enb_ue; - tm_start(timer); + ogs_timer_start(e->timer, duration); - return CORE_OK; + return OGS_OK; } else { mme_enb_t *enb = NULL; enb = enb_ue->enb; - d_assert(enb, return CORE_ERROR,); + ogs_assert(enb); return s1ap_send_to_enb_ue(enb_ue, pkbuf); } } -status_t s1ap_send_to_esm(mme_ue_t *mme_ue, pkbuf_t *esmbuf) +int s1ap_send_to_esm(mme_ue_t *mme_ue, ogs_pkbuf_t *esmbuf) { - event_t e; + mme_event_t *e = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(esmbuf, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); + ogs_assert(esmbuf); - event_set(&e, MME_EVT_ESM_MESSAGE); - event_set_param1(&e, (c_uintptr_t)mme_ue->index); - event_set_param2(&e, (c_uintptr_t)esmbuf); - mme_event_send(&e); + e = mme_event_new(MME_EVT_ESM_MESSAGE); + ogs_assert(e); + e->mme_ue = mme_ue; + e->pkbuf = esmbuf; + mme_event_send(e); - return CORE_OK; + return OGS_OK; } -status_t s1ap_send_to_nas(enb_ue_t *enb_ue, +int s1ap_send_to_nas(enb_ue_t *enb_ue, S1AP_ProcedureCode_t procedureCode, S1AP_NAS_PDU_t *nasPdu) { nas_security_header_t *sh = NULL; nas_security_header_type_t security_header_type; nas_emm_header_t *h = NULL; - pkbuf_t *nasbuf = NULL; - event_t e; + ogs_pkbuf_t *nasbuf = NULL; + mme_event_t *e = NULL; - d_assert(enb_ue, return CORE_ERROR, "Null param"); - d_assert(nasPdu, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); + ogs_assert(nasPdu); /* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM. * When calculating AES_CMAC, we need to use the headroom of the packet. */ - nasbuf = pkbuf_alloc(NAS_HEADROOM, nasPdu->size); - d_assert(nasbuf, return CORE_ERROR, "Null param"); - memcpy(nasbuf->payload, nasPdu->buf, nasPdu->size); + nasbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+nasPdu->size); + ogs_pkbuf_reserve(nasbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(nasbuf, nasPdu->buf, nasPdu->size); - sh = nasbuf->payload; - d_assert(sh, return CORE_ERROR, "Null param"); + sh = nasbuf->data; + ogs_assert(sh); memset(&security_header_type, 0, sizeof(nas_security_header_type_t)); switch(sh->security_header_type) @@ -184,197 +173,191 @@ status_t s1ap_send_to_nas(enb_ue_t *enb_ue, break; case NAS_SECURITY_HEADER_INTEGRITY_PROTECTED: security_header_type.integrity_protected = 1; - d_assert(pkbuf_header(nasbuf, -6) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(nasbuf, 6)); break; case NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED: security_header_type.integrity_protected = 1; security_header_type.ciphered = 1; - d_assert(pkbuf_header(nasbuf, -6) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(nasbuf, 6)); break; case NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_NEW_SECURITY_CONTEXT: security_header_type.integrity_protected = 1; security_header_type.new_security_context = 1; - d_assert(pkbuf_header(nasbuf, -6) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(nasbuf, 6)); break; case NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHTERD_WITH_NEW_INTEGRITY_CONTEXT: security_header_type.integrity_protected = 1; security_header_type.ciphered = 1; security_header_type.new_security_context = 1; - d_assert(pkbuf_header(nasbuf, -6) == CORE_OK, - return CORE_ERROR, "pkbuf_header error"); + ogs_assert(ogs_pkbuf_pull(nasbuf, 6)); break; default: - d_error("Not implemented(securiry header type:0x%x)", + ogs_error("Not implemented(securiry header type:0x%x)", sh->security_header_type); - return CORE_ERROR; + return OGS_ERROR; } if (enb_ue->mme_ue) { - d_assert(nas_security_decode( - enb_ue->mme_ue, security_header_type, nasbuf) == CORE_OK, - pkbuf_free(nasbuf);return CORE_ERROR, "nas_security_decode failed"); + ogs_assert(nas_security_decode( + enb_ue->mme_ue, security_header_type, nasbuf) == OGS_OK); } - h = nasbuf->payload; - d_assert(h, pkbuf_free(nasbuf); return CORE_ERROR, "Null param"); + h = nasbuf->data; + ogs_assert(h); if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM) { - event_set(&e, MME_EVT_EMM_MESSAGE); - event_set_param1(&e, (c_uintptr_t)enb_ue->index); - event_set_param2(&e, (c_uintptr_t)procedureCode); - event_set_param3(&e, (c_uintptr_t)security_header_type.type); - event_set_param4(&e, (c_uintptr_t)nasbuf); - mme_event_send(&e); + e = mme_event_new(MME_EVT_EMM_MESSAGE); + ogs_assert(e); + e->enb_ue = enb_ue; + e->s1ap_code = procedureCode; + e->nas_type = security_header_type.type; + e->pkbuf = nasbuf; + mme_event_send(e); } else if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_ESM) { mme_ue_t *mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); s1ap_send_to_esm(mme_ue, nasbuf); } else - d_assert(0, pkbuf_free(nasbuf); return CORE_ERROR, - "Unknown protocol:%d", h->protocol_discriminator); + ogs_assert_if_reached(); - return CORE_OK; + return OGS_OK; } -status_t s1ap_send_initial_context_setup_request(mme_ue_t *mme_ue) +int s1ap_send_initial_context_setup_request(mme_ue_t *mme_ue) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = s1ap_build_initial_context_setup_request(&s1apbuf, mme_ue, NULL); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "s1ap send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t s1ap_send_ue_context_release_command( +int s1ap_send_ue_context_release_command( enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause, - c_uint8_t action, c_uint32_t delay) + uint8_t action, uint32_t delay) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(action != S1AP_UE_CTX_REL_INVALID_ACTION, return CORE_ERROR, - "Should give valid action for UE Context Release Command"); + ogs_assert(action != S1AP_UE_CTX_REL_INVALID_ACTION); - d_assert(enb_ue, return CORE_ERROR, "Null param"); + ogs_assert(enb_ue); enb_ue->ue_ctx_rel_action = action; - d_trace(3, "[MME] UE Context release command\n"); - d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug("[MME] UE Context release command"); + ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id); - d_trace(5, " Group[%d] Cause[%d] Action[%d] Delay[%d]\n", - group, cause, action, delay); + ogs_debug(" Group[%d] Cause[%d] Action[%d] Delay[%d]", + group, (int)cause, action, delay); rv = s1ap_build_ue_context_release_command(&s1apbuf, enb_ue, group, cause); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_delayed_send_to_enb_ue(enb_ue, s1apbuf, delay); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t s1ap_send_mme_configuration_transfer( +int s1ap_send_mme_configuration_transfer( mme_enb_t *target_enb, S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(target_enb, return CORE_ERROR,); - d_assert(SONConfigurationTransfer, return CORE_ERROR,); + ogs_assert(target_enb); + ogs_assert(SONConfigurationTransfer); rv = s1ap_build_mme_configuration_transfer( &s1apbuf, SONConfigurationTransfer); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb(target_enb, s1apbuf, S1AP_NON_UE_SIGNALLING); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_path_switch_ack(mme_ue_t *mme_ue) +int s1ap_send_path_switch_ack(mme_ue_t *mme_ue) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(mme_ue, return CORE_ERROR, "Null param"); + ogs_assert(mme_ue); rv = s1ap_build_path_switch_ack(&s1apbuf, mme_ue); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = nas_send_to_enb(mme_ue, s1apbuf); - d_assert(rv == CORE_OK, return CORE_ERROR, "s1ap send error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t s1ap_send_handover_command(enb_ue_t *source_ue) +int s1ap_send_handover_command(enb_ue_t *source_ue) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(source_ue, return CORE_ERROR,); + ogs_assert(source_ue); rv = s1ap_build_handover_command(&s1apbuf, source_ue); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb_ue(source_ue, s1apbuf); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_handover_preparation_failure( +int s1ap_send_handover_preparation_failure( enb_ue_t *source_ue, S1AP_Cause_t *cause) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(source_ue, return CORE_ERROR,); - d_assert(cause, return CORE_ERROR,); + ogs_assert(source_ue); + ogs_assert(cause); rv = s1ap_build_handover_preparation_failure(&s1apbuf, source_ue, cause); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb_ue(source_ue, s1apbuf); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_handover_cancel_ack(enb_ue_t *source_ue) +int s1ap_send_handover_cancel_ack(enb_ue_t *source_ue) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(source_ue, return CORE_ERROR,); + ogs_assert(source_ue); rv = s1ap_build_handover_cancel_ack(&s1apbuf, source_ue); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb_ue(source_ue, s1apbuf); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_handover_request( +int s1ap_send_handover_request( mme_ue_t *mme_ue, mme_enb_t *target_enb, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, @@ -384,99 +367,98 @@ status_t s1ap_send_handover_request( S1AP_Source_ToTarget_TransparentContainer_t *source_totarget_transparentContainer) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; enb_ue_t *source_ue = NULL, *target_ue = NULL; - d_trace(3, "[MME] Handover request\n"); + ogs_debug("[MME] Handover request"); - d_assert(target_enb, return CORE_ERROR, "Cannot find target eNB"); + ogs_assert(target_enb); - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); source_ue = mme_ue->enb_ue; - d_assert(source_ue, return CORE_ERROR,); - d_assert(source_ue->target_ue == NULL, return CORE_ERROR, - "Handover Required Duplicated"); + ogs_assert(source_ue); + ogs_assert(source_ue->target_ue == NULL); target_ue = enb_ue_add(target_enb); - d_assert(target_ue, return CORE_ERROR,); + ogs_assert(target_ue); - d_trace(5, " Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id); - d_trace(5, " Target : ENB_UE_S1AP_ID[Unknown] MME_UE_S1AP_ID[%d]\n", + ogs_debug(" Target : ENB_UE_S1AP_ID[Unknown] MME_UE_S1AP_ID[%d]", target_ue->mme_ue_s1ap_id); rv = source_ue_associate_target_ue(source_ue, target_ue); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_build_handover_request(&s1apbuf, mme_ue, target_ue, enb_ue_s1ap_id, mme_ue_s1ap_id, handovertype, cause, source_totarget_transparentContainer); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb_ue(target_ue, s1apbuf); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_mme_status_transfer( +int s1ap_send_mme_status_transfer( enb_ue_t *target_ue, S1AP_ENB_StatusTransfer_TransparentContainer_t *enb_statustransfer_transparentContainer) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(target_ue, return CORE_ERROR,); + ogs_assert(target_ue); rv = s1ap_build_mme_status_transfer(&s1apbuf, target_ue, enb_statustransfer_transparentContainer); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb_ue(target_ue, s1apbuf); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_error_indication( +int s1ap_send_error_indication( mme_enb_t *enb, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, S1AP_Cause_PR group, long cause) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(enb, return CORE_ERROR,); + ogs_assert(enb); rv = s1ap_build_error_indication(&s1apbuf, mme_ue_s1ap_id, enb_ue_s1ap_id, group, cause); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } -status_t s1ap_send_s1_reset_ack( +int s1ap_send_s1_reset_ack( mme_enb_t *enb, S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface) { - status_t rv; - pkbuf_t *s1apbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; - d_assert(enb, return CORE_ERROR,); + ogs_assert(enb); rv = s1ap_build_s1_reset_ack(&s1apbuf, partOfS1_Interface); - d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING); - d_assert(rv == CORE_OK,, "s1ap send error"); + ogs_assert(rv == OGS_OK); return rv; } diff --git a/src/mme/s1ap_path.h b/src/mme/s1ap_path.h index ab517522b..d60350d85 100644 --- a/src/mme/s1ap_path.h +++ b/src/mme/s1ap_path.h @@ -1,10 +1,8 @@ #ifndef __S1AP_PATH_H__ #define __S1AP_PATH_H__ -#include "core_pkbuf.h" - #include "mme_context.h" -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #ifdef __cplusplus extern "C" { @@ -12,47 +10,47 @@ extern "C" { #define S1AP_NON_UE_SIGNALLING 0 -CORE_DECLARE(status_t) s1ap_init(int sctp_streams, c_uint16_t port); -CORE_DECLARE(status_t) s1ap_final(); +int s1ap_init(int sctp_streams, uint16_t port); +int s1ap_final(); -CORE_DECLARE(status_t) s1ap_open(); -CORE_DECLARE(status_t) s1ap_close(); +int s1ap_open(); +int s1ap_close(); -CORE_DECLARE(status_t) s1ap_server(sock_node_t *snode, int type); -CORE_DECLARE(status_t) s1ap_delete(sock_id sock); +void s1ap_server(ogs_socknode_t *snode, int type); +void s1ap_closesocket(ogs_sock_t *sock); +void s1ap_delete(ogs_socknode_t *snode); +void s1ap_recv_handler(short when, ogs_socket_t fd, void *data); -CORE_DECLARE(int) s1ap_recv_handler(sock_id sock, void *data); +int s1ap_send(ogs_sock_t *sock, + ogs_pkbuf_t *pkbuf, ogs_sockaddr_t *addr, uint16_t stream_no); +int s1ap_recv(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf); -CORE_DECLARE(status_t) s1ap_send(sock_id sock, - pkbuf_t *pkbuf, c_sockaddr_t *addr, c_uint16_t stream_no); -CORE_DECLARE(status_t) s1ap_recv(sock_id id, pkbuf_t *pkbuf); - -CORE_DECLARE(status_t) s1ap_send_to_enb( - mme_enb_t *enb, pkbuf_t *pkb, c_uint16_t stream_no); -CORE_DECLARE(status_t) s1ap_send_to_enb_ue(enb_ue_t *enb_ue, pkbuf_t *pkbuf); -CORE_DECLARE(status_t) s1ap_delayed_send_to_enb_ue(enb_ue_t *enb_ue, - pkbuf_t *pkbuf, c_uint32_t duration); -CORE_DECLARE(status_t) s1ap_send_to_nas(enb_ue_t *enb_ue, +int s1ap_send_to_enb( + mme_enb_t *enb, ogs_pkbuf_t *pkb, uint16_t stream_no); +int s1ap_send_to_enb_ue(enb_ue_t *enb_ue, ogs_pkbuf_t *pkbuf); +int s1ap_delayed_send_to_enb_ue(enb_ue_t *enb_ue, + ogs_pkbuf_t *pkbuf, ogs_time_t duration); +int s1ap_send_to_nas(enb_ue_t *enb_ue, S1AP_ProcedureCode_t procedureCode, S1AP_NAS_PDU_t *nasPdu); -CORE_DECLARE(status_t) s1ap_send_to_esm(mme_ue_t *mme_ue, pkbuf_t *esmbuf); +int s1ap_send_to_esm(mme_ue_t *mme_ue, ogs_pkbuf_t *esmbuf); -CORE_DECLARE(status_t) s1ap_send_initial_context_setup_request( +int s1ap_send_initial_context_setup_request( mme_ue_t *mme_ue); -CORE_DECLARE(status_t) s1ap_send_ue_context_release_command( +int s1ap_send_ue_context_release_command( enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause, - c_uint8_t action, c_uint32_t delay); + uint8_t action, uint32_t delay); -CORE_DECLARE(status_t) s1ap_send_mme_configuration_transfer( +int s1ap_send_mme_configuration_transfer( mme_enb_t *target_enb, S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer); -CORE_DECLARE(status_t) s1ap_send_path_switch_ack(mme_ue_t *mme_ue); +int s1ap_send_path_switch_ack(mme_ue_t *mme_ue); -CORE_DECLARE(status_t) s1ap_send_handover_command(enb_ue_t *source_ue); -CORE_DECLARE(status_t) s1ap_send_handover_preparation_failure( +int s1ap_send_handover_command(enb_ue_t *source_ue); +int s1ap_send_handover_preparation_failure( enb_ue_t *source_ue, S1AP_Cause_t *cause); -CORE_DECLARE(status_t) s1ap_send_handover_request( +int s1ap_send_handover_request( mme_ue_t *mme_ue, mme_enb_t *target_enb, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, @@ -62,18 +60,18 @@ CORE_DECLARE(status_t) s1ap_send_handover_request( S1AP_Source_ToTarget_TransparentContainer_t *source_totarget_transparentContainer); -CORE_DECLARE(status_t) s1ap_send_handover_cancel_ack(enb_ue_t *source_ue); +int s1ap_send_handover_cancel_ack(enb_ue_t *source_ue); -CORE_DECLARE(status_t) s1ap_send_mme_status_transfer( +int s1ap_send_mme_status_transfer( enb_ue_t *target_ue, S1AP_ENB_StatusTransfer_TransparentContainer_t *enb_statustransfer_transparentContainer); -CORE_DECLARE(status_t) s1ap_send_error_indication( +int s1ap_send_error_indication( mme_enb_t *enb, S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id, S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id, S1AP_Cause_PR group, long cause); -CORE_DECLARE(status_t) s1ap_send_s1_reset_ack( +int s1ap_send_s1_reset_ack( mme_enb_t *enb, S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface); diff --git a/src/mme/s1ap_sctp.c b/src/mme/s1ap_sctp.c deleted file mode 100644 index 282456a6a..000000000 --- a/src/mme/s1ap_sctp.c +++ /dev/null @@ -1,310 +0,0 @@ -#define TRACE_MODULE _s1ap_sctp - -#include "core_debug.h" -#include "core_thread.h" - -#if HAVE_NETINET_SCTP_H -#include -#endif - -#include "mme_event.h" - -#include "s1ap_path.h" - -static int s1ap_accept_handler(sock_id sock, void *data); - -status_t s1ap_init(int sctp_streams, c_uint16_t port) -{ - sctp_set_num_ostreams(sctp_streams); - return CORE_OK; -} - -status_t s1ap_final() -{ - return CORE_OK; -} - -status_t s1ap_server(sock_node_t *snode, int type) -{ - status_t rv; - char buf[CORE_ADDRSTRLEN]; - - d_assert(snode, return CORE_ERROR,); - - rv = sctp_server(&snode->sock, type, snode->list); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - rv = sock_register(snode->sock, s1ap_accept_handler, NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - d_trace(1, "s1ap_server() [%s]:%d\n", - CORE_ADDR(snode->list, buf), CORE_PORT(snode->list)); - - return CORE_OK; -} - -status_t s1ap_delete(sock_id sock) -{ - d_assert(sock, return CORE_ERROR,); - return sock_delete(sock); -} - -status_t s1ap_send(sock_id sock, pkbuf_t *pkbuf, - c_sockaddr_t *addr, c_uint16_t stream_no) -{ - int sent; - - d_assert(sock, return CORE_ERROR,); - d_assert(pkbuf, return CORE_ERROR,); - - sent = core_sctp_sendmsg(sock, pkbuf->payload, pkbuf->len, - addr, SCTP_S1AP_PPID, stream_no); - d_trace(50, "[S1AP] SEND[%d] : ", sent); - d_trace_hex(50, pkbuf->payload, pkbuf->len); - if (sent < 0 || sent != pkbuf->len) - { - d_error("core_sctp_sendmsg error (%d:%s)", errno, strerror(errno)); - return CORE_ERROR; - } - pkbuf_free(pkbuf); - - return CORE_OK; -} - -status_t s1ap_recv(sock_id id, pkbuf_t *pkbuf) -{ - int size; - - size = core_sctp_recvdata(id, pkbuf->payload, MAX_SDU_LEN, NULL, NULL); - if (size <= 0) - { - d_error("s1ap_recv() failed"); - return CORE_ERROR; - } - - pkbuf->len = size; - return CORE_OK;; -} - -static int s1ap_accept_handler(sock_id id, void *data) -{ - char buf[CORE_ADDRSTRLEN]; - status_t rv; - sock_id new; - - d_assert(id, return -1, "Null param"); - - rv = sock_accept(&new, id); - if (rv == CORE_OK) - { - c_sockaddr_t *addr = NULL; - event_t e; - - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, return -1,); - memcpy(addr, sock_remote_addr(new), sizeof(c_sockaddr_t)); - - d_trace(1, "eNB-S1 accepted[%s]:%d in s1_path module\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - - event_set(&e, MME_EVT_S1AP_LO_ACCEPT); - event_set_param1(&e, (c_uintptr_t)new); - event_set_param2(&e, (c_uintptr_t)addr); - if (mme_event_send(&e) != CORE_OK) - { - CORE_FREE(addr); - } - - return 0; - } - else - { - d_error("sock accept failed(%d:%s)", errno, strerror(errno)); - - return -1; - } -} - -int s1ap_recv_handler(sock_id sock, void *data) -{ - pkbuf_t *pkbuf; - int size; - event_t e; - c_sockaddr_t *addr = NULL; - sctp_info_t sinfo; - int flags = 0; - - d_assert(sock, return -1, "Null param"); - - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (pkbuf == NULL) - { - char tmp_buf[MAX_SDU_LEN]; - - d_fatal("Can't allocate pkbuf"); - - /* Read data from socket to exit from select */ - core_recv(sock, tmp_buf, MAX_SDU_LEN, 0); - - return -1; - } - - size = core_sctp_recvmsg( - sock, pkbuf->payload, pkbuf->len, NULL, &sinfo, &flags); - if (size < 0) - { - d_error("core_sctp_recvmsg(%d) failed(%d:%s)", - size, errno, strerror(errno)); - return size; - } - - if (flags & MSG_NOTIFICATION) - { - union sctp_notification *not = - (union sctp_notification *)pkbuf->payload; - - switch(not->sn_header.sn_type) - { - case SCTP_ASSOC_CHANGE : - { - d_trace(5, "SCTP_ASSOC_CHANGE:" - "[T:%d, F:0x%x, S:%d, I/O:%d/%d]\n", - not->sn_assoc_change.sac_type, - not->sn_assoc_change.sac_flags, - not->sn_assoc_change.sac_state, - not->sn_assoc_change.sac_inbound_streams, - not->sn_assoc_change.sac_outbound_streams); - - if (not->sn_assoc_change.sac_state == SCTP_COMM_UP) - { - d_trace(5, "SCTP_COMM_UP\n"); - - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, pkbuf_free(pkbuf); return -1,); - memcpy(addr, sock_remote_addr(sock), sizeof(c_sockaddr_t)); - - event_set(&e, MME_EVT_S1AP_LO_SCTP_COMM_UP); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - event_set_param3(&e, - (c_uintptr_t)not->sn_assoc_change.sac_inbound_streams); - event_set_param4(&e, - (c_uintptr_t)not->sn_assoc_change.sac_outbound_streams); - - if (mme_event_send(&e) != CORE_OK) - { - d_error("Event MME_EVT_S1AP_LO_SCTP_COMM_UP failed"); - CORE_FREE(addr); - } - } - else if (not->sn_assoc_change.sac_state == SCTP_SHUTDOWN_COMP || - not->sn_assoc_change.sac_state == SCTP_COMM_LOST) - { - - if (not->sn_assoc_change.sac_state == SCTP_SHUTDOWN_COMP) - d_trace(5, "SCTP_SHUTDOWN_COMP\n"); - if (not->sn_assoc_change.sac_state == SCTP_COMM_LOST) - d_trace(5, "SCTP_COMM_LOST\n"); - - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, pkbuf_free(pkbuf); return -1,); - memcpy(addr, sock_remote_addr(sock), sizeof(c_sockaddr_t)); - - event_set(&e, MME_EVT_S1AP_LO_CONNREFUSED); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - - if (mme_event_send(&e) != CORE_OK) - { - d_error("Event MME_EVT_S1AP_LO_CONNREFUSED failed"); - CORE_FREE(addr); - } - - sock_delete(sock); - } - break; - } - case SCTP_SHUTDOWN_EVENT : - { - d_trace(5, "SCTP_SHUTDOWN_EVENT:[T:%d, F:0x%x, L:%d]\n", - not->sn_shutdown_event.sse_type, - not->sn_shutdown_event.sse_flags, - not->sn_shutdown_event.sse_length); - - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, pkbuf_free(pkbuf); return -1,); - memcpy(addr, sock_remote_addr(sock), sizeof(c_sockaddr_t)); - - event_set(&e, MME_EVT_S1AP_LO_CONNREFUSED); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - - if (mme_event_send(&e) != CORE_OK) - { - d_error("Event MME_EVT_S1AP_LO_CONNREFUSED failed"); - CORE_FREE(addr); - } - - sock_delete(sock); - break; - } - case SCTP_PEER_ADDR_CHANGE: - { - d_warn("SCTP_PEER_ADDR_CHANGE:[T:%d, F:0x%x, S:%d]\n", - not->sn_paddr_change.spc_type, - not->sn_paddr_change.spc_flags, - not->sn_paddr_change.spc_error); - break; - } - case SCTP_REMOTE_ERROR: - { - d_warn("SCTP_REMOTE_ERROR:[T:%d, F:0x%x, S:%d]\n", - not->sn_remote_error.sre_type, - not->sn_remote_error.sre_flags, - not->sn_remote_error.sre_error); - break; - } - case SCTP_SEND_FAILED : - { - d_error("SCTP_SEND_FAILED:[T:%d, F:0x%x, S:%d]\n", - not->sn_send_failed.ssf_type, - not->sn_send_failed.ssf_flags, - not->sn_send_failed.ssf_error); - break; - } - default : - { - d_error("Discarding event with unknown flags:0x%x type:0x%x", - flags, not->sn_header.sn_type); - break; - } - } - } - else if (flags & MSG_EOR) - { - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, pkbuf_free(pkbuf); return -1,); - memcpy(addr, sock_remote_addr(sock), sizeof(c_sockaddr_t)); - - event_set(&e, MME_EVT_S1AP_MESSAGE); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - event_set_param3(&e, (c_uintptr_t)pkbuf); - if (mme_event_send(&e) != CORE_OK) - { - d_error("Event MME_EVT_S1AP_MESSAGE failed"); - pkbuf_free(pkbuf); - CORE_FREE(addr); - } - - return 0; - } - else - { - d_assert(0, pkbuf_free(pkbuf); return -1, - "Unknown flags : 0x%x", flags); - } - - pkbuf_free(pkbuf); - return 0; -} diff --git a/src/mme/s1ap_sm.c b/src/mme/s1ap_sm.c index a47fc8f9c..d21858eb0 100644 --- a/src/mme/s1ap_sm.c +++ b/src/mme/s1ap_sm.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _s1ap_sm - -#include "core_debug.h" - #include "nas/nas_message.h" #include "gtp/gtp_message.h" @@ -11,48 +7,49 @@ #include "mme_event.h" #include "mme_sm.h" -void s1ap_state_initial(fsm_t *s, event_t *e) +void s1ap_state_initial(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); + ogs_assert(s); - mme_sm_trace(3, e); + mme_sm_debug(e); - FSM_TRAN(s, &s1ap_state_operational); + OGS_FSM_TRAN(s, &s1ap_state_operational); } -void s1ap_state_final(fsm_t *s, event_t *e) +void s1ap_state_final(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); + ogs_assert(s); - mme_sm_trace(3, e); + mme_sm_debug(e); } -void s1ap_state_operational(fsm_t *s, event_t *e) +void s1ap_state_operational(ogs_fsm_t *s, mme_event_t *e) { mme_enb_t *enb = NULL; - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + ogs_assert(e); + mme_sm_debug(e); - enb = mme_enb_find(event_get_param1(e)); - d_assert(enb, return,); + enb = e->enb; + ogs_assert(enb); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } case MME_EVT_S1AP_MESSAGE: { - S1AP_S1AP_PDU_t *pdu = (S1AP_S1AP_PDU_t *)event_get_param4(e); - d_assert(pdu, break, "Null param"); + S1AP_S1AP_PDU_t *pdu = e->s1ap_message; + ogs_assert(pdu); switch(pdu->present) { @@ -60,7 +57,7 @@ void s1ap_state_operational(fsm_t *s, event_t *e) { S1AP_InitiatingMessage_t *initiatingMessage = pdu->choice.initiatingMessage; - d_assert(initiatingMessage, break, "Null param"); + ogs_assert(initiatingMessage); switch(initiatingMessage->procedureCode) { @@ -98,8 +95,8 @@ void s1ap_state_operational(fsm_t *s, event_t *e) } case S1AP_ProcedureCode_id_eNBConfigurationTransfer: { - pkbuf_t *pkbuf = (pkbuf_t *)event_get_param3(e); - d_assert(pkbuf, break, "Null param"); + ogs_pkbuf_t *pkbuf = e->pkbuf; + ogs_assert(pkbuf); s1ap_handle_enb_configuration_transfer( enb, pdu, pkbuf); @@ -132,9 +129,9 @@ void s1ap_state_operational(fsm_t *s, event_t *e) } default: { - d_warn("Not implemented(choice:%d, proc:%d)", + ogs_warn("Not implemented(choice:%d, proc:%d)", pdu->present, - initiatingMessage->procedureCode); + (int)initiatingMessage->procedureCode); break; } } @@ -145,7 +142,7 @@ void s1ap_state_operational(fsm_t *s, event_t *e) { S1AP_SuccessfulOutcome_t *successfulOutcome = pdu->choice.successfulOutcome; - d_assert(successfulOutcome, break, "Null param"); + ogs_assert(successfulOutcome); switch(successfulOutcome->procedureCode) { @@ -191,9 +188,9 @@ void s1ap_state_operational(fsm_t *s, event_t *e) } default: { - d_warn("Not implemented(choice:%d, proc:%d)", + ogs_warn("Not implemented(choice:%d, proc:%d)", pdu->present, - successfulOutcome->procedureCode); + (int)successfulOutcome->procedureCode); break; } } @@ -203,7 +200,7 @@ void s1ap_state_operational(fsm_t *s, event_t *e) { S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = pdu->choice.unsuccessfulOutcome; - d_assert(unsuccessfulOutcome, break, "Null param"); + ogs_assert(unsuccessfulOutcome); switch(unsuccessfulOutcome->procedureCode) { @@ -220,9 +217,9 @@ void s1ap_state_operational(fsm_t *s, event_t *e) } default: { - d_warn("Not implemented(choice:%d, proc:%d)", + ogs_warn("Not implemented(choice:%d, proc:%d)", pdu->present, - unsuccessfulOutcome->procedureCode); + (int)unsuccessfulOutcome->procedureCode); break; } } @@ -230,7 +227,7 @@ void s1ap_state_operational(fsm_t *s, event_t *e) } default: { - d_warn("Not implemented(choice:%d)", pdu->present); + ogs_warn("Not implemented(choice:%d)", pdu->present); break; } } @@ -239,32 +236,32 @@ void s1ap_state_operational(fsm_t *s, event_t *e) } default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } } -void s1ap_state_exception(fsm_t *s, event_t *e) +void s1ap_state_exception(ogs_fsm_t *s, mme_event_t *e) { - d_assert(s, return, "Null param"); - d_assert(e, return, "Null param"); + ogs_assert(s); + ogs_assert(e); - mme_sm_trace(3, e); + mme_sm_debug(e); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { break; } default: { - d_error("Unknown event %s", mme_event_get_name(e)); + ogs_error("Unknown event %s", mme_event_get_name(e)); break; } } diff --git a/src/mme/s1ap_usrsctp.c b/src/mme/s1ap_usrsctp.c index 986efe929..8b7345a5c 100644 --- a/src/mme/s1ap_usrsctp.c +++ b/src/mme/s1ap_usrsctp.c @@ -1,7 +1,4 @@ -#define TRACE_MODULE _s1ap_sctp - -#include "core_debug.h" -#include "core_thread.h" +#include "ogs-sctp.h" #include "mme_event.h" @@ -11,7 +8,7 @@ #include #endif -#if HAVE_USRSCTP_H +#if HAVE_USRSCTP #ifndef INET #define INET 1 #endif @@ -21,25 +18,24 @@ #include #endif -static status_t s1ap_usrsctp_socket(sock_id *new, - int family, int type, +static ogs_sock_t *s1ap_usrsctp_socket(int family, int type, int (*receive_cb)(struct socket *sock, union sctp_sockstore addr, void *data, size_t datalen, struct sctp_rcvinfo, int flags, void *ulp_info)); -static status_t s1ap_usrsctp_bind(sock_id id, c_sockaddr_t *sa); -static status_t s1ap_usrsctp_connect(sock_id id, c_sockaddr_t *sa); -static status_t s1ap_usrsctp_listen(sock_id id); +static int s1ap_usrsctp_bind(ogs_sock_t *sock, ogs_sockaddr_t *sa); +static int s1ap_usrsctp_connect(ogs_sock_t *sock, ogs_sockaddr_t *sa); +static int s1ap_usrsctp_listen(ogs_sock_t *sock); static int s1ap_usrsctp_recv_handler(struct socket *sock, union sctp_sockstore addr, void *data, size_t datalen, struct sctp_rcvinfo rcv, int flags, void *ulp_info); -static c_sockaddr_t *usrsctp_remote_addr(union sctp_sockstore *store); +static ogs_sockaddr_t *usrsctp_remote_addr(union sctp_sockstore *store); static void debug_printf(const char *format, ...); static int sctp_num_ostreams = -1; -status_t s1ap_init(int sctp_streams, c_uint16_t port) +int s1ap_init(int sctp_streams, uint16_t port) { usrsctp_init(port, NULL, debug_printf); #ifdef SCTP_DEBUG @@ -49,64 +45,66 @@ status_t s1ap_init(int sctp_streams, c_uint16_t port) usrsctp_sysctl_set_sctp_enable_sack_immediately(1); sctp_num_ostreams = sctp_streams; - return CORE_OK; + return OGS_OK; } -status_t s1ap_final() +int s1ap_final() { while(usrsctp_finish() != 0) { - d_error("try to finsih SCTP\n"); - core_sleep(time_from_msec(1000)); + ogs_error("try to finsih SCTP"); + ogs_msleep(1000); } - return CORE_OK; + return OGS_OK; } -status_t s1ap_delete(sock_id sock) +void s1ap_server(ogs_socknode_t *snode, int type) { - d_assert(sock, return CORE_ERROR,); + char buf[OGS_ADDRSTRLEN]; + + ogs_assert(snode); + + snode->sock = ogs_sctp_server(type, snode->list); + ogs_assert(snode->sock); + + ogs_info("s1ap_server() [%s]:%d", + OGS_ADDR(snode->list, buf), OGS_PORT(snode->list)); +} + +void s1ap_closesocket(ogs_sock_t *sock) +{ + ogs_assert(sock); usrsctp_close((struct socket *)sock); - return CORE_OK; } -status_t s1ap_server(sock_node_t *snode, int type) +void s1ap_delete(ogs_socknode_t *snode) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; - - d_assert(snode, return CORE_ERROR,); - - rv = sctp_server(&snode->sock, type, snode->list); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - d_trace(1, "s1ap_server() [%s]:%d\n", - CORE_ADDR(snode->list, buf), CORE_PORT(snode->list)); - - return CORE_OK; + ogs_assert(snode); + s1ap_closesocket(snode->sock); } -status_t sctp_server(sock_id *new, int type, c_sockaddr_t *sa_list) +ogs_sock_t *ogs_sctp_server(int type, ogs_sockaddr_t *sa_list) { - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *addr = NULL; addr = sa_list; while(addr) { - rv = s1ap_usrsctp_socket(new, + sock = s1ap_usrsctp_socket( addr->c_sa_family, type, s1ap_usrsctp_recv_handler); - if (rv == CORE_OK) + if (sock) { - if (s1ap_usrsctp_bind(*new, addr) == CORE_OK) + if (s1ap_usrsctp_bind(sock, addr) == OGS_OK) { - d_trace(9, "sctp_server [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); + ogs_trace("sctp_server [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); break; } - rv = s1ap_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); + s1ap_closesocket(sock); } addr = addr->next; @@ -114,38 +112,37 @@ status_t sctp_server(sock_id *new, int type, c_sockaddr_t *sa_list) if (addr == NULL) { - d_error("sctp_server [%s]:%d failed", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - return CORE_ERROR; + ogs_error("sctp_server [%s]:%d failed", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + return NULL; } - rv = s1ap_usrsctp_listen(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = s1ap_usrsctp_listen(sock); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return sock; } -status_t sctp_client(sock_id *new, int type, c_sockaddr_t *sa_list) +ogs_sock_t *ogs_sctp_client(int type, ogs_sockaddr_t *sa_list) { - status_t rv; - c_sockaddr_t *addr; - char buf[CORE_ADDRSTRLEN]; + ogs_sock_t *sock = NULL; + ogs_sockaddr_t *addr = NULL; + char buf[OGS_ADDRSTRLEN]; addr = sa_list; while(addr) { - rv = s1ap_usrsctp_socket(new, addr->c_sa_family, type, NULL); - if (rv == CORE_OK) + sock = s1ap_usrsctp_socket(addr->c_sa_family, type, NULL); + if (sock) { - if (s1ap_usrsctp_connect(*new, addr) == CORE_OK) + if (s1ap_usrsctp_connect(sock, addr) == OGS_OK) { - d_trace(9, "sctp_client [%s]:%d\n", - CORE_ADDR(addr, buf), CORE_PORT(addr)); + ogs_trace("sctp_client [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); break; } - rv = s1ap_delete(*new); - d_assert(rv == CORE_OK, return CORE_ERROR,); + s1ap_closesocket(sock); } addr = addr->next; @@ -153,48 +150,46 @@ status_t sctp_client(sock_id *new, int type, c_sockaddr_t *sa_list) if (addr == NULL) { - d_error("sctp_client [%s]:%d failed", - CORE_ADDR(addr, buf), CORE_PORT(addr)); - return CORE_ERROR; + ogs_error("sctp_client [%s]:%d failed", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + return NULL; } - return CORE_OK; + return sock; } -status_t s1ap_send(sock_id id, pkbuf_t *pkbuf, - c_sockaddr_t *addr, c_uint16_t stream_no) +int s1ap_send(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf, + ogs_sockaddr_t *addr, uint16_t stream_no) { ssize_t sent; - struct socket *sock = (struct socket *)id; + struct socket *socket = (struct socket *)sock; struct sctp_sndinfo sndinfo; - d_assert(id, return CORE_ERROR, "Null param"); - d_assert(pkbuf, return CORE_ERROR, "Null param"); + ogs_assert(socket); + ogs_assert(pkbuf); memset((void *)&sndinfo, 0, sizeof(struct sctp_sndinfo)); sndinfo.snd_ppid = htonl(SCTP_S1AP_PPID); sndinfo.snd_sid = stream_no; - sent = usrsctp_sendv(sock, pkbuf->payload, pkbuf->len, + sent = usrsctp_sendv(socket, pkbuf->data, pkbuf->len, addr ? &addr->sa : NULL, addr ? 1 : 0, (void *)&sndinfo, (socklen_t)sizeof(struct sctp_sndinfo), SCTP_SENDV_SNDINFO, 0); - d_trace(50, "[S1AP] SEND[%d] : ", sent); - d_trace_hex(50, pkbuf->payload, pkbuf->len); if (sent < 0 || sent != pkbuf->len) { - d_error("sent : %d, pkbuf->len : %d\n", sent, pkbuf->len); - return CORE_ERROR; + ogs_error("sent : %d, pkbuf->len : %d", (int)sent, pkbuf->len); + return OGS_ERROR; } - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); - return CORE_OK; + return OGS_OK; } -status_t s1ap_recv(sock_id id, pkbuf_t *pkbuf) +int s1ap_recv(ogs_sock_t *sock, ogs_pkbuf_t *pkbuf) { - struct socket *sock = (struct socket *)id; - c_sockaddr_t addr; + struct socket *socket = (struct socket *)sock; + ogs_sockaddr_t addr; ssize_t n = 0; int flags = 0; socklen_t from_len; @@ -204,7 +199,7 @@ status_t s1ap_recv(sock_id id, pkbuf_t *pkbuf) while(1) { - n = usrsctp_recvv(sock, pkbuf->payload, MAX_SDU_LEN, + n = usrsctp_recvv(socket, pkbuf->data, MAX_SDU_LEN, &addr.sa, &from_len, (void *)&rcv_info, &infolen, &infotype, &flags); if (n > 0) @@ -222,20 +217,19 @@ status_t s1ap_recv(sock_id id, pkbuf_t *pkbuf) } } - pkbuf->len = n; - return CORE_OK; + ogs_pkbuf_trim(pkbuf, n); + return OGS_OK; } -static status_t s1ap_usrsctp_socket(sock_id *new, - int family, int type, +static ogs_sock_t *s1ap_usrsctp_socket(int family, int type, int (*receive_cb)(struct socket *sock, union sctp_sockstore store, void *data, size_t datalen, struct sctp_rcvinfo, int flags, void *ulp_info)) { - struct socket *sock = NULL; + struct socket *socket = NULL; const int on = 1; struct sctp_event event; - c_uint16_t event_types[] = { + uint16_t event_types[] = { SCTP_ASSOC_CHANGE, SCTP_PEER_ADDR_CHANGE, SCTP_REMOTE_ERROR, @@ -247,44 +241,44 @@ static status_t s1ap_usrsctp_socket(sock_id *new, socklen_t socklen; int i; - if (!(sock = usrsctp_socket(family, type, IPPROTO_SCTP, + if (!(socket = usrsctp_socket(family, type, IPPROTO_SCTP, receive_cb, NULL, 0, NULL))) { - d_error("usrsctp_socket failed"); - return CORE_ERROR; + ogs_error("usrsctp_socket failed"); + return NULL; } - if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_RECVRCVINFO, + if (usrsctp_setsockopt(socket, IPPROTO_SCTP, SCTP_RECVRCVINFO, &on, sizeof(int)) < 0) { - d_error("usrsctp_setsockopt SCTP_RECVRCVINFO failed"); - return CORE_ERROR; + ogs_error("usrsctp_setsockopt SCTP_RECVRCVINFO failed"); + return NULL; } memset(&event, 0, sizeof(event)); event.se_assoc_id = SCTP_FUTURE_ASSOC; event.se_on = 1; - for (i = 0; i < (int)(sizeof(event_types)/sizeof(c_uint16_t)); i++) + for (i = 0; i < (int)(sizeof(event_types)/sizeof(uint16_t)); i++) { event.se_type = event_types[i]; - if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_EVENT, + if (usrsctp_setsockopt(socket, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(struct sctp_event)) < 0) { - d_error("usrsctp_setsockopt SCTP_EVENT failed"); - return CORE_ERROR; + ogs_error("usrsctp_setsockopt SCTP_EVENT failed"); + return NULL; } } memset(&initmsg, 0, sizeof(struct sctp_initmsg)); socklen = sizeof(struct sctp_initmsg); - if (usrsctp_getsockopt(sock, IPPROTO_SCTP, SCTP_INITMSG, &initmsg, &socklen) != 0) + if (usrsctp_getsockopt(socket, IPPROTO_SCTP, SCTP_INITMSG, &initmsg, &socklen) != 0) { - d_error("getsockopt for SCTP_INITMSG failed(%d:%s)", + ogs_error("getsockopt for SCTP_INITMSG failed(%d:%s)", errno, strerror( errno )); - return CORE_ERROR; + return NULL; } - d_trace(3, "Old INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)\n", + ogs_debug("Old INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)", initmsg.sinit_num_ostreams, initmsg.sinit_max_instreams, initmsg.sinit_max_attempts, @@ -297,94 +291,91 @@ static status_t s1ap_usrsctp_socket(sock_id *new, * max attemtps : 4 * max initial timeout : 8 secs */ - d_assert(sctp_num_ostreams > 1, return CORE_ERROR, - "Invalid SCTP number of output streams = %d\n", sctp_num_ostreams); + ogs_assert(sctp_num_ostreams > 1); initmsg.sinit_num_ostreams = sctp_num_ostreams; initmsg.sinit_max_instreams = 65535; initmsg.sinit_max_attempts = 4; initmsg.sinit_max_init_timeo = 8000; - if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_INITMSG, + if (usrsctp_setsockopt(socket, IPPROTO_SCTP, SCTP_INITMSG, &initmsg, sizeof(initmsg)) != 0) { - d_error("setsockopt for SCTP_INITMSG failed(%d:%s)", + ogs_error("setsockopt for SCTP_INITMSG failed(%d:%s)", errno, strerror( errno )); - return CORE_ERROR; + return NULL; } - d_trace(3,"New INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)\n", + ogs_debug("New INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)", initmsg.sinit_num_ostreams, initmsg.sinit_max_instreams, initmsg.sinit_max_attempts, initmsg.sinit_max_init_timeo); - *new = (sock_id)sock; - - return CORE_OK; + return (ogs_sock_t *)socket;; } -static status_t s1ap_usrsctp_bind(sock_id id, c_sockaddr_t *sa) +static int s1ap_usrsctp_bind(ogs_sock_t *sock, ogs_sockaddr_t *sa) { - struct socket *sock = (struct socket *)id; - char buf[CORE_ADDRSTRLEN]; + struct socket *socket = (struct socket *)sock; + char buf[OGS_ADDRSTRLEN]; socklen_t addrlen; - d_assert(sock, return CORE_ERROR,); - d_assert(sa, return CORE_ERROR,); + ogs_assert(socket); + ogs_assert(sa); - addrlen = sockaddr_len(sa); - d_assert(addrlen, return CORE_ERROR,); + addrlen = ogs_sockaddr_len(sa); + ogs_assert(addrlen); - if (usrsctp_bind(sock, &sa->sa, addrlen) != 0) + if (usrsctp_bind(socket, &sa->sa, addrlen) != 0) { - d_error("usrsctp_bind [%s]:%d failed", - CORE_ADDR(sa, buf), CORE_PORT(sa)); - return CORE_ERROR; + ogs_error("usrsctp_bind [%s]:%d failed", + OGS_ADDR(sa, buf), OGS_PORT(sa)); + return OGS_ERROR; } - d_trace(9, "usrsctp_bind [%s]:%d\n", CORE_ADDR(sa, buf), CORE_PORT(sa)); + ogs_trace("usrsctp_bind [%s]:%d", OGS_ADDR(sa, buf), OGS_PORT(sa)); - return CORE_OK; + return OGS_OK; } -static status_t s1ap_usrsctp_connect(sock_id id, c_sockaddr_t *sa) +static int s1ap_usrsctp_connect(ogs_sock_t *sock, ogs_sockaddr_t *sa) { - struct socket *sock = (struct socket *)id; - char buf[CORE_ADDRSTRLEN]; + struct socket *socket = (struct socket *)sock; + char buf[OGS_ADDRSTRLEN]; socklen_t addrlen; - d_assert(sock, return CORE_ERROR,); - d_assert(sa, return CORE_ERROR,); + ogs_assert(socket); + ogs_assert(sa); - addrlen = sockaddr_len(sa); - d_assert(addrlen, return CORE_ERROR,); + addrlen = ogs_sockaddr_len(sa); + ogs_assert(addrlen); - if (usrsctp_connect(sock, &sa->sa, addrlen) != 0) + if (usrsctp_connect(socket, &sa->sa, addrlen) != 0) { - d_error("usrsctp_connect [%s]:%d", CORE_ADDR(sa, buf), CORE_PORT(sa)); - return CORE_ERROR; + ogs_error("usrsctp_connect [%s]:%d", OGS_ADDR(sa, buf), OGS_PORT(sa)); + return OGS_ERROR; } - d_trace(9, "usrsctp_connect [%s]:%d\n", CORE_ADDR(sa, buf), CORE_PORT(sa)); + ogs_trace("usrsctp_connect [%s]:%d", OGS_ADDR(sa, buf), OGS_PORT(sa)); - return CORE_OK; + return OGS_OK; } -static status_t s1ap_usrsctp_listen(sock_id id) +static int s1ap_usrsctp_listen(ogs_sock_t *sock) { int rc; - struct socket *sock = (struct socket *)id; - d_assert(sock, return CORE_ERROR,); + struct socket *socket = (struct socket *)sock; + ogs_assert(socket); - rc = usrsctp_listen(sock, 5); + rc = usrsctp_listen(socket, 5); if (rc < 0) { - d_error("usrsctp_listen failed"); - return CORE_ERROR; + ogs_error("usrsctp_listen() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } static int s1ap_usrsctp_recv_handler(struct socket *sock, @@ -393,21 +384,21 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock, { if (data) { - event_t e; + mme_event_t *e = NULL; #undef MSG_NOTIFICATION #define MSG_NOTIFICATION 0x2000 if (flags & MSG_NOTIFICATION) { union sctp_notification *not = (union sctp_notification *)data; - if (not->sn_header.sn_length == (c_uint32_t)datalen) + if (not->sn_header.sn_length == (uint32_t)datalen) { switch(not->sn_header.sn_type) { case SCTP_ASSOC_CHANGE : { - d_trace(5, "SCTP_ASSOC_CHANGE:" - "[T:%d, F:0x%x, S:%d, I/O:%d/%d]\n", + ogs_debug("SCTP_ASSOC_CHANGE:" + "[T:%d, F:0x%x, S:%d, I/O:%d/%d]", not->sn_assoc_change.sac_type, not->sn_assoc_change.sac_flags, not->sn_assoc_change.sac_state, @@ -419,71 +410,68 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock, not->sn_assoc_change.sac_state == SCTP_COMM_LOST) { - c_sockaddr_t *addr = + ogs_sockaddr_t *addr = usrsctp_remote_addr(&store); - d_assert(addr, return 1,); + ogs_assert(addr); if (not->sn_assoc_change.sac_state == SCTP_SHUTDOWN_COMP) - d_trace(5, "SCTP_SHUTDOWN_COMP\n"); + ogs_debug("SCTP_SHUTDOWN_COMP"); if (not->sn_assoc_change.sac_state == SCTP_COMM_LOST) - d_trace(5, "SCTP_COMM_LOST\n"); + ogs_debug("SCTP_COMM_LOST"); - event_set(&e, MME_EVT_S1AP_LO_CONNREFUSED); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - if (mme_event_send(&e) != CORE_OK) - { - CORE_FREE(addr); - } + e = mme_event_new(MME_EVT_S1AP_LO_CONNREFUSED); + ogs_assert(e); + e->enb_sock = (ogs_sock_t *)sock; + e->enb_addr = addr; + mme_event_send(e); + ogs_pollset_notify(mme_self()->pollset); } else if (not->sn_assoc_change.sac_state == SCTP_COMM_UP) { - c_sockaddr_t *addr = + ogs_sockaddr_t *addr = usrsctp_remote_addr(&store); - d_assert(addr, return 1,); + ogs_assert(addr); - d_trace(5, "SCTP_COMM_UP\n"); + ogs_debug("SCTP_COMM_UP"); - event_set(&e, MME_EVT_S1AP_LO_SCTP_COMM_UP); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - event_set_param3(&e, (c_uintptr_t) - not->sn_assoc_change.sac_inbound_streams); - event_set_param4(&e, (c_uintptr_t) - not->sn_assoc_change.sac_outbound_streams); - if (mme_event_send(&e) != CORE_OK) - { - CORE_FREE(addr); - } + e = mme_event_new(MME_EVT_S1AP_LO_SCTP_COMM_UP); + ogs_assert(e); + e->enb_sock = (ogs_sock_t *)sock; + e->enb_addr = addr; + e->inbound_streams = + not->sn_assoc_change.sac_inbound_streams; + e->outbound_streams = + not->sn_assoc_change.sac_outbound_streams; + mme_event_send(e); + ogs_pollset_notify(mme_self()->pollset); } break; } case SCTP_SHUTDOWN_EVENT : { - c_sockaddr_t *addr = usrsctp_remote_addr(&store); - d_assert(addr, return 1,); + ogs_sockaddr_t *addr = usrsctp_remote_addr(&store); + ogs_assert(addr); - d_trace(5, "SCTP_SHUTDOWN_EVENT:" - "[T:0x%x, F:0x%x, L:0x%x]\n", + ogs_debug("SCTP_SHUTDOWN_EVENT:" + "[T:0x%x, F:0x%x, L:0x%x]", not->sn_shutdown_event.sse_type, not->sn_shutdown_event.sse_flags, not->sn_shutdown_event.sse_length); - event_set(&e, MME_EVT_S1AP_LO_CONNREFUSED); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - if (mme_event_send(&e) != CORE_OK) - { - CORE_FREE(addr); - } + e = mme_event_new(MME_EVT_S1AP_LO_CONNREFUSED); + ogs_assert(e); + e->enb_sock = (ogs_sock_t *)sock; + e->enb_addr = addr; + mme_event_send(e); + ogs_pollset_notify(mme_self()->pollset); break; } case SCTP_PEER_ADDR_CHANGE: { - d_warn("SCTP_PEER_ADDR_CHANGE:" - "[T:%d, F:0x%x, S:%d]\n", + ogs_warn("SCTP_PEER_ADDR_CHANGE:" + "[T:%d, F:0x%x, S:%d]", not->sn_paddr_change.spc_type, not->sn_paddr_change.spc_flags, not->sn_paddr_change.spc_error); @@ -491,7 +479,7 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock, } case SCTP_REMOTE_ERROR: { - d_warn("SCTP_REMOTE_ERROR:[T:%d, F:0x%x, S:%d]\n", + ogs_warn("SCTP_REMOTE_ERROR:[T:%d, F:0x%x, S:%d]", not->sn_remote_error.sre_type, not->sn_remote_error.sre_flags, not->sn_remote_error.sre_error); @@ -499,14 +487,14 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock, } case SCTP_SEND_FAILED : { - d_error("SCTP_SEND_FAILED:[T:%d, F:0x%x, S:%d]\n", + ogs_error("SCTP_SEND_FAILED:[T:%d, F:0x%x, S:%d]", not->sn_send_failed_event.ssfe_type, not->sn_send_failed_event.ssfe_flags, not->sn_send_failed_event.ssfe_error); break; } default : - d_error("Discarding event with " + ogs_error("Discarding event with " "unknown flags:0x%x type:0x%x", flags, not->sn_header.sn_type); break; @@ -515,47 +503,40 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock, } else if (flags & MSG_EOR) { - pkbuf_t *pkbuf; - c_sockaddr_t *addr = NULL; + ogs_pkbuf_t *pkbuf; + ogs_sockaddr_t *addr = NULL; + + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(pkbuf, data, datalen); - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - d_assert(pkbuf, return 1, ); addr = usrsctp_remote_addr(&store); - d_assert(addr, return 1,); + ogs_assert(addr); - pkbuf->len = datalen; - memcpy(pkbuf->payload, data, pkbuf->len); - - d_trace(50, "[S1AP] RECV : "); - d_trace_hex(50, pkbuf->payload, pkbuf->len); - - event_set(&e, MME_EVT_S1AP_MESSAGE); - event_set_param1(&e, (c_uintptr_t)sock); - event_set_param2(&e, (c_uintptr_t)addr); - event_set_param3(&e, (c_uintptr_t)pkbuf); - if (mme_event_send(&e) != CORE_OK) - { - pkbuf_free(pkbuf); - CORE_FREE(addr); - } + e = mme_event_new(MME_EVT_S1AP_MESSAGE); + ogs_assert(e); + e->enb_sock = (ogs_sock_t *)sock; + e->enb_addr = addr; + e->pkbuf = pkbuf; + mme_event_send(e); + ogs_pollset_notify(mme_self()->pollset); } else { - d_error("Not engough buffer. Need more recv : 0x%x", flags); + ogs_error("Not engough buffer. Need more recv : 0x%x", flags); } free(data); } return (1); } -static c_sockaddr_t *usrsctp_remote_addr(union sctp_sockstore *store) +static ogs_sockaddr_t *usrsctp_remote_addr(union sctp_sockstore *store) { - c_sockaddr_t *addr = NULL; + ogs_sockaddr_t *addr = NULL; - d_assert(store, return NULL,); + ogs_assert(store); - addr = core_calloc(1, sizeof(c_sockaddr_t)); - d_assert(addr, return NULL,); + addr = ogs_calloc(1, sizeof(ogs_sockaddr_t)); + ogs_assert(addr); addr->c_sa_family = store->sin.sin_family; switch(addr->c_sa_family) @@ -567,7 +548,7 @@ static c_sockaddr_t *usrsctp_remote_addr(union sctp_sockstore *store) memcpy(&addr->sin6, &store->sin6, sizeof(struct sockaddr_in6)); break; default: - d_assert(0, return NULL,); + ogs_assert_if_reached(); } return addr; diff --git a/src/mme/sbc_handler.c b/src/mme/sbc_handler.c index 309f64f06..44d4155e9 100644 --- a/src/mme/sbc_handler.c +++ b/src/mme/sbc_handler.c @@ -1,7 +1,3 @@ -#define TRACE_MODULE _sbc_handler - -#include "core_debug.h" - #include "mme_context.h" #include "s1ap_path.h" #include "s1ap_build.h" @@ -9,11 +5,11 @@ void sbc_handle_write_replace_warning_request(sbc_pws_data_t *sbc_pws) { - pkbuf_t *s1apbuf = NULL; - hash_index_t *hi = NULL; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_hash_index_t *hi = NULL; mme_enb_t *enb = NULL; int i, j, flag; - status_t rv; + int rv; /* Find enB with matched TAI */ for (hi = mme_enb_first(); hi; hi = mme_enb_next(hi)) @@ -44,24 +40,22 @@ void sbc_handle_write_replace_warning_request(sbc_pws_data_t *sbc_pws) /* Buidl S1AP Write Replace Warning Request message */ rv = s1ap_build_write_replace_warning_request(&s1apbuf, sbc_pws); - d_assert(rv == CORE_OK && s1apbuf, return, - "s1ap build error"); + ogs_assert(rv == OGS_OK); /* Send to enb */ - d_assert(s1ap_send_to_enb( - enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == CORE_OK, - return, "s1ap send error"); + ogs_assert(s1ap_send_to_enb( + enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK); } } } void sbc_handle_stop_warning_request(sbc_pws_data_t *sbc_pws) { - pkbuf_t *s1apbuf = NULL; - hash_index_t *hi = NULL; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_hash_index_t *hi = NULL; mme_enb_t *enb = NULL; int i, j, flag; - status_t rv; + int rv; /* Find enB with matched TAI */ for (hi = mme_enb_first(); hi; hi = mme_enb_next(hi)) @@ -92,13 +86,11 @@ void sbc_handle_stop_warning_request(sbc_pws_data_t *sbc_pws) /* Buidl S1AP Kill request message */ rv = s1ap_build_kill_request(&s1apbuf, sbc_pws); - d_assert(rv == CORE_OK && s1apbuf, return, - "s1ap build error"); + ogs_assert(rv == OGS_OK && s1apbuf); /* Send to enb */ - d_assert(s1ap_send_to_enb( - enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == CORE_OK, - return, "s1ap send error"); + ogs_assert(s1ap_send_to_enb( + enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK); } } } diff --git a/src/mme/sbc_handler.h b/src/mme/sbc_handler.h index c1a9b3974..6e92fc577 100644 --- a/src/mme/sbc_handler.h +++ b/src/mme/sbc_handler.h @@ -9,8 +9,8 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) sbc_handle_write_replace_warning_request(sbc_pws_data_t *sbc_pws); -CORE_DECLARE(void) sbc_handle_stop_warning_request(sbc_pws_data_t *sbc_pws); +void sbc_handle_write_replace_warning_request(sbc_pws_data_t *sbc_pws); +void sbc_handle_stop_warning_request(sbc_pws_data_t *sbc_pws); #ifdef __cplusplus } diff --git a/src/mme/sbc_message.h b/src/mme/sbc_message.h index a9db5db09..0422ad249 100644 --- a/src/mme/sbc_message.h +++ b/src/mme/sbc_message.h @@ -1,7 +1,7 @@ #ifndef __SBC_MESSAGE_H__ #define __SBC_MESSAGE_H__ -#include "3gpp_types.h" +#include "base/types.h" #ifdef __cplusplus extern "C" { @@ -16,15 +16,15 @@ extern "C" { /* SBc-AP WriteReplaceWarning data */ typedef struct _sbc_pws_data_t { - c_uint16_t message_id; - c_uint16_t serial_number; - c_uint32_t no_of_tai; + uint16_t message_id; + uint16_t serial_number; + uint32_t no_of_tai; tai_t tai[16]; /* TODO: max 65535 */ - c_uint32_t repetition_period; - c_uint32_t number_of_broadcast; - c_uint8_t data_coding_scheme; - c_uint32_t message_length; - c_uint8_t message_contents[1024]; /* TODO: max 9600 */ + uint32_t repetition_period; + uint32_t number_of_broadcast; + uint8_t data_coding_scheme; + uint32_t message_length; + uint8_t message_contents[1024]; /* TODO: max 9600 */ } sbc_pws_data_t; #ifdef __cplusplus diff --git a/src/mme/snow_3g.c b/src/mme/snow_3g.c index e188a2a14..18acd2505 100644 --- a/src/mme/snow_3g.c +++ b/src/mme/snow_3g.c @@ -2,7 +2,6 @@ * SNOW_3G.c *------------------------------------------------------------------------*/ -#include "core_pkbuf.h" #include "snow_3g.h" /* LFSR */ @@ -400,7 +399,7 @@ void snow_3g_f8(u8 *key, u32 count, u32 bearer, u32 dir, u8 *data, u32 length) /* Run SNOW 3G algorithm to generate sequence of key stream bits KS*/ snow_3g_initialize(K,IV); - KS = (u32 *)core_malloc(4*n); + KS = (u32 *)ogs_malloc(4*n); snow_3g_generate_key_stream(n,(u32*)KS); /* Exclusive-OR the input data with keystream to generate the output bit @@ -413,7 +412,7 @@ void snow_3g_f8(u8 *key, u32 count, u32 bearer, u32 dir, u8 *data, u32 length) data[4*i+3] ^= (u8) (KS[i] ) & 0xff; } - CORE_FREE(KS); + ogs_free(KS); /* zero last bits of data in case its length is not byte-aligned this is an addition to the C reference code, which did not handle it */ diff --git a/src/mme/snow_3g.h b/src/mme/snow_3g.h index c8dd0fddf..a5320bbf5 100644 --- a/src/mme/snow_3g.h +++ b/src/mme/snow_3g.h @@ -1,15 +1,15 @@ #ifndef __SNOW_3G__ #define __SNOW_3G__ -#include "core.h" +#include "ogs-core.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -typedef c_uint8_t u8; -typedef c_uint32_t u32; -typedef c_uint64_t u64; +typedef uint8_t u8; +typedef uint32_t u32; +typedef uint64_t u64; /* Initialization. * Input k[4]: Four 32-bit words making up 128-bit key. @@ -18,7 +18,7 @@ typedef c_uint64_t u64; * See Section 4.1. */ -CORE_DECLARE(void) snow_3g_initialize(u32 k[4], u32 IV[4]); +void snow_3g_initialize(u32 k[4], u32 IV[4]); /* Generation of Keystream. * input n: number of 32-bit words of keystream. @@ -28,7 +28,7 @@ CORE_DECLARE(void) snow_3g_initialize(u32 k[4], u32 IV[4]); * See section 4.2. */ -CORE_DECLARE(void) snow_3g_generate_key_stream(u32 n, u32 *z); +void snow_3g_generate_key_stream(u32 n, u32 *z); /* f8. * Input key: 128 bit Confidentiality Key. @@ -44,7 +44,7 @@ CORE_DECLARE(void) snow_3g_generate_key_stream(u32 n, u32 *z); * defined in Section 3. */ -CORE_DECLARE(void) snow_3g_f8( u8 *key, u32 count, u32 bearer, u32 dir, +void snow_3g_f8( u8 *key, u32 count, u32 bearer, u32 dir, u8 *data, u32 length ); /* f9. @@ -58,7 +58,7 @@ CORE_DECLARE(void) snow_3g_f8( u8 *key, u32 count, u32 bearer, u32 dir, * Generates 32-bit MAC using UIA2 algorithm as defined in Section 4. */ -CORE_DECLARE(void) snow_3g_f9( u8* key, u32 count, u32 fresh, u32 dir, +void snow_3g_f9( u8* key, u32 count, u32 fresh, u32 dir, u8 *data, u64 length, u8 *out); #ifdef __cplusplus diff --git a/src/mme/zuc.c b/src/mme/zuc.c index 485d8e2cb..3d9900eec 100644 --- a/src/mme/zuc.c +++ b/src/mme/zuc.c @@ -1,7 +1,6 @@ /*--------------------------------------------- * ZUC / EEA3 / EIA3 : LTE security algorithm *--------------------------------------------*/ -#include "core_pkbuf.h" #include "zuc.h" /*-------------------------------------------- @@ -286,7 +285,7 @@ void zuc_eea3(u8* CK, u32 COUNT, u32 BEARER, u32 DIRECTION, u32 lastbits = (8-(LENGTH%8))%8; L = (LENGTH+31)/32; - z = (u32 *) core_malloc(L*sizeof(u32)); + z = (u32 *) ogs_malloc(L*sizeof(u32)); L8 = (LENGTH+7)/8; @@ -323,7 +322,7 @@ void zuc_eea3(u8* CK, u32 COUNT, u32 BEARER, u32 DIRECTION, i--; C[i] &= 0x100 - (1<name = "pcrf"; + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_pcrf_main, app); - } - - d_trace(1, "PCRF try to initialize\n"); rv = pcrf_initialize(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Failed to intialize PCRF"); + ogs_error("Failed to intialize PCRF"); return rv; } - d_trace(1, "PCRF initialize...done\n"); + ogs_info("PCRF initialize...done"); rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } void app_terminate(void) { app_will_terminate(); - d_trace(1, "PCRF try to terminate\n"); + ogs_info("PCRF try to terminate"); pcrf_terminate(); - d_trace(1, "PCRF terminate...done\n"); + ogs_info("PCRF terminate...done"); app_did_terminate(); } diff --git a/src/pcrf/Makefile.am b/src/pcrf/Makefile.am index 2de43d961..e7b133cbf 100644 --- a/src/pcrf/Makefile.am +++ b/src/pcrf/Makefile.am @@ -9,16 +9,16 @@ libpcrf_la_SOURCES = \ libpcrf_la_DEPENDENCIES = \ $(top_srcdir)/lib/fd/libfd.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) libpcrf_la_LIBADD = \ $(top_srcdir)/lib/fd/libfd.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ -I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \ @@ -27,6 +27,3 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/src/pcrf/pcrf_context.c b/src/pcrf/pcrf_context.c index 04c88380e..ab439cde7 100644 --- a/src/pcrf/pcrf_context.c +++ b/src/pcrf/pcrf_context.c @@ -1,21 +1,16 @@ -#define TRACE_MODULE _pcrf_context - -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_lib.h" - #include #include -#include "common/yaml_helper.h" #include "fd/fd_lib.h" -#include "common/context.h" +#include "app/context.h" #include "pcrf_context.h" static pcrf_context_t self; static fd_config_t g_fd_conf; +int __pcrf_log_domain; + static int context_initialized = 0; pcrf_context_t* pcrf_self() @@ -23,11 +18,9 @@ pcrf_context_t* pcrf_self() return &self; } -status_t pcrf_context_init(void) +int pcrf_context_init(void) { - status_t rv; - d_assert(context_initialized == 0, return CORE_ERROR, - "PCRF context already has been context_initialized"); + ogs_assert(context_initialized == 0); /* Initial FreeDiameter Config */ memset(&g_fd_conf, 0, sizeof(fd_config_t)); @@ -36,179 +29,176 @@ status_t pcrf_context_init(void) memset(&self, 0, sizeof(pcrf_context_t)); self.fd_config = &g_fd_conf; - rv = mutex_create(&self.db_lock, MUTEX_DEFAULT); - d_assert(rv == CORE_OK, return CORE_ERROR, ); + ogs_log_install_domain(&__pcrf_log_domain, "pcrf", ogs_core()->log.level); - rv = mutex_create(&self.hash_lock, MUTEX_DEFAULT); - d_assert(rv == CORE_OK, return CORE_ERROR, ); - self.ip_hash = hash_make(); + ogs_thread_mutex_init(&self.db_lock); + + ogs_thread_mutex_init(&self.hash_lock); + self.ip_hash = ogs_hash_make(); context_initialized = 1; - return CORE_OK; + return OGS_OK; } -status_t pcrf_context_final(void) +int pcrf_context_final(void) { - d_assert(context_initialized == 1, return CORE_ERROR, - "PCRF context already has been finalized"); + ogs_assert(context_initialized == 1); + ogs_assert(self.ip_hash); + ogs_hash_destroy(self.ip_hash); + ogs_thread_mutex_destroy(&self.hash_lock); - d_assert(self.ip_hash,, ); - hash_destroy(self.ip_hash); - mutex_delete(self.hash_lock); - - mutex_delete(self.db_lock); + ogs_thread_mutex_destroy(&self.db_lock); context_initialized = 0; - return CORE_OK; + return OGS_OK; } -static status_t pcrf_context_prepare() +static int pcrf_context_prepare() { self.fd_config->cnf_port = DIAMETER_PORT; self.fd_config->cnf_port_tls = DIAMETER_SECURE_PORT; - return CORE_OK; + return OGS_OK; } -static status_t pcrf_context_validation() +static int pcrf_context_validation() { if (self.fd_conf_path == NULL && (self.fd_config->cnf_diamid == NULL || self.fd_config->cnf_diamrlm == NULL || self.fd_config->cnf_addr == NULL)) { - d_error("No pcrf.freeDiameter in '%s'", + ogs_error("No pcrf.freeDiameter in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t pcrf_context_parse_config() +int pcrf_context_parse_config() { - status_t rv; + int rv; config_t *config = &context_self()->config; yaml_document_t *document = NULL; - yaml_iter_t root_iter; + ogs_yaml_iter_t root_iter; - d_assert(config, return CORE_ERROR,); + ogs_assert(config); document = config->document; - d_assert(document, return CORE_ERROR,); + ogs_assert(document); rv = pcrf_context_prepare(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - yaml_iter_init(&root_iter, document); - while(yaml_iter_next(&root_iter)) + ogs_yaml_iter_init(&root_iter, document); + while(ogs_yaml_iter_next(&root_iter)) { - const char *root_key = yaml_iter_key(&root_iter); - d_assert(root_key, return CORE_ERROR,); + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); if (!strcmp(root_key, "pcrf")) { - yaml_iter_t pcrf_iter; - yaml_iter_recurse(&root_iter, &pcrf_iter); - while(yaml_iter_next(&pcrf_iter)) + ogs_yaml_iter_t pcrf_iter; + ogs_yaml_iter_recurse(&root_iter, &pcrf_iter); + while(ogs_yaml_iter_next(&pcrf_iter)) { - const char *pcrf_key = yaml_iter_key(&pcrf_iter); - d_assert(pcrf_key, return CORE_ERROR,); + const char *pcrf_key = ogs_yaml_iter_key(&pcrf_iter); + ogs_assert(pcrf_key); if (!strcmp(pcrf_key, "freeDiameter")) { yaml_node_t *node = yaml_document_get_node(document, pcrf_iter.pair->value); - d_assert(node, return CORE_ERROR,); + ogs_assert(node); if (node->type == YAML_SCALAR_NODE) { - self.fd_conf_path = yaml_iter_value(&pcrf_iter); + self.fd_conf_path = ogs_yaml_iter_value(&pcrf_iter); } else if (node->type == YAML_MAPPING_NODE) { - yaml_iter_t fd_iter; - yaml_iter_recurse(&pcrf_iter, &fd_iter); + ogs_yaml_iter_t fd_iter; + ogs_yaml_iter_recurse(&pcrf_iter, &fd_iter); - while(yaml_iter_next(&fd_iter)) + while(ogs_yaml_iter_next(&fd_iter)) { - const char *fd_key = yaml_iter_key(&fd_iter); - d_assert(fd_key, return CORE_ERROR,); + const char *fd_key = ogs_yaml_iter_key(&fd_iter); + ogs_assert(fd_key); if (!strcmp(fd_key, "identity")) { self.fd_config->cnf_diamid = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "realm")) { self.fd_config->cnf_diamrlm = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port = atoi(v); } else if (!strcmp(fd_key, "sec_port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port_tls = atoi(v); } else if (!strcmp(fd_key, "no_sctp")) { self.fd_config->cnf_flags.no_sctp = - yaml_iter_bool(&fd_iter); + ogs_yaml_iter_bool(&fd_iter); } else if (!strcmp(fd_key, "listen_on")) { self.fd_config->cnf_addr = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "load_extension")) { - yaml_iter_t ext_array, ext_iter; - yaml_iter_recurse(&fd_iter, &ext_array); + ogs_yaml_iter_t ext_array, ext_iter; + ogs_yaml_iter_recurse(&fd_iter, &ext_array); do { const char *module = NULL; const char *conf = NULL; - if (yaml_iter_type(&ext_array) == + if (ogs_yaml_iter_type(&ext_array) == YAML_MAPPING_NODE) { memcpy(&ext_iter, &ext_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&ext_array)) + if (!ogs_yaml_iter_next(&ext_array)) break; - yaml_iter_recurse( + ogs_yaml_iter_recurse( &ext_array, &ext_iter); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&ext_iter)) + while(ogs_yaml_iter_next(&ext_iter)) { const char *ext_key = - yaml_iter_key(&ext_iter); - d_assert(ext_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&ext_iter); + ogs_assert(ext_key); if (!strcmp(ext_key, "module")) { - module = yaml_iter_value(&ext_iter); + module = ogs_yaml_iter_value(&ext_iter); } else if (!strcmp(ext_key, "conf")) { - conf = yaml_iter_value(&ext_iter); + conf = ogs_yaml_iter_value(&ext_iter); } else - d_warn("unknown key `%s`", ext_key); + ogs_warn("unknown key `%s`", ext_key); } if (module) @@ -221,62 +211,61 @@ status_t pcrf_context_parse_config() conf = conf; self.fd_config->num_of_ext++; } - } while(yaml_iter_type(&ext_array) == + } while(ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(fd_key, "connect")) { - yaml_iter_t conn_array, conn_iter; - yaml_iter_recurse(&fd_iter, &conn_array); + ogs_yaml_iter_t conn_array, conn_iter; + ogs_yaml_iter_recurse(&fd_iter, &conn_array); do { const char *identity = NULL; const char *addr = NULL; - c_uint16_t port = 0; + uint16_t port = 0; - if (yaml_iter_type(&conn_array) == + if (ogs_yaml_iter_type(&conn_array) == YAML_MAPPING_NODE) { memcpy(&conn_iter, &conn_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&conn_array)) + if (!ogs_yaml_iter_next(&conn_array)) break; - yaml_iter_recurse(&conn_array, &conn_iter); + ogs_yaml_iter_recurse(&conn_array, &conn_iter); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&conn_iter)) + while(ogs_yaml_iter_next(&conn_iter)) { const char *conn_key = - yaml_iter_key(&conn_iter); - d_assert(conn_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&conn_iter); + ogs_assert(conn_key); if (!strcmp(conn_key, "identity")) { - identity = yaml_iter_value(&conn_iter); + identity = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "addr")) { - addr = yaml_iter_value(&conn_iter); + addr = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "port")) { const char *v = - yaml_iter_value(&conn_iter); + ogs_yaml_iter_value(&conn_iter); if (v) port = atoi(v); } else - d_warn("unknown key `%s`", conn_key); + ogs_warn("unknown key `%s`", conn_key); } if (identity && addr) @@ -292,83 +281,52 @@ status_t pcrf_context_parse_config() port = port; self.fd_config->num_of_conn++; } - } while(yaml_iter_type(&conn_array) == + } while(ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", fd_key); + ogs_warn("unknown key `%s`", fd_key); } } } else - d_warn("unknown key `%s`", pcrf_key); + ogs_warn("unknown key `%s`", pcrf_key); } } } rv = pcrf_context_validation(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } -status_t pcrf_context_setup_trace_module() +int pcrf_db_init() { - int app = context_self()->logger.trace.app; - int diameter = context_self()->logger.trace.diameter; - - if (app) - { - extern int _pcrf_context; - d_trace_level(&_pcrf_context, app); - } - - if (diameter) - { - extern int _pcrf_fd_path; - d_trace_level(&_pcrf_fd_path, diameter); - extern int _pcrf_gx_path; - d_trace_level(&_pcrf_gx_path, diameter); - extern int _pcrf_rx_path; - d_trace_level(&_pcrf_rx_path, diameter); - extern int _fd_init; - d_trace_level(&_fd_init, diameter); - extern int _fd_logger; - d_trace_level(&_fd_logger, diameter); - } - - return CORE_OK; -} - -status_t pcrf_db_init() -{ - if (context_self()->db_client && context_self()->db_name) + if (context_self()->db.client && context_self()->db.name) { self.subscriberCollection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); - d_assert(self.subscriberCollection, return CORE_ERROR, - "Couldn't find Subscriber Collection in '%s'", - context_self()->db_name); + context_self()->db.client, + context_self()->db.name, "subscribers"); + ogs_assert(self.subscriberCollection); } - return CORE_OK; + return OGS_OK; } -status_t pcrf_db_final() +int pcrf_db_final() { if (self.subscriberCollection) { mongoc_collection_destroy(self.subscriberCollection); } - return CORE_OK; + return OGS_OK; } -status_t pcrf_db_qos_data( - c_int8_t *imsi_bcd, c_int8_t *apn, gx_message_t *gx_message) +int pcrf_db_qos_data(char *imsi_bcd, char *apn, gx_message_t *gx_message) { - status_t rv = CORE_OK; + int rv = OGS_OK; mongoc_cursor_t *cursor = NULL; bson_t *query = NULL; bson_t *opts = NULL; @@ -378,13 +336,13 @@ status_t pcrf_db_qos_data( bson_iter_t child1_iter, child2_iter, child3_iter; bson_iter_t child4_iter, child5_iter, child6_iter; const char *utf8 = NULL; - c_uint32_t length = 0; + uint32_t length = 0; - d_assert(imsi_bcd, return CORE_ERROR, "Null param"); - d_assert(apn, return CORE_ERROR, "Null param"); - d_assert(gx_message, return CORE_ERROR, "Null param"); + ogs_assert(imsi_bcd); + ogs_assert(apn); + ogs_assert(gx_message); - mutex_lock(self.db_lock); + ogs_thread_mutex_lock(&self.db_lock); query = BCON_NEW( "imsi", BCON_UTF8(imsi_bcd), @@ -409,25 +367,25 @@ status_t pcrf_db_qos_data( if (!mongoc_cursor_next(cursor, &document)) { - d_error("Cannot find IMSI(%s)+APN(%s) in DB", imsi_bcd, apn); + ogs_error("Cannot find IMSI(%s)+APN(%s) in DB", imsi_bcd, apn); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } if (mongoc_cursor_error(cursor, &error)) { - d_error("Cursor Failure: %s", error.message); + ogs_error("Cursor Failure: %s", error.message); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } if (!bson_iter_init(&iter, document)) { - d_error("bson_iter_init failed in this document"); + ogs_error("bson_iter_init failed in this document"); - rv = CORE_ERROR; + rv = OGS_ERROR; goto out; } @@ -445,10 +403,9 @@ status_t pcrf_db_qos_data( const char *child1_key = bson_iter_key(&child1_iter); pdn_t *pdn = NULL; - d_assert(child1_key, goto out, "PDN is not ARRAY"); + ogs_assert(child1_key); pdn_index = atoi(child1_key); - d_assert(pdn_index == 0, goto out, - "Invalid PDN Index(%d)", pdn_index); + ogs_assert(pdn_index == 0); pdn = &gx_message->pdn; bson_iter_recurse(&child1_iter, &child2_iter); @@ -459,8 +416,8 @@ status_t pcrf_db_qos_data( BSON_ITER_HOLDS_UTF8(&child2_iter)) { utf8 = bson_iter_utf8(&child2_iter, &length); - core_cpystrn(pdn->apn, utf8, - c_min(length, MAX_APN_LEN)+1); + ogs_cpystrn(pdn->apn, utf8, + ogs_min(length, MAX_APN_LEN)+1); } else if (!strcmp(child2_key, "type") && BSON_ITER_HOLDS_INT32(&child2_iter)) @@ -546,13 +503,9 @@ status_t pcrf_db_qos_data( bson_iter_key(&child3_iter); pcc_rule_t *pcc_rule = NULL; - d_assert(child3_key, goto out, - "PCC RULE is not ARRAY"); + ogs_assert(child3_key); pcc_rule_index = atoi(child3_key); - d_assert(pcc_rule_index < MAX_NUM_OF_PCC_RULE, - goto out, - "Overflow of PCC RULE number(%d>%d)", - pcc_rule_index, MAX_NUM_OF_PCC_RULE); + ogs_assert(pcc_rule_index < MAX_NUM_OF_PCC_RULE); pcc_rule = &gx_message->pcc_rule[pcc_rule_index]; bson_iter_recurse(&child3_iter, &child4_iter); @@ -692,13 +645,10 @@ status_t pcrf_db_qos_data( bson_iter_key(&child5_iter); flow_t *flow = NULL; - d_assert(child5_key, goto out, - "FLOW is not ARRAY"); + ogs_assert(child5_key); flow_index = atoi(child5_key); - d_assert(flow_index < MAX_NUM_OF_FLOW, - goto out, - "Overflow of FLOW number(%d>%d)", - flow_index, MAX_NUM_OF_FLOW); + ogs_assert( + flow_index < MAX_NUM_OF_FLOW); flow = &pcc_rule->flow[flow_index]; bson_iter_recurse( @@ -723,8 +673,8 @@ status_t pcrf_db_qos_data( utf8 = bson_iter_utf8( &child6_iter, &length); flow->description = - core_malloc(length+1); - core_cpystrn( + ogs_malloc(length+1); + ogs_cpystrn( (char*)flow->description, utf8, length+1); } @@ -737,13 +687,13 @@ status_t pcrf_db_qos_data( /* Charing-Rule-Name is automatically configured */ if (pcc_rule->name) { - d_error("PCC Rule Name has already " + ogs_error("PCC Rule Name has already " "been defined"); - CORE_FREE(pcc_rule->name); + ogs_free(pcc_rule->name); } - pcc_rule->name = core_calloc( + pcc_rule->name = ogs_calloc( 1, MAX_PCC_RULE_NAME_LEN); - d_assert(pcc_rule->name, goto out,); + ogs_assert(pcc_rule->name); snprintf(pcc_rule->name, MAX_PCC_RULE_NAME_LEN, "%s%d", apn, pcc_rule_index+1); pcc_rule->precedence = pcc_rule_index+1; @@ -762,60 +712,60 @@ out: if (opts) bson_destroy(opts); if (cursor) mongoc_cursor_destroy(cursor); - mutex_unlock(self.db_lock); + ogs_thread_mutex_unlock(&self.db_lock); return rv; } -status_t pcrf_sess_set_ipv4(const void *key, c_uint8_t *sid) +int pcrf_sess_set_ipv4(const void *key, uint8_t *sid) { - d_assert(self.ip_hash, return CORE_ERROR,); + ogs_assert(self.ip_hash); - mutex_lock(self.hash_lock); + ogs_thread_mutex_lock(&self.hash_lock); - hash_set(self.ip_hash, key, IPV4_LEN, sid); + ogs_hash_set(self.ip_hash, key, IPV4_LEN, sid); - mutex_unlock(self.hash_lock); + ogs_thread_mutex_unlock(&self.hash_lock); - return CORE_OK; + return OGS_OK; } -status_t pcrf_sess_set_ipv6(const void *key, c_uint8_t *sid) +int pcrf_sess_set_ipv6(const void *key, uint8_t *sid) { - d_assert(self.ip_hash, return CORE_ERROR,); + ogs_assert(self.ip_hash); - mutex_lock(self.hash_lock); + ogs_thread_mutex_lock(&self.hash_lock); - hash_set(self.ip_hash, key, IPV6_LEN, sid); + ogs_hash_set(self.ip_hash, key, IPV6_LEN, sid); - mutex_unlock(self.hash_lock); + ogs_thread_mutex_unlock(&self.hash_lock); - return CORE_OK; + return OGS_OK; } -c_uint8_t *pcrf_sess_find_by_ipv4(const void *key) +uint8_t *pcrf_sess_find_by_ipv4(const void *key) { - c_uint8_t *sid = NULL; - d_assert(key, return NULL,); + uint8_t *sid = NULL; + ogs_assert(key); - mutex_lock(self.hash_lock); + ogs_thread_mutex_lock(&self.hash_lock); - sid = (c_uint8_t *)hash_get(self.ip_hash, key, IPV4_LEN); + sid = (uint8_t *)ogs_hash_get(self.ip_hash, key, IPV4_LEN); - mutex_unlock(self.hash_lock); + ogs_thread_mutex_unlock(&self.hash_lock); return sid; } -c_uint8_t *pcrf_sess_find_by_ipv6(const void *key) +uint8_t *pcrf_sess_find_by_ipv6(const void *key) { - c_uint8_t *sid = NULL; - d_assert(key, return NULL,); + uint8_t *sid = NULL; + ogs_assert(key); - mutex_lock(self.hash_lock); + ogs_thread_mutex_lock(&self.hash_lock); - sid = (c_uint8_t *)hash_get(self.ip_hash, key, IPV6_LEN); + sid = (uint8_t *)ogs_hash_get(self.ip_hash, key, IPV6_LEN); - mutex_unlock(self.hash_lock); + ogs_thread_mutex_unlock(&self.hash_lock); return sid; } diff --git a/src/pcrf/pcrf_context.h b/src/pcrf/pcrf_context.h index 769a0b20a..a43c17413 100644 --- a/src/pcrf/pcrf_context.h +++ b/src/pcrf/pcrf_context.h @@ -1,17 +1,17 @@ #ifndef __PCRF_CONTEXT_H__ #define __PCRF_CONTEXT_H__ -#include "core_errno.h" -#include "core_mutex.h" -#include "core_hash.h" - -#include "3gpp_types.h" #include "fd/gx/gx_message.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +extern int __pcrf_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __pcrf_log_domain + typedef struct _fd_config_t fd_config_t; struct session; @@ -20,29 +20,27 @@ typedef struct _pcrf_context_t { fd_config_t *fd_config; /* PCRF freeDiameter config */ void *subscriberCollection; - mutex_id db_lock; + ogs_thread_mutex_t db_lock; - hash_t *ip_hash; /* hash table for Gx Frame IPv4/IPv6 */ - mutex_id hash_lock; + ogs_hash_t *ip_hash; /* hash table for Gx Frame IPv4/IPv6 */ + ogs_thread_mutex_t hash_lock; } pcrf_context_t; -CORE_DECLARE(status_t) pcrf_context_init(void); -CORE_DECLARE(status_t) pcrf_context_final(void); -CORE_DECLARE(pcrf_context_t*) pcrf_self(void); +int pcrf_context_init(void); +int pcrf_context_final(void); +pcrf_context_t *pcrf_self(void); -CORE_DECLARE(status_t) pcrf_context_parse_config(void); -CORE_DECLARE(status_t) pcrf_context_setup_trace_module(void); +int pcrf_context_parse_config(void); -CORE_DECLARE(status_t) pcrf_db_init(void); -CORE_DECLARE(status_t) pcrf_db_final(void); +int pcrf_db_init(void); +int pcrf_db_final(void); -CORE_DECLARE(status_t) pcrf_db_qos_data( - c_int8_t *imsi_bcd, c_int8_t *apn, gx_message_t *gx_message); +int pcrf_db_qos_data(char *imsi_bcd, char *apn, gx_message_t *gx_message); -CORE_DECLARE(status_t) pcrf_sess_set_ipv4(const void *key, c_uint8_t *sid); -CORE_DECLARE(status_t) pcrf_sess_set_ipv6(const void *key, c_uint8_t *sid); -CORE_DECLARE(c_uint8_t *) pcrf_sess_find_by_ipv4(const void *key); -CORE_DECLARE(c_uint8_t *) pcrf_sess_find_by_ipv6(const void *key); +int pcrf_sess_set_ipv4(const void *key, uint8_t *sid); +int pcrf_sess_set_ipv6(const void *key, uint8_t *sid); +uint8_t *pcrf_sess_find_by_ipv4(const void *key); +uint8_t *pcrf_sess_find_by_ipv6(const void *key); #ifdef __cplusplus } diff --git a/src/pcrf/pcrf_fd_path.c b/src/pcrf/pcrf_fd_path.c index 491fb140e..bb4a5bef3 100644 --- a/src/pcrf/pcrf_fd_path.c +++ b/src/pcrf/pcrf_fd_path.c @@ -1,25 +1,21 @@ -#define TRACE_MODULE _pcrf_fd_path - -#include "core_debug.h" - #include "fd/fd_lib.h" #include "pcrf_context.h" #include "pcrf_fd_path.h" -status_t pcrf_fd_init(void) +int pcrf_fd_init(void) { - status_t rv; + int rv; int ret = fd_init(FD_MODE_CLIENT|FD_MODE_SERVER, pcrf_self()->fd_conf_path, pcrf_self()->fd_config); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); rv = pcrf_gx_init(); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = pcrf_rx_init(); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } void pcrf_fd_final(void) diff --git a/src/pcrf/pcrf_fd_path.h b/src/pcrf/pcrf_fd_path.h index 10b79b5a9..e1a66a283 100644 --- a/src/pcrf/pcrf_fd_path.h +++ b/src/pcrf/pcrf_fd_path.h @@ -1,8 +1,6 @@ #ifndef __PCRF_FD_PATH_H__ #define __PCRF_FD_PATH_H__ -#include "core_errno.h" - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -10,18 +8,18 @@ extern "C" { struct sess_state; typedef struct _rx_message_t rx_message_t; -CORE_DECLARE(status_t) pcrf_fd_init(void); -CORE_DECLARE(void) pcrf_fd_final(void); +int pcrf_fd_init(void); +void pcrf_fd_final(void); -CORE_DECLARE(status_t) pcrf_gx_init(void); -CORE_DECLARE(void) pcrf_gx_final(void); -CORE_DECLARE(status_t) pcrf_rx_init(void); -CORE_DECLARE(void) pcrf_rx_final(void); +int pcrf_gx_init(void); +void pcrf_gx_final(void); +int pcrf_rx_init(void); +void pcrf_rx_final(void); -CORE_DECLARE(status_t) pcrf_gx_send_rar( - c_uint8_t *gx_sid, c_uint8_t *rx_sid, rx_message_t *rx_message); -CORE_DECLARE(status_t) pcrf_rx_send_asr( - c_uint8_t *rx_sid, c_uint32_t abort_cause); +int pcrf_gx_send_rar( + uint8_t *gx_sid, uint8_t *rx_sid, rx_message_t *rx_message); +int pcrf_rx_send_asr( + uint8_t *rx_sid, uint32_t abort_cause); #ifdef __cplusplus } diff --git a/src/pcrf/pcrf_gx_path.c b/src/pcrf/pcrf_gx_path.c index 3e099fcd4..bfa203bd1 100644 --- a/src/pcrf/pcrf_gx_path.c +++ b/src/pcrf/pcrf_gx_path.c @@ -1,10 +1,3 @@ -#define TRACE_MODULE _pcrf_gx_path - -#include "core_lib.h" -#include "core_debug.h" -#include "core_pool.h" -#include "core_pkbuf.h" - #include "fd/fd_lib.h" #include "fd/gx/gx_dict.h" #include "fd/rx/rx_dict.h" @@ -15,7 +8,7 @@ #include "pcrf_fd_path.h" struct rx_sess_state { - lnode_t node; + ogs_lnode_t node; os0_t sid; /* Rx Session-Id */ @@ -28,19 +21,19 @@ struct rx_sess_state { struct sess_state { os0_t sid; /* Gx Session-Id */ - c_uint32_t cc_request_type; /* CC-Request-Type */ + uint32_t cc_request_type; /* CC-Request-Type */ os0_t peer_host; /* Peer Host */ - c_int8_t *imsi_bcd; - c_int8_t *apn; + char *imsi_bcd; + char *apn; -ED3(c_uint8_t ipv4:1;, - c_uint8_t ipv6:1;, - c_uint8_t reserved:6;) - c_uint32_t addr; /* Framed-IPv4-Address */ - c_uint8_t addr6[IPV6_LEN]; /* Framed-IPv6-Prefix */ +ED3(uint8_t ipv4:1;, + uint8_t ipv6:1;, + uint8_t reserved:6;) + uint32_t addr; /* Framed-IPv4-Address */ + uint8_t addr6[IPV6_LEN]; /* Framed-IPv6-Prefix */ - list_t rx_list; + ogs_list_t rx_list; struct timespec ts; /* Time of sending the message */ }; @@ -49,35 +42,28 @@ static struct session_handler *pcrf_gx_reg = NULL; static struct disp_hdl *hdl_gx_fb = NULL; static struct disp_hdl *hdl_gx_ccr = NULL; -pool_declare(pcrf_gx_sess_pool, struct sess_state, MAX_POOL_OF_DIAMETER_SESS); -pool_declare(pcrf_gx_rx_sess_pool, - struct rx_sess_state, MAX_POOL_OF_DIAMETER_SESS); - static void pcrf_gx_raa_cb(void *data, struct msg **msg); -static status_t encode_pcc_rule_definition( +static int encode_pcc_rule_definition( struct avp *avp, pcc_rule_t *pcc_rule, int flow_presence); static int matched_flow( pcc_rule_t *pcc_rule, rx_media_component_t *media_component); -static status_t install_flow( +static int install_flow( pcc_rule_t *pcc_rule, rx_media_component_t *media_component); -static status_t update_qos( +static int update_qos( pcc_rule_t *pcc_rule, rx_media_component_t *media_component); static __inline__ struct sess_state *new_state(os0_t sid) { struct sess_state *new = NULL; - d_assert(sid, return NULL,); + ogs_assert(sid); - pool_alloc_node(&pcrf_gx_sess_pool, &new); - d_assert(new, return NULL,); - memset(new, 0, sizeof *new); + new = ogs_calloc(1, sizeof(*new)); + new->sid = (os0_t)ogs_strdup((char *)sid); + ogs_assert(new->sid); - new->sid = (os0_t)core_strdup((char *)sid); - d_assert(new->sid, return NULL,); - - list_init(&new->rx_list); + ogs_list_init(&new->rx_list); return new; } @@ -86,29 +72,26 @@ static struct rx_sess_state *add_rx_state(struct sess_state *gx, os0_t sid) { struct rx_sess_state *new = NULL; - d_assert(gx, return NULL,); - d_assert(sid, return NULL,); + ogs_assert(gx); + ogs_assert(sid); - pool_alloc_node(&pcrf_gx_rx_sess_pool, &new); - d_assert(new, return NULL,); - memset(new, 0, sizeof *new); - - new->sid = (os0_t)core_strdup((char *)sid); - d_assert(new->sid, return NULL,); + new = ogs_calloc(1, sizeof(*new)); + new->sid = (os0_t)ogs_strdup((char *)sid); + ogs_assert(new->sid); new->gx = gx; - list_append(&gx->rx_list, new); + ogs_list_add(&gx->rx_list, new); return new; } -static status_t remove_rx_state(struct rx_sess_state *rx_sess_data) +static int remove_rx_state(struct rx_sess_state *rx_sess_data) { struct sess_state *gx = NULL; int i; - d_assert(rx_sess_data, return CORE_ERROR,); + ogs_assert(rx_sess_data); gx = rx_sess_data->gx; for (i = 0; i < rx_sess_data->num_of_pcc_rule; i++) @@ -117,47 +100,37 @@ static status_t remove_rx_state(struct rx_sess_state *rx_sess_data) } if (rx_sess_data->sid) - CORE_FREE(rx_sess_data->sid); + ogs_free(rx_sess_data->sid); - list_remove(&gx->rx_list, rx_sess_data); - pool_free_node(&pcrf_gx_rx_sess_pool, rx_sess_data); + ogs_list_remove(&gx->rx_list, rx_sess_data); + ogs_free(rx_sess_data); - return CORE_OK; + return OGS_OK; } -static status_t remove_rx_state_all(struct sess_state *gx) +static int remove_rx_state_all(struct sess_state *gx) { struct rx_sess_state *rx_sess_data = NULL, *next_rx_sess_data = NULL; - d_assert(gx, return CORE_ERROR,); - - rx_sess_data = list_first(&gx->rx_list); - while(rx_sess_data) - { - next_rx_sess_data = list_next(rx_sess_data); + ogs_assert(gx); + ogs_list_for_each_safe(&gx->rx_list, next_rx_sess_data, rx_sess_data) remove_rx_state(rx_sess_data); - rx_sess_data = next_rx_sess_data; - } - - return CORE_OK; + return OGS_OK; } static struct rx_sess_state *find_rx_state(struct sess_state *gx, os0_t sid) { struct rx_sess_state *rx_sess_data = NULL; - d_assert(gx, return NULL,); - d_assert(sid, return NULL,); - - rx_sess_data = list_first(&gx->rx_list); - while(rx_sess_data) + ogs_assert(gx); + ogs_assert(sid); + + ogs_list_for_each(&gx->rx_list, rx_sess_data) { if (!strcmp((char *)rx_sess_data->sid, (char *)sid)) return rx_sess_data; - - rx_sess_data = list_next(rx_sess_data); } return NULL; @@ -165,15 +138,15 @@ static struct rx_sess_state *find_rx_state(struct sess_state *gx, os0_t sid) static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque) { - d_assert(sess_data, return,); + ogs_assert(sess_data); if (sess_data->peer_host) - CORE_FREE(sess_data->peer_host); + ogs_free(sess_data->peer_host); if (sess_data->imsi_bcd) - CORE_FREE(sess_data->imsi_bcd); + ogs_free(sess_data->imsi_bcd); if (sess_data->apn) - CORE_FREE(sess_data->apn); + ogs_free(sess_data->apn); if (sess_data->ipv4) pcrf_sess_set_ipv4(&sess_data->addr, NULL); @@ -181,18 +154,18 @@ static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque) pcrf_sess_set_ipv6(sess_data->addr6, NULL); if (sess_data->sid) - CORE_FREE(sess_data->sid); + ogs_free(sess_data->sid); remove_rx_state_all(sess_data); - pool_free_node(&pcrf_gx_sess_pool, sess_data); + ogs_free(sess_data); } static int pcrf_gx_fb_cb(struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { /* This CB should never be called */ - d_warn("Unexpected message received!"); + ogs_warn("Unexpected message received!"); return ENOTSUP; } @@ -200,7 +173,7 @@ static int pcrf_gx_fb_cb(struct msg **msg, struct avp *avp, static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { - status_t rv; + int rv; int ret = 0, i; struct msg *ans, *qry; @@ -211,15 +184,15 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, gx_message_t gx_message; - c_uint32_t cc_request_number = 0; - c_uint32_t result_code = FD_DIAMETER_MISSING_AVP; + uint32_t cc_request_number = 0; + uint32_t result_code = FD_DIAMETER_MISSING_AVP; - d_trace(3, "[PCRF] Credit-Control-Request\n"); + ogs_debug("[PCRF] Credit-Control-Request"); - d_assert(msg, return EINVAL,); + ogs_assert(msg); ret = fd_sess_state_retrieve(pcrf_gx_reg, sess, &sess_data); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (!sess_data) { @@ -227,10 +200,10 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, size_t sidlen; ret = fd_sess_getsid(sess, &sid, &sidlen); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); sess_data = new_state(sid); - d_assert(sess_data, return EINVAL,); + ogs_assert(sess_data); } /* Initialize Message */ @@ -239,63 +212,63 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ans = *msg; /* Get Origin-Host */ ret = fd_msg_search_avp(qry, fd_origin_host, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (sess_data->peer_host) - CORE_FREE(sess_data->peer_host); + ogs_free(sess_data->peer_host); sess_data->peer_host = - (os0_t)core_strdup((char *)hdr->avp_value->os.data); - d_assert(sess_data->peer_host, return CORE_ERROR,); + (os0_t)ogs_strdup((char *)hdr->avp_value->os.data); + ogs_assert(sess_data->peer_host); } else { - d_error("no_CC-Request-Type "); + ogs_error("no_CC-Request-Type "); result_code = FD_DIAMETER_MISSING_AVP; goto out; } /* Get CC-Request-Type */ ret = fd_msg_search_avp(qry, gx_cc_request_type, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); sess_data->cc_request_type = hdr->avp_value->i32; } else { - d_error("no_CC-Request-Type "); + ogs_error("no_CC-Request-Type "); result_code = FD_DIAMETER_MISSING_AVP; goto out; } /* Get CC-Request-Number */ ret = fd_msg_search_avp(qry, gx_cc_request_number, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); cc_request_number = hdr->avp_value->i32; } /* Get Framed-IP-Address */ ret = fd_msg_search_avp(qry, gx_framed_ip_address, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); memcpy(&sess_data->addr, hdr->avp_value->os.data, sizeof sess_data->addr); @@ -305,18 +278,17 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, /* Get Framed-IPv6-Prefix */ ret = fd_msg_search_avp(qry, gx_framed_ipv6_prefix, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { paa_t *paa = NULL; ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); paa = (paa_t *)hdr->avp_value->os.data; - d_assert(paa, return EINVAL,); - d_assert(paa->len == IPV6_LEN * 8 /* 128bit */, return EINVAL, - "Invalid Framed-IPv6-Prefix Length:%d", paa->len); + ogs_assert(paa); + ogs_assert(paa->len == IPV6_LEN * 8 /* 128bit */); memcpy(sess_data->addr6, paa->addr6, sizeof sess_data->addr6); pcrf_sess_set_ipv6(sess_data->addr6, sess_data->sid); sess_data->ipv6 = 1; @@ -324,47 +296,47 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = GX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set CC-Request-Type */ ret = fd_msg_avp_new(gx_cc_request_type, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = sess_data->cc_request_type; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set CC-Request-Number */ ret = fd_msg_avp_new(gx_cc_request_number, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = cc_request_number; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Get IMSI + APN */ ret = fd_msg_search_avp(qry, gx_subscription_id, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_avp_search_avp(avp, gx_subscription_id_type, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (hdr->avp_value->i32 != GX_SUBSCRIPTION_ID_TYPE_END_USER_IMSI) { - d_error("Not implemented Subscription-Id-Type(%d)", + ogs_error("Not implemented Subscription-Id-Type(%d)", hdr->avp_value->i32); result_code = FD_DIAMETER_AVP_UNSUPPORTED; goto out; @@ -372,24 +344,24 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, } else { - d_error("no_Subscription-Id-Type"); + ogs_error("no_Subscription-Id-Type"); result_code = FD_DIAMETER_MISSING_AVP; goto out; } ret = fd_avp_search_avp(avp, gx_subscription_id_data, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (sess_data->imsi_bcd) - CORE_FREE(sess_data->imsi_bcd); - sess_data->imsi_bcd = core_strdup((char *)hdr->avp_value->os.data); - d_assert(sess_data->imsi_bcd, return CORE_ERROR,); + ogs_free(sess_data->imsi_bcd); + sess_data->imsi_bcd = ogs_strdup((char *)hdr->avp_value->os.data); + ogs_assert(sess_data->imsi_bcd); } else { - d_error("no_Subscription-Id-Data"); + ogs_error("no_Subscription-Id-Data"); result_code = FD_DIAMETER_MISSING_AVP; goto out; } @@ -397,35 +369,35 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, if (sess_data->imsi_bcd == NULL) { - d_error("no_Subscription-Id"); + ogs_error("no_Subscription-Id"); result_code = FD_DIAMETER_MISSING_AVP; goto out; } ret = fd_msg_search_avp(qry, gx_called_station_id, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (sess_data->apn) - CORE_FREE(sess_data->apn); - sess_data->apn = core_strdup((char *)hdr->avp_value->os.data); - d_assert(sess_data->apn, return CORE_ERROR,); + ogs_free(sess_data->apn); + sess_data->apn = ogs_strdup((char *)hdr->avp_value->os.data); + ogs_assert(sess_data->apn); } if (sess_data->apn == NULL) { - d_error("no_Called-Station-Id"); + ogs_error("no_Called-Station-Id"); result_code = FD_DIAMETER_MISSING_AVP; goto out; } /* Retrieve QoS Data from Database */ rv = pcrf_db_qos_data(sess_data->imsi_bcd, sess_data->apn, &gx_message); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Cannot get data for IMSI(%s)+APN(%s)'\n", + ogs_error("Cannot get data for IMSI(%s)+APN(%s)'", sess_data->imsi_bcd, sess_data->apn); result_code = FD_DIAMETER_UNKNOWN_SESSION_ID; goto out; @@ -444,152 +416,149 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, if (charging_rule == 0) { ret = fd_msg_avp_new(gx_charging_rule_install, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); charging_rule = 1; } rv = encode_pcc_rule_definition(avp, pcc_rule, 1); - d_assert(rv == CORE_OK, return EINVAL,); + ogs_assert(rv == OGS_OK); } } if (charging_rule) { ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } /* Set QoS-Information */ if (gx_message.pdn.ambr.downlink || gx_message.pdn.ambr.uplink) { ret = fd_msg_avp_new(gx_qos_information, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (gx_message.pdn.ambr.uplink) { ret = fd_msg_avp_new(gx_apn_aggregate_max_bitrate_ul, 0, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = gx_message.pdn.ambr.uplink; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } if (gx_message.pdn.ambr.downlink) { ret = fd_msg_avp_new(gx_apn_aggregate_max_bitrate_dl, 0, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = gx_message.pdn.ambr.downlink; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } /* Set Default-EPS-Bearer-QoS */ ret = fd_msg_avp_new(gx_default_eps_bearer_qos, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = gx_message.pdn.qos.qci; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_allocation_retention_priority, 0, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_priority_level, 0, &avpch2); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = gx_message.pdn.qos.arp.priority_level; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch2); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = gx_message.pdn.qos.arp.pre_emption_capability; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_pre_emption_vulnerability, 0, &avpch2); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = gx_message.pdn.qos.arp.pre_emption_vulnerability; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set Supported Features */ ret = fd_msg_avp_new(gx_supported_features, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_feature_list_id, 0, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_feature_list, 0, &avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.u32 = 0x0000000b; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (sess_data->cc_request_type == GX_CC_REQUEST_TYPE_TERMINATION_REQUEST) { struct rx_sess_state *rx_sess_data = NULL, *next_rx_sess_data = NULL; - rx_sess_data = list_first(&sess_data->rx_list); - while(rx_sess_data) + ogs_list_for_each_safe(&sess_data->rx_list, + next_rx_sess_data, rx_sess_data) { - next_rx_sess_data = list_next(rx_sess_data); - rv = pcrf_rx_send_asr( rx_sess_data->sid, RX_ABORT_CAUSE_BEARER_RELEASED); - d_assert(rv == CORE_OK,,); + ogs_assert(rv == OGS_OK); remove_rx_state(rx_sess_data); - rx_sess_data = next_rx_sess_data; } } /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (sess_data->cc_request_type != GX_CC_REQUEST_TYPE_TERMINATION_REQUEST) { /* Store this value in the session */ ret = fd_sess_state_store(pcrf_gx_reg, sess, &sess_data); - d_assert(ret == 0,,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); } else { @@ -598,14 +567,14 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); - d_trace(3, "[PCRF] Credit-Control-Answer\n"); + ogs_debug("[PCRF] Credit-Control-Answer"); /* Add this value to the stats */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) ==0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) ==0); gx_message_free(&gx_message); @@ -617,31 +586,31 @@ out: { ret = fd_msg_rescode_set(ans, "DIAMETER_AVP_UNSUPPORTED", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (result_code == FD_DIAMETER_UNKNOWN_SESSION_ID) { ret = fd_msg_rescode_set(ans, "DIAMETER_UNKNOWN_SESSION_ID", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (result_code == FD_DIAMETER_MISSING_AVP) { ret = fd_msg_rescode_set(ans, "DIAMETER_MISSING_AVP", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else { ret = fd_message_experimental_rescode_set(ans, result_code); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } if (sess_data->cc_request_type != GX_CC_REQUEST_TYPE_TERMINATION_REQUEST) { /* Store this value in the session */ ret = fd_sess_state_store(pcrf_gx_reg, sess, &sess_data); - d_assert(sess_data == NULL,,); + ogs_assert(sess_data == NULL); } else { @@ -649,17 +618,17 @@ out: } ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); gx_message_free(&gx_message); return 0; } -status_t pcrf_gx_send_rar( - c_uint8_t *gx_sid, c_uint8_t *rx_sid, rx_message_t *rx_message) +int pcrf_gx_send_rar( + uint8_t *gx_sid, uint8_t *rx_sid, rx_message_t *rx_message) { - status_t rv; + int rv; int ret = 0, i, j; int count = 0; @@ -675,11 +644,11 @@ status_t pcrf_gx_send_rar( gx_message_t gx_message; int charging_rule = 0; - d_assert(gx_sid, return CORE_ERROR,); - d_assert(rx_sid, return CORE_ERROR,); - d_assert(rx_message, return CORE_ERROR,); + ogs_assert(gx_sid); + ogs_assert(rx_sid); + ogs_assert(rx_message); - d_trace(3, "[PCRF] Re-Auth-Request\n"); + ogs_debug("[PCRF] Re-Auth-Request"); /* Initialize Message */ memset(&gx_message, 0, sizeof(gx_message_t)); @@ -689,45 +658,45 @@ status_t pcrf_gx_send_rar( /* Create the request */ ret = fd_msg_new(gx_cmd_rar, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); { struct msg_hdr * h; ret = fd_msg_hdr( req, &h ); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); h->msg_appl = GX_APPLICATION_ID; } /* Retrieve session by Session-Id */ sidlen = strlen((char *)gx_sid); ret = fd_sess_fromsid_msg((os0_t)gx_sid, sidlen, &session, &new); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (new) { - d_error("No session data"); + ogs_error("No session data"); ret = fd_msg_free(req); - d_assert(ret == 0,,); + ogs_assert(ret == 0); rx_message->result_code = FD_DIAMETER_UNKNOWN_PEER; - return CORE_ERROR; + return OGS_ERROR; } /* Add Session-Id to the message */ ret = fd_message_session_id_set(req, (os0_t)gx_sid, sidlen); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Save the session associated with the message */ ret = fd_msg_sess_set(req, session); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Retrieve session state in this session */ ret = fd_sess_state_retrieve(pcrf_gx_reg, session, &sess_data); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (sess_data == NULL) { - d_error("No session data"); + ogs_error("No session data"); ret = fd_msg_free(req); - d_assert(ret == 0,,); + ogs_assert(ret == 0); rx_message->result_code = FD_DIAMETER_UNKNOWN_SESSION_ID; - return CORE_ERROR; + return OGS_ERROR; } /* Find RX session state */ @@ -737,14 +706,14 @@ status_t pcrf_gx_send_rar( if (!rx_sess_data) { rx_sess_data = add_rx_state(sess_data, rx_sid); - d_assert(rx_sess_data, return CORE_ERROR,); + ogs_assert(rx_sess_data); } /* Retrieve QoS Data from Database */ rv = pcrf_db_qos_data(sess_data->imsi_bcd, sess_data->apn, &gx_message); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Cannot get data for IMSI(%s)+APN(%s)'\n", + ogs_error("Cannot get data for IMSI(%s)+APN(%s)'", sess_data->imsi_bcd, sess_data->apn); rx_message->result_code = RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE; @@ -757,7 +726,7 @@ status_t pcrf_gx_send_rar( int flow_presence = 0; pcc_rule_t *pcc_rule = NULL; pcc_rule_t *db_pcc_rule = NULL; - c_uint8_t qci = 0; + uint8_t qci = 0; rx_media_component_t *media_component = &rx_message->media_component[i]; @@ -775,7 +744,7 @@ status_t pcrf_gx_send_rar( } default: { - d_error("Not implemented : [Media-Type:%d]", + ogs_error("Not implemented : [Media-Type:%d]", media_component->media_type); rx_message->result_code = FD_DIAMETER_INVALID_AVP_VALUE; goto out; @@ -793,8 +762,8 @@ status_t pcrf_gx_send_rar( if (!db_pcc_rule) { - d_error("CHECK WEBUI : No PCC Rule in DB [QCI:%d]", qci); - d_error("Please add PCC Rule using WEBUI"); + ogs_error("CHECK WEBUI : No PCC Rule in DB [QCI:%d]", qci); + ogs_error("Please add PCC Rule using WEBUI"); rx_message->result_code = RX_DIAMETER_REQUESTED_SERVICE_NOT_AUTHORIZED; goto out; @@ -815,8 +784,8 @@ status_t pcrf_gx_send_rar( &rx_sess_data->pcc_rule[rx_sess_data->num_of_pcc_rule]; /* Device PCC Rule Info from DB Profile */ - pcc_rule->name = core_strdup(db_pcc_rule->name); - d_assert(pcc_rule->name, return CORE_ERROR,); + pcc_rule->name = ogs_strdup(db_pcc_rule->name); + ogs_assert(pcc_rule->name); memcpy(&pcc_rule->qos, &db_pcc_rule->qos, sizeof(qos_t)); @@ -826,10 +795,10 @@ status_t pcrf_gx_send_rar( /* Install Flow */ flow_presence = 1; rv = install_flow(pcc_rule, media_component); - if (rv != CORE_OK) + if (rv != OGS_OK) { rx_message->result_code = RX_DIAMETER_FILTER_RESTRICTIONS; - d_error("install_flow() failed"); + ogs_error("install_flow() failed"); goto out; } @@ -837,16 +806,14 @@ status_t pcrf_gx_send_rar( } else { - d_assert(strcmp(pcc_rule->name, db_pcc_rule->name) == 0, - return CORE_ERROR, "Mismatch Rule Name [%s:%s]", - pcc_rule->name, db_pcc_rule->name); + ogs_assert(strcmp(pcc_rule->name, db_pcc_rule->name) == 0); /* Check Flow */ count = matched_flow(pcc_rule, media_component); if (count == -1) { rx_message->result_code = RX_DIAMETER_FILTER_RESTRICTIONS; - d_error("matched_flow() failed"); + ogs_error("matched_flow() failed"); goto out; } @@ -855,11 +822,11 @@ status_t pcrf_gx_send_rar( /* Re-install Flow */ flow_presence = 1; rv = install_flow(pcc_rule, media_component); - if (rv != CORE_OK) + if (rv != OGS_OK) { rx_message->result_code = RX_DIAMETER_FILTER_RESTRICTIONS; - d_error("install_flow() failed"); + ogs_error("install_flow() failed"); goto out; } @@ -869,11 +836,11 @@ status_t pcrf_gx_send_rar( /* Update QoS */ rv = update_qos(pcc_rule, media_component); - if (rv != CORE_OK) + if (rv != OGS_OK) { rx_message->result_code = RX_DIAMETER_REQUESTED_SERVICE_NOT_AUTHORIZED; - d_error("update_qos() failed"); + ogs_error("update_qos() failed"); goto out; } @@ -890,57 +857,56 @@ status_t pcrf_gx_send_rar( if (charging_rule == 0) { ret = fd_msg_avp_new(gx_charging_rule_install, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); charging_rule = 1; } rv = encode_pcc_rule_definition(avp, pcc_rule, flow_presence); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (charging_rule == 1) { ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } } else if (rx_message->cmd_code == RX_CMD_CODE_SESSION_TERMINATION) { - d_assert(rx_sess_data, return CORE_ERROR,); + ogs_assert(rx_sess_data); for (i = 0; i < rx_sess_data->num_of_pcc_rule; i++) { - d_assert(rx_sess_data->pcc_rule[i].name,,); + ogs_assert(rx_sess_data->pcc_rule[i].name); if (charging_rule == 0) { ret = fd_msg_avp_new(gx_charging_rule_remove, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); charging_rule = 1; } ret = fd_msg_avp_new(gx_charging_rule_name, 0, &avpch1); - d_assert(ret == 0, return CORE_ERROR,); - val.os.data = (c_uint8_t *)rx_sess_data->pcc_rule[i].name; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)rx_sess_data->pcc_rule[i].name; val.os.len = strlen(rx_sess_data->pcc_rule[i].name); ret = fd_msg_avp_setvalue(avpch1, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } if (charging_rule == 1) { ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } remove_rx_state(rx_sess_data); } else - d_assert(0, return CORE_ERROR, - "Invalid Command Code(%d)", rx_message->cmd_code); + ogs_assert_if_reached(); if (charging_rule == 0) { @@ -950,48 +916,48 @@ status_t pcrf_gx_send_rar( /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Destination-Host AVP */ ret = fd_msg_avp_new(fd_destination_host, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.os.data = sess_data->peer_host; val.os.len = strlen((char *)sess_data->peer_host); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.i32 = GX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Re-Auth-Request-Type */ ret = fd_msg_avp_new(fd_re_auth_request_type, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.i32 = FD_RE_AUTH_REQUEST_TYPE_AUTHORIZE_ONLY; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = clock_gettime(CLOCK_REALTIME, &sess_data->ts); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ @@ -999,33 +965,33 @@ status_t pcrf_gx_send_rar( /* Store this value in the session */ ret = fd_sess_state_store(pcrf_gx_reg, session, &sess_data); - d_assert(ret == 0, return CORE_ERROR,); - d_assert(sess_data == NULL, return CORE_ERROR,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the request */ ret = fd_msg_send(&req, pcrf_gx_raa_cb, svg); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Set no error */ rx_message->result_code = ER_DIAMETER_SUCCESS; gx_message_free(&gx_message); - return CORE_OK; + return OGS_OK; out: /* Store this value in the session */ ret = fd_sess_state_store(pcrf_gx_reg, session, &sess_data); - d_assert(sess_data == NULL,,); + ogs_assert(sess_data == NULL); gx_message_free(&gx_message); - return CORE_ERROR; + return OGS_ERROR; } static void pcrf_gx_raa_cb(void *data, struct msg **msg) @@ -1041,89 +1007,89 @@ static void pcrf_gx_raa_cb(void *data, struct msg **msg) int error = 0; int new; - c_uint32_t result_code; + uint32_t result_code; - d_trace(3, "[PCRF] Re-Auth-Answer\n"); + ogs_debug("[PCRF] Re-Auth-Answer"); ret = clock_gettime(CLOCK_REALTIME, &ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); ret = fd_sess_state_retrieve(pcrf_gx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data && (void *)sess_data == data, return, ); + ogs_assert(ret == 0); + ogs_assert(sess_data && (void *)sess_data == data); /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(5, " Result Code: %d\n", hdr->avp_value->i32); + ogs_debug(" Result Code: %d", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(5, " Experimental Result Code: %d\n", result_code); + ogs_debug(" Experimental Result Code: %d", result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); error++; } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " From '%.*s'\n", + ogs_assert(ret == 0); + ogs_debug(" From '%.*s'", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host"); + ogs_error("no_Origin-Host"); error++; } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " ('%.*s')\n", + ogs_assert(ret == 0); + ogs_debug(" ('%.*s')", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm"); + ogs_error("no_Origin-Realm"); error++; } /* Free the message */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (fd_logger_self()->stats.nb_recv) @@ -1149,62 +1115,59 @@ static void pcrf_gx_raa_cb(void *data, struct msg **msg) else fd_logger_self()->stats.nb_recv++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - d_trace(15, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - d_trace(15, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); ret = fd_sess_state_store(pcrf_gx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == NULL, return,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; return; } -status_t pcrf_gx_init(void) +int pcrf_gx_init(void) { int ret; struct disp_when data; - pool_init(&pcrf_gx_sess_pool, MAX_POOL_OF_DIAMETER_SESS); - pool_init(&pcrf_gx_rx_sess_pool, MAX_POOL_OF_DIAMETER_SESS); - /* Install objects definitions for this application */ ret = gx_dict_init(); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Create handler for sessions */ ret = fd_sess_handler_create(&pcrf_gx_reg, state_cleanup, NULL, NULL); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); memset(&data, 0, sizeof(data)); data.app = gx_application; ret = fd_disp_register(pcrf_gx_fb_cb, DISP_HOW_APPID, &data, NULL, &hdl_gx_fb); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); data.command = gx_cmd_ccr; ret = fd_disp_register(pcrf_gx_ccr_cb, DISP_HOW_CC, &data, NULL, &hdl_gx_ccr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Advertise the support for the application in the peer */ ret = fd_disp_app_support(gx_application, fd_vendor, 1, 0); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); - return CORE_OK; + return OGS_OK; } void pcrf_gx_final(void) @@ -1212,48 +1175,34 @@ void pcrf_gx_final(void) int ret; ret = fd_sess_handler_destroy(&pcrf_gx_reg, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); if (hdl_gx_fb) (void) fd_disp_unregister(&hdl_gx_fb, NULL); if (hdl_gx_ccr) (void) fd_disp_unregister(&hdl_gx_ccr, NULL); - - if (pool_used(&pcrf_gx_sess_pool)) - d_error("%d not freed in pcrf_gx_sess_pool[%d] of GX-SM", - pool_used(&pcrf_gx_sess_pool), pool_size(&pcrf_gx_sess_pool)); - d_trace(9, "%d not freed in pcrf_gx_sess_pool[%d] of GX-SM\n", - pool_used(&pcrf_gx_sess_pool), pool_size(&pcrf_gx_sess_pool)); - if (pool_used(&pcrf_gx_rx_sess_pool)) - d_error("%d not freed in pcrf_gx_rx_sess_pool[%d] of GX-SM", - pool_used(&pcrf_gx_rx_sess_pool), pool_size(&pcrf_gx_rx_sess_pool)); - d_trace(9, "%d not freed in pcrf_gx_rx_sess_pool[%d] of GX-SM\n", - pool_used(&pcrf_gx_rx_sess_pool), pool_size(&pcrf_gx_rx_sess_pool)); - - pool_final(&pcrf_gx_sess_pool); - pool_final(&pcrf_gx_rx_sess_pool); } -static status_t encode_pcc_rule_definition( +static int encode_pcc_rule_definition( struct avp *avp, pcc_rule_t *pcc_rule, int flow_presence) { struct avp *avpch1, *avpch2, *avpch3, *avpch4; union avp_value val; int ret = 0, i; - d_assert(avp, return CORE_ERROR,); - d_assert(pcc_rule, return CORE_ERROR,); + ogs_assert(avp); + ogs_assert(pcc_rule); ret = fd_msg_avp_new(gx_charging_rule_definition, 0, &avpch1); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_charging_rule_name, 0, &avpch2); - d_assert(ret == 0, return CORE_ERROR,); - val.os.data = (c_uint8_t *)pcc_rule->name; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)pcc_rule->name; val.os.len = strlen(pcc_rule->name); ret = fd_msg_avp_setvalue(avpch2, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (flow_presence == 1) { @@ -1262,146 +1211,146 @@ static status_t encode_pcc_rule_definition( flow_t *flow = &pcc_rule->flow[i]; ret = fd_msg_avp_new(gx_flow_information, 0, &avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_flow_direction, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.i32 = flow->direction; ret = fd_msg_avp_setvalue(avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_flow_description, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); - val.os.data = (c_uint8_t *)flow->description; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)flow->description; val.os.len = strlen(flow->description); ret = fd_msg_avp_setvalue(avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } } ret = fd_msg_avp_new(gx_flow_status, 0, &avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.i32 = pcc_rule->flow_status; ret = fd_msg_avp_setvalue(avpch2, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_qos_information, 0, &avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.qci; ret = fd_msg_avp_setvalue (avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_allocation_retention_priority, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_priority_level, 0, &avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.arp.priority_level; ret = fd_msg_avp_setvalue (avpch4, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.arp.pre_emption_capability; ret = fd_msg_avp_setvalue (avpch4, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_pre_emption_vulnerability, 0, &avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.arp.pre_emption_vulnerability; ret = fd_msg_avp_setvalue (avpch4, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (pcc_rule->qos.mbr.uplink) { ret = fd_msg_avp_new(gx_max_requested_bandwidth_ul, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.mbr.uplink; ret = fd_msg_avp_setvalue (avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } if (pcc_rule->qos.mbr.downlink) { ret = fd_msg_avp_new(gx_max_requested_bandwidth_dl, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.mbr.downlink; ret = fd_msg_avp_setvalue (avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } if (pcc_rule->qos.gbr.uplink) { ret = fd_msg_avp_new(gx_guaranteed_bitrate_ul, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.gbr.uplink; ret = fd_msg_avp_setvalue (avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } if (pcc_rule->qos.gbr.downlink) { ret = fd_msg_avp_new(gx_guaranteed_bitrate_dl, 0, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->qos.gbr.downlink; ret = fd_msg_avp_setvalue (avpch3, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); } ret = fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_precedence, 0, &avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.u32 = pcc_rule->precedence; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); - return CORE_OK; + return OGS_OK; } -static status_t flow_rx_to_gx(flow_t *rx_flow, flow_t *gx_flow) +static int flow_rx_to_gx(flow_t *rx_flow, flow_t *gx_flow) { int len; - d_assert(rx_flow, return CORE_ERROR,); - d_assert(gx_flow, return CORE_ERROR,); + ogs_assert(rx_flow); + ogs_assert(gx_flow); if (!strncmp(rx_flow->description, "permit out", strlen("permit out"))) @@ -1409,8 +1358,8 @@ static status_t flow_rx_to_gx(flow_t *rx_flow, flow_t *gx_flow) gx_flow->direction = FLOW_DOWNLINK_ONLY; len = strlen(rx_flow->description)+1; - gx_flow->description = core_malloc(len); - core_cpystrn(gx_flow->description, rx_flow->description, len); + gx_flow->description = ogs_malloc(len); + ogs_cpystrn(gx_flow->description, rx_flow->description, len); } else if (!strncmp(rx_flow->description, "permit in", strlen("permit in"))) @@ -1420,31 +1369,31 @@ static status_t flow_rx_to_gx(flow_t *rx_flow, flow_t *gx_flow) /* 'permit in' should be changed * 'permit out' in Gx Diameter */ len = strlen(rx_flow->description)+2; - gx_flow->description = core_malloc(len); + gx_flow->description = ogs_malloc(len); strcpy(gx_flow->description, "permit out"); strcat(gx_flow->description, &rx_flow->description[strlen("permit in")]); - d_assert(len == strlen(gx_flow->description)+1, return CORE_ERROR,); + ogs_assert(len == strlen(gx_flow->description)+1); } else { - d_error("Invalid Flow Descripton : [%s]", rx_flow->description); - return CORE_ERROR; + ogs_error("Invalid Flow Descripton : [%s]", rx_flow->description); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } static int matched_flow( pcc_rule_t *pcc_rule, rx_media_component_t *media_component) { - status_t rv; + int rv; int i, j, k; int matched = 0; int new = 0; - d_assert(pcc_rule, return CORE_ERROR,); - d_assert(media_component, return CORE_ERROR,); + ogs_assert(pcc_rule); + ogs_assert(media_component); for (i = 0; i < media_component->num_of_sub; i++) { @@ -1482,10 +1431,10 @@ static int matched_flow( flow_t *rx_flow = &sub->flow[j]; rv = flow_rx_to_gx(rx_flow, &gx_flow); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("flow reformatting error"); - return CORE_ERROR; + ogs_error("flow reformatting error"); + return OGS_ERROR; } for (k = 0; k < pcc_rule->num_of_flow; k++) @@ -1505,14 +1454,14 @@ static int matched_flow( return matched; } -static status_t install_flow( +static int install_flow( pcc_rule_t *pcc_rule, rx_media_component_t *media_component) { - status_t rv; + int rv; int i, j; - d_assert(pcc_rule, return CORE_ERROR,); - d_assert(media_component, return CORE_ERROR,); + ogs_assert(pcc_rule); + ogs_assert(media_component); /* Remove Flow from PCC Rule */ for (i = 0; i < pcc_rule->num_of_flow; i++) @@ -1537,27 +1486,27 @@ static status_t install_flow( flow_t *gx_flow = &pcc_rule->flow[pcc_rule->num_of_flow]; rv = flow_rx_to_gx(rx_flow, gx_flow); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("flow reformatting error"); - return CORE_ERROR; + ogs_error("flow reformatting error"); + return OGS_ERROR; } pcc_rule->num_of_flow++; } } - return CORE_OK; + return OGS_OK; } -static status_t update_qos( +static int update_qos( pcc_rule_t *pcc_rule, rx_media_component_t *media_component) { - status_t rv; + int rv; int i, j; - d_assert(pcc_rule, return CORE_ERROR,); - d_assert(media_component, return CORE_ERROR,); + ogs_assert(pcc_rule); + ogs_assert(media_component); pcc_rule->qos.mbr.downlink = 0; pcc_rule->qos.mbr.uplink = 0; @@ -1579,10 +1528,10 @@ static status_t update_qos( flow_t *rx_flow = &sub->flow[j]; rv = flow_rx_to_gx(rx_flow, &gx_flow); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("flow reformatting error"); - return CORE_ERROR; + ogs_error("flow reformatting error"); + return OGS_ERROR; } if (gx_flow.direction == FLOW_DOWNLINK_ONLY) @@ -1602,7 +1551,7 @@ static status_t update_qos( !media_component->rs_bandwidth) { pcc_rule->qos.mbr.downlink += - c_max(0.05 * + ogs_max(0.05 * media_component->max_requested_bandwidth_dl, media_component->rr_bandwidth); } @@ -1610,7 +1559,7 @@ static status_t update_qos( media_component->rs_bandwidth) { pcc_rule->qos.mbr.downlink += - c_max(0.05 * + ogs_max(0.05 * media_component->max_requested_bandwidth_dl, media_component->rs_bandwidth); } @@ -1651,7 +1600,7 @@ static status_t update_qos( !media_component->rs_bandwidth) { pcc_rule->qos.mbr.uplink += - c_max(0.05 * + ogs_max(0.05 * media_component->max_requested_bandwidth_ul, media_component->rr_bandwidth); } @@ -1659,7 +1608,7 @@ static status_t update_qos( media_component->rs_bandwidth) { pcc_rule->qos.mbr.uplink += - c_max(0.05 * + ogs_max(0.05 * media_component->max_requested_bandwidth_ul, media_component->rs_bandwidth); } @@ -1684,8 +1633,7 @@ static status_t update_qos( } } else - d_assert(0, return CORE_ERROR, - "Invalid Direction(%d)", gx_flow.direction); + ogs_assert_if_reached(); FLOW_FREE(&gx_flow); } @@ -1712,5 +1660,5 @@ static status_t update_qos( if (pcc_rule->qos.gbr.uplink == 0) pcc_rule->qos.gbr.uplink = pcc_rule->qos.mbr.uplink; - return CORE_OK; + return OGS_OK; } diff --git a/src/pcrf/pcrf_init.c b/src/pcrf/pcrf_init.c index ffcde2925..414705ebb 100644 --- a/src/pcrf/pcrf_init.c +++ b/src/pcrf/pcrf_init.c @@ -1,32 +1,31 @@ -#define TRACE_MODULE _pcrf_init - +#include "app/context.h" #include "pcrf_context.h" #include "pcrf_fd_path.h" static int initialized = 0; -status_t pcrf_initialize(void) +int pcrf_initialize(void) { - status_t rv; + int rv; rv = pcrf_context_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = pcrf_context_parse_config(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - rv = pcrf_context_setup_trace_module(); - if (rv != CORE_OK) return rv; + rv = context_setup_log_module(); + if (rv != OGS_OK) return rv; rv = pcrf_db_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = pcrf_fd_init(); - if (rv != CORE_OK) return CORE_ERROR; + if (rv != OGS_OK) return OGS_ERROR; initialized = 1; - return CORE_OK; + return OGS_OK; } void pcrf_terminate(void) diff --git a/src/pcrf/pcrf_rx_path.c b/src/pcrf/pcrf_rx_path.c index f7c220694..09bc35f35 100644 --- a/src/pcrf/pcrf_rx_path.c +++ b/src/pcrf/pcrf_rx_path.c @@ -1,11 +1,3 @@ -#define TRACE_MODULE _pcrf_rx_path - -#include "core_debug.h" -#include "core_pool.h" -#include "core_pkbuf.h" -#include "core_network.h" -#include "core_lib.h" - #include "fd/fd_lib.h" #include "fd/rx/rx_dict.h" #include "fd/rx/rx_message.h" @@ -33,43 +25,37 @@ static struct disp_hdl *hdl_rx_fb = NULL; static struct disp_hdl *hdl_rx_aar = NULL; static struct disp_hdl *hdl_rx_str = NULL; -pool_declare(pcrf_rx_sess_pool, struct sess_state, MAX_POOL_OF_DIAMETER_SESS); - static void pcrf_rx_asa_cb(void *data, struct msg **msg); static __inline__ struct sess_state *new_state(os0_t sid) { - struct sess_state *new = NULL; - pool_alloc_node(&pcrf_rx_sess_pool, &new); - d_assert(new, return NULL,); - memset(new, 0, sizeof *new); - - new->rx_sid = (os0_t)core_strdup((char *)sid); - d_assert(new->rx_sid, return NULL,); + struct sess_state *new = ogs_calloc(1, sizeof(*new));; + new->rx_sid = (os0_t)ogs_strdup((char *)sid); + ogs_assert(new->rx_sid); return new; } static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque) { - d_assert(sess_data, return,); + ogs_assert(sess_data); if (sess_data->rx_sid) - CORE_FREE((char *)sess_data->rx_sid); + ogs_free((char *)sess_data->rx_sid); if (sess_data->gx_sid) - CORE_FREE((char *)sess_data->gx_sid); + ogs_free((char *)sess_data->gx_sid); if (sess_data->peer_host) - CORE_FREE(sess_data->peer_host); + ogs_free(sess_data->peer_host); - pool_free_node(&pcrf_rx_sess_pool, sess_data); + ogs_free(sess_data); } static int pcrf_rx_fb_cb(struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { /* This CB should never be called */ - d_warn("Unexpected message received!"); + ogs_warn("Unexpected message received!"); return ENOTSUP; } @@ -77,7 +63,7 @@ static int pcrf_rx_fb_cb(struct msg **msg, struct avp *avp, static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { - status_t rv; + int rv; int ret; struct msg *ans, *qry; @@ -89,25 +75,25 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, rx_message_t rx_message; - char buf[CORE_ADDRSTRLEN]; + char buf[OGS_ADDRSTRLEN]; os0_t gx_sid = NULL; - c_uint32_t result_code = RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE; + uint32_t result_code = RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE; - d_trace(3, "[PCRF] AA-Request\n"); + ogs_debug("[PCRF] AA-Request"); - d_assert(msg, return EINVAL,); - d_assert(sess, return EINVAL,); + ogs_assert(msg); + ogs_assert(sess); ret = fd_sess_state_retrieve(pcrf_rx_reg, sess, &sess_data); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (!sess_data) { os0_t sid = NULL; ret = fd_sess_getsid(sess, &sid, &sidlen); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); sess_data = new_state(sid); - d_assert(sess_data, return EINVAL,); + ogs_assert(sess_data); } /* Initialize Message */ @@ -117,38 +103,38 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ans = *msg; /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = RX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Auth-Request-Type AVP */ ret = fd_msg_avp_new(fd_auth_request_type, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Get Framed-IP-Address */ ret = fd_msg_search_avp(qry, rx_framed_ip_address, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); gx_sid = (os0_t)pcrf_sess_find_by_ipv4(hdr->avp_value->os.data); if (!gx_sid) { - d_warn("Cannot find Gx Sesson for IPv4:%s\n", + ogs_warn("Cannot find Gx Sesson for IPv4:%s", INET_NTOP(hdr->avp_value->os.data, buf)); } } @@ -157,21 +143,20 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, { /* Get Framed-IPv6-Prefix */ ret = fd_msg_search_avp(qry, rx_framed_ipv6_prefix, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { paa_t *paa = NULL; ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); paa = (paa_t *)hdr->avp_value->os.data; - d_assert(paa, goto out,); - d_assert(paa->len == IPV6_LEN * 8 /* 128bit */, goto out, - "Invalid Framed-IPv6-Prefix Length:%d", paa->len); + ogs_assert(paa); + ogs_assert(paa->len == IPV6_LEN * 8 /* 128bit */); gx_sid = (os0_t)pcrf_sess_find_by_ipv6(paa->addr6); if (!gx_sid) { - d_warn("Cannot find Gx Sesson for IPv6:%s\n", + ogs_warn("Cannot find Gx Sesson for IPv6:%s", INET6_NTOP(hdr->avp_value->os.data, buf)); } } @@ -179,26 +164,26 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, if (!gx_sid) { - d_error("No Gx Session"); + ogs_error("No Gx Session"); goto out; } ret = fd_msg_browse(qry, MSG_BRW_FIRST_CHILD, &avpch1, NULL); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); while(avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case AC_SESSION_ID: case AC_ORIGIN_HOST: { if (sess_data->peer_host) - CORE_FREE(sess_data->peer_host); + ogs_free(sess_data->peer_host); sess_data->peer_host = - (os0_t)core_strdup((char *)hdr->avp_value->os.data); - d_assert(sess_data->peer_host, return CORE_ERROR,); + (os0_t)ogs_strdup((char *)hdr->avp_value->os.data); + ogs_assert(sess_data->peer_host); break; } case AC_ORIGIN_REALM: @@ -220,11 +205,11 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, media_component[rx_message.num_of_media_component]; ret = fd_msg_browse(avpch1, MSG_BRW_FIRST_CHILD, &avpch2, NULL); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); while(avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case RX_AVP_CODE_MEDIA_COMPONENT_NUMBER: @@ -279,11 +264,11 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, ret = fd_msg_browse(avpch2, MSG_BRW_FIRST_CHILD, &avpch3, NULL); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); while(avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case RX_AVP_CODE_FLOW_NUMBER: @@ -301,9 +286,9 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, flow_t *flow = &sub->flow [sub->num_of_flow]; - flow->description = core_malloc( + flow->description = ogs_malloc( hdr->avp_value->os.len+1); - core_cpystrn( + ogs_cpystrn( flow->description, (char*)hdr->avp_value->os.data, hdr->avp_value->os.len+1); @@ -313,7 +298,7 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, } default: { - d_error("Not supported(%d)", + ogs_error("Not supported(%d)", hdr->avp_code); break; } @@ -326,7 +311,7 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, } default: { - d_warn("Not supported(%d)", hdr->avp_code); + ogs_warn("Not supported(%d)", hdr->avp_code); break; } } @@ -339,7 +324,7 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, } default: { - d_warn("Not supported(%d)", hdr->avp_code); + ogs_warn("Not supported(%d)", hdr->avp_code); break; } } @@ -348,58 +333,58 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp, /* Send Re-Auth Request */ rv = pcrf_gx_send_rar(gx_sid, sess_data->rx_sid, &rx_message); - if (rv != CORE_OK) + if (rv != OGS_OK) { result_code = rx_message.result_code; if (result_code != ER_DIAMETER_SUCCESS) { - d_error("pcrf_gx_send_rar() failed"); + ogs_error("pcrf_gx_send_rar() failed"); goto out; } } /* Store Gx Session-Id in this session */ if (!sess_data->gx_sid) - sess_data->gx_sid = (os0_t)core_strdup((char *)gx_sid); - d_assert(sess_data->gx_sid, goto out,); + sess_data->gx_sid = (os0_t)ogs_strdup((char *)gx_sid); + ogs_assert(sess_data->gx_sid); /* Set IP-Can-Type */ ret = fd_msg_avp_new(rx_ip_can_type, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = RX_IP_CAN_TYPE_3GPP_EPS; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set RAT-Type */ ret = fd_msg_avp_new(rx_rat_type, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = RX_RAT_TYPE_EUTRAN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Store this value in the session */ ret = fd_sess_state_store(pcrf_rx_reg, sess, &sess_data); - d_assert(ret == 0,,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); - d_trace(3, "[PCRF] AA-Answer\n"); + ogs_debug("[PCRF] AA-Answer"); /* Add this value to the stats */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); rx_message_free(&rx_message); @@ -410,28 +395,28 @@ out: { ret = fd_msg_rescode_set(ans, "DIAMETER_AVP_UNSUPPORTED", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (result_code == FD_DIAMETER_UNKNOWN_SESSION_ID) { ret = fd_msg_rescode_set(ans, "DIAMETER_UNKNOWN_SESSION_ID", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (result_code == FD_DIAMETER_MISSING_AVP) { ret = fd_msg_rescode_set(ans, "DIAMETER_MISSING_AVP", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else { ret = fd_message_experimental_rescode_set(ans, result_code); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); state_cleanup(sess_data, NULL, NULL); rx_message_free(&rx_message); @@ -439,7 +424,7 @@ out: return 0; } -status_t pcrf_rx_send_asr(c_uint8_t *rx_sid, c_uint32_t abort_cause) +int pcrf_rx_send_asr(uint8_t *rx_sid, uint32_t abort_cause) { int ret; @@ -451,36 +436,36 @@ status_t pcrf_rx_send_asr(c_uint8_t *rx_sid, c_uint32_t abort_cause) int new; size_t sidlen; - d_assert(rx_sid, return CORE_ERROR,); + ogs_assert(rx_sid); - d_trace(3, "[PCRF] Abort-Session-Request\n"); + ogs_debug("[PCRF] Abort-Session-Request"); /* Create the request */ ret = fd_msg_new(rx_cmd_asr, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); { struct msg_hdr * h; ret = fd_msg_hdr( req, &h ); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); h->msg_appl = RX_APPLICATION_ID; } /* Retrieve session by Session-Id */ sidlen = strlen((char *)rx_sid); ret = fd_sess_fromsid_msg((os0_t)(rx_sid), sidlen, &session, &new); - d_assert(ret == 0, return CORE_ERROR,); - d_assert(new == 0, return CORE_ERROR,); + ogs_assert(ret == 0); + ogs_assert(new == 0); /* Add Session-Id to the message */ ret = fd_message_session_id_set(req, (os0_t)(rx_sid), sidlen); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Save the session associated with the message */ ret = fd_msg_sess_set(req, session); /* Retrieve session state in this session */ ret = fd_sess_state_retrieve(pcrf_rx_reg, session, &sess_data); - d_assert(sess_data, return CORE_ERROR,); + ogs_assert(sess_data); /* Update State */ sess_data->state = SESSION_ABORTED; @@ -488,45 +473,45 @@ status_t pcrf_rx_send_asr(c_uint8_t *rx_sid, c_uint32_t abort_cause) /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Destination-Host AVP */ ret = fd_msg_avp_new(fd_destination_host, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.os.data = sess_data->peer_host; val.os.len = strlen((char *)sess_data->peer_host); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.i32 = RX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Set the Abort-Cause AVP */ ret = fd_msg_avp_new(rx_abort_cause, 0, &avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); val.i32 = sess_data->abort_cause; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ @@ -534,19 +519,19 @@ status_t pcrf_rx_send_asr(c_uint8_t *rx_sid, c_uint32_t abort_cause) /* Store this value in the session */ ret = fd_sess_state_store(pcrf_rx_reg, session, &sess_data); - d_assert(ret == 0, return CORE_ERROR,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the request */ ret = fd_msg_send(&req, pcrf_rx_asa_cb, svg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); - return CORE_OK; + return OGS_OK; } static void pcrf_rx_asa_cb(void *data, struct msg **msg) @@ -557,85 +542,85 @@ static void pcrf_rx_asa_cb(void *data, struct msg **msg) struct avp *avp, *avpch1; struct avp_hdr *hdr; int new; - c_int32_t result_code = 0; + int result_code = 0; - d_trace(3, "[PCRF] Abort-Session-Answer\n"); + ogs_debug("[PCRF] Abort-Session-Answer"); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(5, " Result Code: %d\n", hdr->avp_value->i32); + ogs_debug(" Result Code: %d", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(5, " Experimental Result Code: %d\n", + ogs_debug(" Experimental Result Code: %d", result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " From '%.*s'\n", + ogs_assert(ret == 0); + ogs_debug(" From '%.*s'", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host "); + ogs_error("no_Origin-Host "); } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " ('%.*s')\n", + ogs_assert(ret == 0); + ogs_debug(" ('%.*s')", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm "); + ogs_error("no_Origin-Realm "); } if (result_code != ER_DIAMETER_SUCCESS) { - d_error("ERROR DIAMETER Result Code(%d)", result_code); + ogs_error("ERROR DIAMETER Result Code(%d)", result_code); } ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; return; @@ -644,7 +629,7 @@ static void pcrf_rx_asa_cb(void *data, struct msg **msg) static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { - status_t rv; + int rv; int ret; struct msg *ans, *qry; @@ -654,18 +639,18 @@ static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp, rx_message_t rx_message; - c_uint32_t result_code = RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE; + uint32_t result_code = RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE; - d_trace(3, "[PCRF] Session-Termination-Request\n"); + ogs_debug("[PCRF] Session-Termination-Request"); - d_assert(msg, return EINVAL,); - d_assert(sess, return EINVAL,); + ogs_assert(msg); + ogs_assert(sess); ret = fd_sess_state_retrieve(pcrf_rx_reg, sess, &sess_data); - d_assert(ret == 0, return EINVAL,); - d_assert(sess_data, return EINVAL,); - d_assert(sess_data->rx_sid, return EINVAL,); - d_assert(sess_data->gx_sid, return EINVAL,); + ogs_assert(ret == 0); + ogs_assert(sess_data); + ogs_assert(sess_data->rx_sid); + ogs_assert(sess_data->gx_sid); /* Initialize Message */ memset(&rx_message, 0, sizeof(rx_message_t)); @@ -674,76 +659,76 @@ static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp, /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ans = *msg; /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = RX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Auth-Request-Type AVP */ ret = fd_msg_avp_new(fd_auth_request_type, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Get Termination-Cause */ ret = fd_msg_search_avp(qry, rx_termination_cause, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); sess_data->termination_cause = hdr->avp_value->i32; switch(sess_data->termination_cause) { case RX_TERMINATION_CAUSE_DIAMETER_LOGOUT: break; default: - d_error("Termination-Cause Error : [%d]", + ogs_error("Termination-Cause Error : [%d]", sess_data->termination_cause); break; } } else { - d_error("no_Termination-Cause"); + ogs_error("no_Termination-Cause"); } if (sess_data->state != SESSION_ABORTED) { /* Send Re-Auth Request if Abort-Session-Request is not initaited */ rv = pcrf_gx_send_rar(sess_data->gx_sid, sess_data->rx_sid, &rx_message); - if (rv != CORE_OK) + if (rv != OGS_OK) { result_code = rx_message.result_code; - d_error("pcrf_gx_send_rar() failed"); + ogs_error("pcrf_gx_send_rar() failed"); goto out; } } /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); - d_trace(3, "[PCRF] Session-Termination-Answer\n"); + ogs_debug("[PCRF] Session-Termination-Answer"); /* Add this value to the stats */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); state_cleanup(sess_data, NULL, NULL); rx_message_free(&rx_message); @@ -755,30 +740,30 @@ out: { ret = fd_msg_rescode_set(ans, "DIAMETER_AVP_UNSUPPORTED", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (result_code == FD_DIAMETER_UNKNOWN_SESSION_ID) { ret = fd_msg_rescode_set(ans, "DIAMETER_UNKNOWN_SESSION_ID", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else if (result_code == FD_DIAMETER_MISSING_AVP) { ret = fd_msg_rescode_set(ans, "DIAMETER_MISSING_AVP", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else { ret = fd_msg_rescode_set(ans, "DIAMETER_MISSING_AVP", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); - d_trace(3, "[PCRF] Session-Termination-Answer\n"); + ogs_assert(ret == 0); + ogs_debug("[PCRF] Session-Termination-Answer"); state_cleanup(sess_data, NULL, NULL); rx_message_free(&rx_message); @@ -786,20 +771,18 @@ out: return 0; } -status_t pcrf_rx_init(void) +int pcrf_rx_init(void) { int ret; struct disp_when data; - pool_init(&pcrf_rx_sess_pool, MAX_POOL_OF_DIAMETER_SESS); - /* Install objects definitions for this application */ ret = rx_dict_init(); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Create handler for sessions */ ret = fd_sess_handler_create(&pcrf_rx_reg, state_cleanup, NULL, NULL); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Fallback CB if command != unexpected message received */ memset(&data, 0, sizeof(data)); @@ -807,25 +790,25 @@ status_t pcrf_rx_init(void) ret = fd_disp_register(pcrf_rx_fb_cb, DISP_HOW_APPID, &data, NULL, &hdl_rx_fb); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Specific handler for AA-Request */ data.command = rx_cmd_aar; ret = fd_disp_register(pcrf_rx_aar_cb, DISP_HOW_CC, &data, NULL, &hdl_rx_aar); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Specific handler for STR-Request */ data.command = rx_cmd_str; ret = fd_disp_register(pcrf_rx_str_cb, DISP_HOW_CC, &data, NULL, &hdl_rx_str); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Advertise the support for the application in the peer */ ret = fd_disp_app_support(rx_application, fd_vendor, 1, 0); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); - return CORE_OK; + return OGS_OK; } void pcrf_rx_final(void) @@ -833,7 +816,7 @@ void pcrf_rx_final(void) int ret; ret = fd_sess_handler_destroy(&pcrf_rx_reg, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); if (hdl_rx_fb) (void) fd_disp_unregister(&hdl_rx_fb, NULL); @@ -841,12 +824,4 @@ void pcrf_rx_final(void) (void) fd_disp_unregister(&hdl_rx_aar, NULL); if (hdl_rx_str) (void) fd_disp_unregister(&hdl_rx_str, NULL); - - if (pool_used(&pcrf_rx_sess_pool)) - d_error("%d not freed in pcrf_rx_sess_pool[%d] of GX-SM", - pool_used(&pcrf_rx_sess_pool), pool_size(&pcrf_rx_sess_pool)); - d_trace(9, "%d not freed in pcrf_rx_sess_pool[%d] of GX-SM\n", - pool_used(&pcrf_rx_sess_pool), pool_size(&pcrf_rx_sess_pool)); - - pool_final(&pcrf_rx_sess_pool); } diff --git a/src/pgw.c b/src/pgw.c index 20beef73d..b1b2665b9 100644 --- a/src/pgw.c +++ b/src/pgw.c @@ -1,54 +1,42 @@ -#define TRACE_MODULE _pgw_main - -#include "core_debug.h" -#include "core_signal.h" -#include "core_semaphore.h" - -#include "common/context.h" -#include "common/application.h" +#include "app/context.h" +#include "app/application.h" #include "app_init.h" -status_t app_initialize( - const char *config_path, const char *log_path, const char *pid_path) +extern int __pgw_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __pgw_log_domain + +int app_initialize(app_param_t *param) { - status_t rv; - int app = 0; + int rv; - rv = app_log_pid(pid_path, "pgw"); - if (rv != CORE_OK) return rv; + param->name = "pgw"; + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_pgw_main, app); - } - - d_trace(1, "PGW try to initialize\n"); rv = pgw_initialize(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Failed to intialize PGW"); + ogs_error("Failed to intialize PGW"); return rv; } - d_trace(1, "PGW initialize...done\n"); + ogs_info("PGW initialize...done"); rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } void app_terminate(void) { app_will_terminate(); - d_trace(1, "PGW try to terminate\n"); + ogs_info("PGW try to terminate"); pgw_terminate(); - d_trace(1, "PGW terminate...done\n"); + ogs_info("PGW terminate...done"); app_did_terminate(); } diff --git a/src/pgw/Makefile.am b/src/pgw/Makefile.am index b3635a64e..14248e366 100644 --- a/src/pgw/Makefile.am +++ b/src/pgw/Makefile.am @@ -3,6 +3,7 @@ noinst_LTLIBRARIES = libpgw.la libpgw_la_SOURCES = \ + ogs-tun.h ogs-tun.c \ pgw_ipfw.h \ pgw_event.h pgw_context.h pgw_sm.h \ pgw_gtp_path.h pgw_s5c_build.h pgw_s5c_handler.h \ @@ -17,18 +18,18 @@ libpgw_la_DEPENDENCIES = \ $(top_srcdir)/lib/fd/libfd.la \ $(top_srcdir)/lib/gtp/libgtp.la \ $(top_srcdir)/lib/ipfw/libipfw.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) libpgw_la_LIBADD = \ $(top_srcdir)/lib/fd/libfd.la \ $(top_srcdir)/lib/gtp/libgtp.la \ $(top_srcdir)/lib/ipfw/libipfw.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ -I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \ @@ -38,6 +39,3 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ -Wall -Werror \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/lib/core/src/unix/tun.c b/src/pgw/ogs-tun.c similarity index 60% rename from lib/core/src/unix/tun.c rename to src/pgw/ogs-tun.c index 1577b6463..1e178f39c 100644 --- a/lib/core/src/unix/tun.c +++ b/src/pgw/ogs-tun.c @@ -1,9 +1,30 @@ -#define TRACE_MODULE _core_tun +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -#include "core_debug.h" -#include "core_arch_network.h" +#include "base/base.h" +#include "ogs-tun.h" -#if LINUX == 1 +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __ogs_sock_domain + +#if defined(_WIN32) +#elif defined(__linux__) #include #else #include @@ -14,79 +35,83 @@ #include #endif -status_t tun_open(sock_id *new, char *ifname, int is_tap) +#ifndef IFNAMSIZ +#define IFNAMSIZ 32 +#endif + +ogs_socket_t ogs_tun_open(char *ifname, int len, int is_tap) { - status_t rv; - sock_t *sock = NULL; - int fd = -1; -#if LINUX == 1 + ogs_socket_t fd = INVALID_SOCKET; +#if defined(__linux__) char *dev = "/dev/net/tun"; int rc; struct ifreq ifr; int flags = IFF_NO_PI; + ogs_assert(ifname); + fd = open(dev, O_RDWR); if (fd < 0) { - d_error("open() failed(%d:%s) : dev[%s]", errno, strerror(errno), dev); - return -1; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "open() failed : dev[%s]", dev); + return INVALID_SOCKET; } #else - char name[C_PATH_MAX]; + char name[IFNAMSIZ]; int tun = 0; + ogs_assert(ifname); + #define TUNTAP_ID_MAX 255 for (tun = 0; tun < TUNTAP_ID_MAX; tun++) { - (void)snprintf(name, sizeof(name), "/dev/tun%i", tun); + ogs_snprintf(name, sizeof(name), "/dev/tun%i", tun); if ((fd = open(name, O_RDWR)) > 0) { - (void)snprintf(name, sizeof(name), "tun%i", tun); - ifname = name; + ogs_snprintf(ifname, len, "tun%i", tun); break; } } + if (fd < 0) + { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "open() failed"); + return INVALID_SOCKET; + } #endif - rv = sock_create(new); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - sock = (sock_t *)(*new); - d_assert(sock, return CORE_ERROR,); - - /* Save socket descriptor */ - sock->fd = fd; - /* Save the interface name */ - strncpy(sock->ifname, ifname, IFNAMSIZ-1); - -#if LINUX == 1 +#if defined(__linux__) memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = (is_tap ? (flags | IFF_TAP) : (flags | IFF_TUN)); strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1); - rc = ioctl(sock->fd, TUNSETIFF, (void *)&ifr); + rc = ioctl(fd, TUNSETIFF, (void *)&ifr); if (rc < 0) { - d_error("ioctl() failed(%d:%s) : dev[%s] flags[0x%x]", - errno, strerror(errno), ifname, flags); + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "ioctl() failed : dev[%s] flags[0x%x]", dev, flags); goto cleanup; } #endif - return CORE_OK; + return fd; -#if LINUX == 1 +#if defined(__linux__) cleanup: - sock_delete(*new); - return CORE_ERROR; + close(fd); + return INVALID_SOCKET; #endif } -status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) +#define TUN_ALIGN(size, boundary) \ + (((size) + ((boundary) - 1)) & ~((boundary) - 1)) + +static int tun_set_ipv4(char *ifname, + ogs_ipsubnet_t *ipaddr, ogs_ipsubnet_t *ipsub) { -#if LINUX != 1 - sock_t *sock = NULL; +#if !defined(__linux__) && !defined(WIN32) int fd; struct ifaliasreq ifa; @@ -100,19 +125,16 @@ status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) struct sockaddr_in dst, gw; struct sockaddr_in *paddr; - d_assert(ipaddr, return CORE_ERROR,); - d_assert(ipsub, return CORE_ERROR,); - - sock = (sock_t *)id; - d_assert(id, return CORE_ERROR,); + ogs_assert(ipaddr); + ogs_assert(ipsub); fd = socket(ipaddr->family, SOCK_DGRAM, 0); (void)memset(&ifa, '\0', sizeof ifa); - (void)strlcpy(ifa.ifra_name, sock->ifname, sizeof ifa.ifra_name); + (void)strlcpy(ifa.ifra_name, ifname, sizeof ifa.ifra_name); (void)memset(&ifr, '\0', sizeof ifr); - (void)strlcpy(ifr.ifr_name, sock->ifname, sizeof ifr.ifr_name); + (void)strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); #if 0 /* Delete previously assigned address */ @@ -133,9 +155,9 @@ status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) (void)memcpy(&ifa.ifra_mask, &mask, sizeof(ifa.ifra_mask)); if (ioctl(fd, SIOCAIFADDR, &ifa) == -1) { - d_error("Can't IP address(%d:%s) : dev[%s]", - errno, strerror(errno), sock->ifname); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't IP address : dev[%s]", ifname); + return OGS_ERROR; } close(fd); /* SOCK_DGRAM */ @@ -143,8 +165,9 @@ status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) fd = socket(PF_ROUTE, SOCK_RAW, 0); if (fd < 0) { - d_error("Can't open PF_ROUTE(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't open PF_ROUTE"); + return OGS_ERROR; } (void)memset(&buf, 0, sizeof(buf)); @@ -163,7 +186,7 @@ status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) dst.sin_len = sizeof(dst); (void)memcpy(paddr, &dst, sizeof(dst)); paddr = (struct sockaddr_in *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); (void)memset(&gw, '\0', sizeof(gw)); gw.sin_family = ipaddr->family; @@ -171,7 +194,7 @@ status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) gw.sin_len = sizeof(gw); (void)memcpy(paddr, &gw, sizeof(gw)); paddr = (struct sockaddr_in *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); (void)memset(&mask, '\0', sizeof(mask)); mask.sin_family = ipaddr->family; @@ -179,27 +202,29 @@ status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) mask.sin_len = sizeof(mask); (void)memcpy(paddr, &mask, sizeof(mask)); paddr = (struct sockaddr_in *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); len = (char*)paddr - buf; rtm->rtm_msglen = len; if (write(fd, buf, len) < 0) { - d_error("Can't add routing(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't add routing"); + return OGS_ERROR; } close(fd); /* PF_ROUTE, SOCK_RAW */ -#endif /* LINUX == 1 */ +#endif /* defined(__linux__) */ - return CORE_OK; + return OGS_OK; } -status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) +static int tun_set_ipv6(char *ifname, + ogs_ipsubnet_t *ipaddr, ogs_ipsubnet_t *ipsub) { -#if LINUX != 1 - sock_t *sock = NULL; +/* #if !defined(__linux__) && !defined(WIN32) */ +#if 0 int fd; struct in6_aliasreq ifa; @@ -217,19 +242,16 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) #endif struct sockaddr_in6 *paddr; - d_assert(ipaddr, return CORE_ERROR,); - d_assert(ipsub, return CORE_ERROR,); - - sock = (sock_t *)id; - d_assert(id, return CORE_ERROR,); + ogs_assert(ipaddr); + ogs_assert(ipsub); fd = socket(ipaddr->family, SOCK_DGRAM, 0); (void)memset(&ifa, '\0', sizeof ifa); - (void)strlcpy(ifa.ifra_name, sock->ifname, sizeof ifa.ifra_name); + (void)strlcpy(ifa.ifra_name, ifname, sizeof ifa.ifra_name); (void)memset(&ifr, '\0', sizeof ifr); - (void)strlcpy(ifr.ifr_name, sock->ifname, sizeof ifr.ifr_name); + (void)strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); #if 0 /* Delete previously assigned address */ @@ -253,9 +275,9 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) ifa.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; if (ioctl(fd, SIOCAIFADDR_IN6, &ifa) == -1) { - d_error("Can't IP address(%d:%s) : dev[%s]", - errno, strerror(errno), sock->ifname); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't IP address : dev[%s]", ifname); + return OGS_ERROR; } close(fd); /* SOCK_DGRAM */ @@ -263,8 +285,9 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) fd = socket(PF_ROUTE, SOCK_RAW, 0); if (fd < 0) { - d_error("Can't open PF_ROUTE(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't open PF_ROUTE"); + return OGS_ERROR; } (void)memset(&buf, 0, sizeof(buf)); @@ -282,14 +305,15 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) dst.sin6_len = sizeof(dst); (void)memcpy(paddr, &dst, sizeof(dst)); paddr = (struct sockaddr_in6 *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); len = (char*)paddr - buf; rtm->rtm_msglen = len; if (write(fd, buf, len) < 0) { - d_error("Can't add routing(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't add routing"); + return OGS_ERROR; } #if 0 @@ -309,7 +333,7 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) dst.sin6_len = sizeof(dst); (void)memcpy(paddr, &dst, sizeof(dst)); paddr = (struct sockaddr_in6 *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); (void)memset(&gw, '\0', sizeof(gw)); gw.sin6_family = ipaddr->family; @@ -317,7 +341,7 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) gw.sin6_len = sizeof(gw); (void)memcpy(paddr, &gw, sizeof(gw)); paddr = (struct sockaddr_in6 *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); (void)memset(&mask, '\0', sizeof(mask)); mask.sin6_family = ipaddr->family; @@ -325,42 +349,38 @@ status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub) mask.sin6_len = sizeof(mask); (void)memcpy(paddr, &mask, sizeof(mask)); paddr = (struct sockaddr_in6 *)((char *)paddr + - CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t))); + TUN_ALIGN(sizeof(*paddr), sizeof(uintptr_t))); len = (char*)paddr - buf; rtm->rtm_msglen = len; if (write(fd, buf, len) < 0) { - d_error("Can't add routing(%d:%s)", errno, strerror(errno)); - return CORE_ERROR; + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "Can't add routing"); + return OGS_ERROR; } #endif close(fd); /* PF_ROUTE, SOCK_RAW */ -#endif /* LINUX == 1 */ +#endif /* defined(__linux__) */ - return CORE_OK; + return OGS_OK; } -status_t tun_set_ip(sock_id id, ipsubnet_t *gw, ipsubnet_t *sub) +int ogs_tun_set_ip(char *ifname, ogs_ipsubnet_t *gw, ogs_ipsubnet_t *sub) { - status_t rv = CORE_OK; + int rv = OGS_OK; - d_assert(id, return CORE_ERROR,); - d_assert(gw, return CORE_ERROR,); - d_assert(sub, return CORE_ERROR,); + ogs_assert(gw); + ogs_assert(sub); if (gw->family == AF_INET) - rv = tun_set_ipv4(id, gw, sub); + rv = tun_set_ipv4(ifname, gw, sub); else if (gw->family == AF_INET6) - { -#if 0 - rv = tun_set_ipv6(id, gw, sub); -#endif - } + rv = tun_set_ipv6(ifname, gw, sub); else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); return rv; } diff --git a/src/pgw/ogs-tun.h b/src/pgw/ogs-tun.h new file mode 100644 index 000000000..4644e92e2 --- /dev/null +++ b/src/pgw/ogs-tun.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef OGS_TUN_H +#define OGS_TUN_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_socket_t ogs_tun_open(char *ifname, int len, int is_tap); +int ogs_tun_set_ip(char *ifname, ogs_ipsubnet_t *gw, ogs_ipsubnet_t *sub); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_TUN_H */ diff --git a/src/pgw/pgw_context.c b/src/pgw/pgw_context.c index 579522f4a..d7b18f0eb 100644 --- a/src/pgw/pgw_context.c +++ b/src/pgw/pgw_context.c @@ -1,13 +1,5 @@ -#define TRACE_MODULE _pgw_context -#include "core_debug.h" -#include "core_pool.h" -#include "core_index.h" -#include "core_lib.h" -#include "core_network.h" - #include #include -#include "common/yaml_helper.h" #include "gtp/gtp_types.h" #include "gtp/gtp_conv.h" @@ -17,26 +9,27 @@ #include "fd/fd_lib.h" -#include "common/context.h" +#include "app/context.h" #include "pgw_context.h" static pgw_context_t self; static fd_config_t g_fd_conf; -pool_declare(pgw_dev_pool, pgw_dev_t, MAX_NUM_OF_DEV); -pool_declare(pgw_subnet_pool, pgw_subnet_t, MAX_NUM_OF_SUBNET); +int __pgw_log_domain; -index_declare(pgw_sess_pool, pgw_sess_t, MAX_POOL_OF_SESS); -index_declare(pgw_bearer_pool, pgw_bearer_t, MAX_POOL_OF_BEARER); +static OGS_POOL(pgw_dev_pool, pgw_dev_t); +static OGS_POOL(pgw_subnet_pool, pgw_subnet_t); -pool_declare(pgw_pf_pool, pgw_pf_t, MAX_POOL_OF_PF); +static OGS_POOL(pgw_sess_pool, pgw_sess_t); +static OGS_POOL(pgw_bearer_pool, pgw_bearer_t); + +static OGS_POOL(pgw_pf_pool, pgw_pf_t); static int context_initiaized = 0; -status_t pgw_context_init() +int pgw_context_init() { - d_assert(context_initiaized == 0, return CORE_ERROR, - "PGW context already has been initialized"); + ogs_assert(context_initiaized == 0); /* Initial FreeDiameter Config */ memset(&g_fd_conf, 0, sizeof(fd_config_t)); @@ -45,70 +38,65 @@ status_t pgw_context_init() memset(&self, 0, sizeof(pgw_context_t)); self.fd_config = &g_fd_conf; - list_init(&self.gtpc_list); - list_init(&self.gtpc_list6); - list_init(&self.gtpu_list); - list_init(&self.gtpu_list6); + ogs_log_install_domain(&__pgw_log_domain, "pgw", ogs_core()->log.level); + + ogs_list_init(&self.gtpc_list); + ogs_list_init(&self.gtpc_list6); + ogs_list_init(&self.gtpu_list); + ogs_list_init(&self.gtpu_list6); gtp_node_init(); - list_init(&self.sgw_s5c_list); - list_init(&self.sgw_s5u_list); + ogs_list_init(&self.sgw_s5c_list); + ogs_list_init(&self.sgw_s5u_list); - list_init(&self.dev_list); - pool_init(&pgw_dev_pool, MAX_NUM_OF_DEV); - list_init(&self.subnet_list); - pool_init(&pgw_subnet_pool, MAX_NUM_OF_SUBNET); + ogs_list_init(&self.dev_list); + ogs_pool_init(&pgw_dev_pool, MAX_NUM_OF_DEV); + ogs_list_init(&self.subnet_list); + ogs_pool_init(&pgw_subnet_pool, MAX_NUM_OF_SUBNET); - index_init(&pgw_sess_pool, MAX_POOL_OF_SESS); - index_init(&pgw_bearer_pool, MAX_POOL_OF_BEARER); + ogs_pool_init(&pgw_sess_pool, MAX_POOL_OF_SESS); + ogs_pool_init(&pgw_bearer_pool, MAX_POOL_OF_BEARER); - pool_init(&pgw_pf_pool, MAX_POOL_OF_PF); + ogs_pool_init(&pgw_pf_pool, MAX_POOL_OF_PF); - self.sess_hash = hash_make(); + self.sess_hash = ogs_hash_make(); context_initiaized = 1; - return CORE_OK; + return OGS_OK; } -status_t pgw_context_final() +int pgw_context_final() { - d_assert(context_initiaized == 1, return CORE_ERROR, - "PGW context already has been finalized"); + ogs_assert(context_initiaized == 1); pgw_sess_remove_all(); - d_assert(self.sess_hash, , "Null param"); - hash_destroy(self.sess_hash); - - if (index_used(&pgw_sess_pool)) - d_error("%d not freed in pgw_sess_pool[%d] in PGW-Context", - index_used(&pgw_sess_pool), index_size(&pgw_sess_pool)); - d_trace(9, "%d not freed in pgw_sess_pool[%d] in PGW-Context\n", - index_used(&pgw_sess_pool), index_size(&pgw_sess_pool)); + ogs_assert(self.sess_hash); + ogs_hash_destroy(self.sess_hash); pgw_dev_remove_all(); pgw_subnet_remove_all(); - index_final(&pgw_bearer_pool); - index_final(&pgw_sess_pool); - pool_final(&pgw_pf_pool); + ogs_pool_final(&pgw_bearer_pool); + ogs_pool_final(&pgw_sess_pool); + ogs_pool_final(&pgw_pf_pool); - pool_final(&pgw_dev_pool); - pool_final(&pgw_subnet_pool); + ogs_pool_final(&pgw_dev_pool); + ogs_pool_final(&pgw_subnet_pool); gtp_remove_all_nodes(&self.sgw_s5c_list); gtp_remove_all_nodes(&self.sgw_s5u_list); gtp_node_final(); - sock_remove_all_nodes(&self.gtpc_list); - sock_remove_all_nodes(&self.gtpc_list6); - sock_remove_all_nodes(&self.gtpu_list); - sock_remove_all_nodes(&self.gtpu_list6); + ogs_sock_remove_all_nodes(&self.gtpc_list); + ogs_sock_remove_all_nodes(&self.gtpc_list6); + ogs_sock_remove_all_nodes(&self.gtpu_list); + ogs_sock_remove_all_nodes(&self.gtpu_list6); context_initiaized = 0; - return CORE_OK; + return OGS_OK; } pgw_context_t* pgw_self() @@ -116,7 +104,7 @@ pgw_context_t* pgw_self() return &self; } -static status_t pgw_context_prepare() +static int pgw_context_prepare() { self.gtpc_port = GTPV2_C_UDP_PORT; self.gtpu_port = GTPV1_U_UDP_PORT; @@ -125,165 +113,164 @@ static status_t pgw_context_prepare() self.tun_ifname = "pgwtun"; - return CORE_OK; + return OGS_OK; } -static status_t pgw_context_validation() +static int pgw_context_validation() { if (self.fd_conf_path == NULL && (self.fd_config->cnf_diamid == NULL || self.fd_config->cnf_diamrlm == NULL || self.fd_config->cnf_addr == NULL)) { - d_error("No pgw.freeDiameter in '%s'", + ogs_error("No pgw.freeDiameter in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } - if (list_first(&self.gtpc_list) == NULL && - list_first(&self.gtpc_list6) == NULL) + if (ogs_list_first(&self.gtpc_list) == NULL && + ogs_list_first(&self.gtpc_list6) == NULL) { - d_error("No pgw.gtpc in '%s'", + ogs_error("No pgw.gtpc in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } - if (list_first(&self.gtpu_list) == NULL && - list_first(&self.gtpu_list6) == NULL) + if (ogs_list_first(&self.gtpu_list) == NULL && + ogs_list_first(&self.gtpu_list6) == NULL) { - d_error("No pgw.gtpu in '%s'", + ogs_error("No pgw.gtpu in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } if (self.dns[0] == NULL && self.dns6[0] == NULL) { - d_error("No pgw.dns in '%s'", + ogs_error("No pgw.dns in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t pgw_context_parse_config() +int pgw_context_parse_config() { - status_t rv; + int rv; config_t *config = &context_self()->config; yaml_document_t *document = NULL; - yaml_iter_t root_iter; + ogs_yaml_iter_t root_iter; - d_assert(config, return CORE_ERROR,); + ogs_assert(config); document = config->document; - d_assert(document, return CORE_ERROR,); + ogs_assert(document); rv = pgw_context_prepare(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - yaml_iter_init(&root_iter, document); - while(yaml_iter_next(&root_iter)) + ogs_yaml_iter_init(&root_iter, document); + while(ogs_yaml_iter_next(&root_iter)) { - const char *root_key = yaml_iter_key(&root_iter); - d_assert(root_key, return CORE_ERROR,); + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); if (!strcmp(root_key, "pgw")) { - yaml_iter_t pgw_iter; - yaml_iter_recurse(&root_iter, &pgw_iter); - while(yaml_iter_next(&pgw_iter)) + ogs_yaml_iter_t pgw_iter; + ogs_yaml_iter_recurse(&root_iter, &pgw_iter); + while(ogs_yaml_iter_next(&pgw_iter)) { - const char *pgw_key = yaml_iter_key(&pgw_iter); - d_assert(pgw_key, return CORE_ERROR,); + const char *pgw_key = ogs_yaml_iter_key(&pgw_iter); + ogs_assert(pgw_key); if (!strcmp(pgw_key, "freeDiameter")) { yaml_node_t *node = yaml_document_get_node(document, pgw_iter.pair->value); - d_assert(node, return CORE_ERROR,); + ogs_assert(node); if (node->type == YAML_SCALAR_NODE) { - self.fd_conf_path = yaml_iter_value(&pgw_iter); + self.fd_conf_path = ogs_yaml_iter_value(&pgw_iter); } else if (node->type == YAML_MAPPING_NODE) { - yaml_iter_t fd_iter; - yaml_iter_recurse(&pgw_iter, &fd_iter); + ogs_yaml_iter_t fd_iter; + ogs_yaml_iter_recurse(&pgw_iter, &fd_iter); - while(yaml_iter_next(&fd_iter)) + while(ogs_yaml_iter_next(&fd_iter)) { - const char *fd_key = yaml_iter_key(&fd_iter); - d_assert(fd_key, return CORE_ERROR,); + const char *fd_key = ogs_yaml_iter_key(&fd_iter); + ogs_assert(fd_key); if (!strcmp(fd_key, "identity")) { self.fd_config->cnf_diamid = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "realm")) { self.fd_config->cnf_diamrlm = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port = atoi(v); } else if (!strcmp(fd_key, "sec_port")) { - const char *v = yaml_iter_value(&fd_iter); + const char *v = ogs_yaml_iter_value(&fd_iter); if (v) self.fd_config->cnf_port_tls = atoi(v); } else if (!strcmp(fd_key, "no_sctp")) { self.fd_config->cnf_flags.no_sctp = - yaml_iter_bool(&fd_iter); + ogs_yaml_iter_bool(&fd_iter); } else if (!strcmp(fd_key, "listen_on")) { self.fd_config->cnf_addr = - yaml_iter_value(&fd_iter); + ogs_yaml_iter_value(&fd_iter); } else if (!strcmp(fd_key, "load_extension")) { - yaml_iter_t ext_array, ext_iter; - yaml_iter_recurse(&fd_iter, &ext_array); + ogs_yaml_iter_t ext_array, ext_iter; + ogs_yaml_iter_recurse(&fd_iter, &ext_array); do { const char *module = NULL; const char *conf = NULL; - if (yaml_iter_type(&ext_array) == + if (ogs_yaml_iter_type(&ext_array) == YAML_MAPPING_NODE) { memcpy(&ext_iter, &ext_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&ext_array)) + if (!ogs_yaml_iter_next(&ext_array)) break; - yaml_iter_recurse( + ogs_yaml_iter_recurse( &ext_array, &ext_iter); } - else if (yaml_iter_type(&ext_array) == + else if (ogs_yaml_iter_type(&ext_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&ext_iter)) + while(ogs_yaml_iter_next(&ext_iter)) { const char *ext_key = - yaml_iter_key(&ext_iter); - d_assert(ext_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&ext_iter); + ogs_assert(ext_key); if (!strcmp(ext_key, "module")) { - module = yaml_iter_value(&ext_iter); + module = ogs_yaml_iter_value(&ext_iter); } else if (!strcmp(ext_key, "conf")) { - conf = yaml_iter_value(&ext_iter); + conf = ogs_yaml_iter_value(&ext_iter); } else - d_warn("unknown key `%s`", ext_key); + ogs_warn("unknown key `%s`", ext_key); } if (module) @@ -296,62 +283,61 @@ status_t pgw_context_parse_config() conf = conf; self.fd_config->num_of_ext++; } - } while(yaml_iter_type(&ext_array) == + } while(ogs_yaml_iter_type(&ext_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(fd_key, "connect")) { - yaml_iter_t conn_array, conn_iter; - yaml_iter_recurse(&fd_iter, &conn_array); + ogs_yaml_iter_t conn_array, conn_iter; + ogs_yaml_iter_recurse(&fd_iter, &conn_array); do { const char *identity = NULL; const char *addr = NULL; - c_uint16_t port = 0; + uint16_t port = 0; - if (yaml_iter_type(&conn_array) == + if (ogs_yaml_iter_type(&conn_array) == YAML_MAPPING_NODE) { memcpy(&conn_iter, &conn_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&conn_array)) + if (!ogs_yaml_iter_next(&conn_array)) break; - yaml_iter_recurse(&conn_array, &conn_iter); + ogs_yaml_iter_recurse(&conn_array, &conn_iter); } - else if (yaml_iter_type(&conn_array) == + else if (ogs_yaml_iter_type(&conn_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&conn_iter)) + while(ogs_yaml_iter_next(&conn_iter)) { const char *conn_key = - yaml_iter_key(&conn_iter); - d_assert(conn_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&conn_iter); + ogs_assert(conn_key); if (!strcmp(conn_key, "identity")) { - identity = yaml_iter_value(&conn_iter); + identity = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "addr")) { - addr = yaml_iter_value(&conn_iter); + addr = ogs_yaml_iter_value(&conn_iter); } else if (!strcmp(conn_key, "port")) { const char *v = - yaml_iter_value(&conn_iter); + ogs_yaml_iter_value(&conn_iter); if (v) port = atoi(v); } else - d_warn("unknown key `%s`", conn_key); + ogs_warn("unknown key `%s`", conn_key); } if (identity && addr) @@ -367,62 +353,61 @@ status_t pgw_context_parse_config() port = port; self.fd_config->num_of_conn++; } - } while(yaml_iter_type(&conn_array) == + } while(ogs_yaml_iter_type(&conn_array) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", fd_key); + ogs_warn("unknown key `%s`", fd_key); } } } else if (!strcmp(pgw_key, "gtpc")) { - yaml_iter_t gtpc_array, gtpc_iter; - yaml_iter_recurse(&pgw_iter, >pc_array); + ogs_yaml_iter_t gtpc_array, gtpc_iter; + ogs_yaml_iter_recurse(&pgw_iter, >pc_array); do { int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.gtpc_port; + uint16_t port = self.gtpc_port; const char *dev = NULL; - c_sockaddr_t *list = NULL; - sock_node_t *node = NULL; + ogs_sockaddr_t *list = NULL; + ogs_socknode_t *node = NULL; - if (yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) { memcpy(>pc_iter, >pc_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(>pc_array)) + if (!ogs_yaml_iter_next(>pc_array)) break; - yaml_iter_recurse(>pc_array, >pc_iter); + ogs_yaml_iter_recurse(>pc_array, >pc_iter); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(>pc_iter)) + while(ogs_yaml_iter_next(>pc_iter)) { const char *gtpc_key = - yaml_iter_key(>pc_iter); - d_assert(gtpc_key, - return CORE_ERROR,); + ogs_yaml_iter_key(>pc_iter); + ogs_assert(gtpc_key); if (!strcmp(gtpc_key, "family")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -431,31 +416,30 @@ status_t pgw_context_parse_config() else if (!strcmp(gtpc_key, "addr") || !strcmp(gtpc_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(>pc_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(>pc_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gtpc_key, "port")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) { port = atoi(v); @@ -464,112 +448,111 @@ status_t pgw_context_parse_config() } else if (!strcmp(gtpc_key, "dev")) { - dev = yaml_iter_value(>pc_iter); + dev = ogs_yaml_iter_value(>pc_iter); } else - d_warn("unknown key `%s`", gtpc_key); + ogs_warn("unknown key `%s`", gtpc_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (list) { - if (context_self()->parameter.no_ipv4 == 0) + if (context_self()->config.parameter.no_ipv4 == 0) { - rv = sock_add_node(&self.gtpc_list, + rv = ogs_sock_add_node(&self.gtpc_list, &node, list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - if (context_self()->parameter.no_ipv6 == 0) + if (context_self()->config.parameter.no_ipv6 == 0) { - rv = sock_add_node(&self.gtpc_list6, + rv = ogs_sock_add_node(&self.gtpc_list6, &node, list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); } if (dev) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpc_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpc_list6, dev, self.gtpc_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - } while(yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); - if (list_first(&self.gtpc_list) == NULL && - list_first(&self.gtpc_list6) == NULL) + if (ogs_list_first(&self.gtpc_list) == NULL && + ogs_list_first(&self.gtpc_list6) == NULL) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpc_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpc_list6, NULL, self.gtpc_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } } else if (!strcmp(pgw_key, "gtpu")) { - yaml_iter_t gtpu_array, gtpu_iter; - yaml_iter_recurse(&pgw_iter, >pu_array); + ogs_yaml_iter_t gtpu_array, gtpu_iter; + ogs_yaml_iter_recurse(&pgw_iter, >pu_array); do { int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.gtpu_port; + uint16_t port = self.gtpu_port; const char *dev = NULL; - c_sockaddr_t *list = NULL; - sock_node_t *node = NULL; + ogs_sockaddr_t *list = NULL; + ogs_socknode_t *node = NULL; - if (yaml_iter_type(>pu_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(>pu_array) == YAML_MAPPING_NODE) { memcpy(>pu_iter, >pu_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(>pu_array) == + else if (ogs_yaml_iter_type(>pu_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(>pu_array)) + if (!ogs_yaml_iter_next(>pu_array)) break; - yaml_iter_recurse(>pu_array, >pu_iter); + ogs_yaml_iter_recurse(>pu_array, >pu_iter); } - else if (yaml_iter_type(>pu_array) == + else if (ogs_yaml_iter_type(>pu_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(>pu_iter)) + while(ogs_yaml_iter_next(>pu_iter)) { const char *gtpu_key = - yaml_iter_key(>pu_iter); - d_assert(gtpu_key, - return CORE_ERROR,); + ogs_yaml_iter_key(>pu_iter); + ogs_assert(gtpu_key); if (!strcmp(gtpu_key, "family")) { - const char *v = yaml_iter_value(>pu_iter); + const char *v = ogs_yaml_iter_value(>pu_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -578,31 +561,30 @@ status_t pgw_context_parse_config() else if (!strcmp(gtpu_key, "addr") || !strcmp(gtpu_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(>pu_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(>pu_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gtpu_key, "port")) { - const char *v = yaml_iter_value(>pu_iter); + const char *v = ogs_yaml_iter_value(>pu_iter); if (v) { port = atoi(v); @@ -611,68 +593,68 @@ status_t pgw_context_parse_config() } else if (!strcmp(gtpu_key, "dev")) { - dev = yaml_iter_value(>pu_iter); + dev = ogs_yaml_iter_value(>pu_iter); } else - d_warn("unknown key `%s`", gtpu_key); + ogs_warn("unknown key `%s`", gtpu_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (list) { - if (context_self()->parameter.no_ipv4 == 0) + if (context_self()->config.parameter.no_ipv4 == 0) { - rv = sock_add_node(&self.gtpu_list, + rv = ogs_sock_add_node(&self.gtpu_list, &node, list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - if (context_self()->parameter.no_ipv6 == 0) + if (context_self()->config.parameter.no_ipv6 == 0) { - rv = sock_add_node(&self.gtpu_list6, + rv = ogs_sock_add_node(&self.gtpu_list6, &node, list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); } if (dev) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpu_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpu_list6, dev, self.gtpu_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - } while(yaml_iter_type(>pu_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pu_array) == YAML_SEQUENCE_NODE); - if (list_first(&self.gtpu_list) == NULL && - list_first(&self.gtpu_list6) == NULL) + if (ogs_list_first(&self.gtpu_list) == NULL && + ogs_list_first(&self.gtpu_list6) == NULL) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpu_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpu_list6, NULL, self.gtpu_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } } else if (!strcmp(pgw_key, "ue_pool")) { - yaml_iter_t ue_pool_array, ue_pool_iter; - yaml_iter_recurse(&pgw_iter, &ue_pool_array); + ogs_yaml_iter_t ue_pool_array, ue_pool_iter; + ogs_yaml_iter_recurse(&pgw_iter, &ue_pool_array); do { pgw_subnet_t *subnet = NULL; @@ -681,38 +663,37 @@ status_t pgw_context_parse_config() const char *apn = NULL; const char *dev = self.tun_ifname; - if (yaml_iter_type(&ue_pool_array) == + if (ogs_yaml_iter_type(&ue_pool_array) == YAML_MAPPING_NODE) { memcpy(&ue_pool_iter, &ue_pool_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(&ue_pool_array) == + else if (ogs_yaml_iter_type(&ue_pool_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&ue_pool_array)) + if (!ogs_yaml_iter_next(&ue_pool_array)) break; - yaml_iter_recurse(&ue_pool_array, + ogs_yaml_iter_recurse(&ue_pool_array, &ue_pool_iter); } - else if (yaml_iter_type(&ue_pool_array) == + else if (ogs_yaml_iter_type(&ue_pool_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(&ue_pool_iter)) + while(ogs_yaml_iter_next(&ue_pool_iter)) { const char *ue_pool_key = - yaml_iter_key(&ue_pool_iter); - d_assert(ue_pool_key, - return CORE_ERROR,); + ogs_yaml_iter_key(&ue_pool_iter); + ogs_assert(ue_pool_key); if (!strcmp(ue_pool_key, "addr")) { char *v = - (char *)yaml_iter_value(&ue_pool_iter); + (char *)ogs_yaml_iter_value(&ue_pool_iter); if (v) { ipstr = (const char *)strsep(&v, "/"); @@ -724,83 +705,83 @@ status_t pgw_context_parse_config() } else if (!strcmp(ue_pool_key, "apn")) { - apn = yaml_iter_value(&ue_pool_iter); + apn = ogs_yaml_iter_value(&ue_pool_iter); } else if (!strcmp(ue_pool_key, "dev")) { - dev = yaml_iter_value(&ue_pool_iter); + dev = ogs_yaml_iter_value(&ue_pool_iter); } else - d_warn("unknown key `%s`", ue_pool_key); + ogs_warn("unknown key `%s`", ue_pool_key); } if (ipstr && mask_or_numbits) { subnet = pgw_subnet_add( ipstr, mask_or_numbits, apn, dev); - d_assert(subnet, return CORE_ERROR,); + ogs_assert(subnet); } else { - d_warn("Ignore : addr(%s/%s), apn(%s)", + ogs_warn("Ignore : addr(%s/%s), apn(%s)", ipstr, mask_or_numbits, apn); } - } while(yaml_iter_type(&ue_pool_array) == + } while(ogs_yaml_iter_type(&ue_pool_array) == YAML_SEQUENCE_NODE); } else if (!strcmp(pgw_key, "dns")) { - yaml_iter_t dns_iter; - yaml_iter_recurse(&pgw_iter, &dns_iter); - d_assert(yaml_iter_type(&dns_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t dns_iter; + ogs_yaml_iter_recurse(&pgw_iter, &dns_iter); + ogs_assert(ogs_yaml_iter_type(&dns_iter) != + YAML_MAPPING_NODE); do { const char *v = NULL; - if (yaml_iter_type(&dns_iter) == + if (ogs_yaml_iter_type(&dns_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&dns_iter)) + if (!ogs_yaml_iter_next(&dns_iter)) break; } - v = yaml_iter_value(&dns_iter); + v = ogs_yaml_iter_value(&dns_iter); if (v) { - ipsubnet_t ipsub; - rv = core_ipsubnet(&ipsub, v, NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_ipsubnet_t ipsub; + rv = ogs_ipsubnet(&ipsub, v, NULL); + ogs_assert(rv == OGS_OK); if (ipsub.family == AF_INET) { if (self.dns[0] && self.dns[1]) - d_warn("Ignore DNS : %s", v); + ogs_warn("Ignore DNS : %s", v); else if (self.dns[0]) self.dns[1] = v; else self.dns[0] = v; } else if (ipsub.family == AF_INET6) { if (self.dns6[0] && self.dns6[1]) - d_warn("Ignore DNS : %s", v); + ogs_warn("Ignore DNS : %s", v); else if (self.dns6[0]) self.dns6[1] = v; else self.dns6[0] = v; } else - d_warn("Ignore DNS : %s", v); + ogs_warn("Ignore DNS : %s", v); } } while( - yaml_iter_type(&dns_iter) == + ogs_yaml_iter_type(&dns_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(pgw_key, "p-cscf")) { - yaml_iter_t dns_iter; - yaml_iter_recurse(&pgw_iter, &dns_iter); - d_assert(yaml_iter_type(&dns_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t dns_iter; + ogs_yaml_iter_recurse(&pgw_iter, &dns_iter); + ogs_assert(ogs_yaml_iter_type(&dns_iter) != + YAML_MAPPING_NODE); self.num_of_p_cscf = 0; self.num_of_p_cscf6 = 0; @@ -808,130 +789,76 @@ status_t pgw_context_parse_config() { const char *v = NULL; - if (yaml_iter_type(&dns_iter) == + if (ogs_yaml_iter_type(&dns_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&dns_iter)) + if (!ogs_yaml_iter_next(&dns_iter)) break; } - v = yaml_iter_value(&dns_iter); + v = ogs_yaml_iter_value(&dns_iter); if (v) { - ipsubnet_t ipsub; - rv = core_ipsubnet(&ipsub, v, NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_ipsubnet_t ipsub; + rv = ogs_ipsubnet(&ipsub, v, NULL); + ogs_assert(rv == OGS_OK); if (ipsub.family == AF_INET) { if (self.num_of_p_cscf >= MAX_NUM_OF_P_CSCF) - d_warn("Ignore P-CSCF : %s", v); + ogs_warn("Ignore P-CSCF : %s", v); else self.p_cscf[self.num_of_p_cscf++] = v; } else if (ipsub.family == AF_INET6) { if (self.num_of_p_cscf6 >= MAX_NUM_OF_P_CSCF) - d_warn("Ignore P-CSCF : %s", v); + ogs_warn("Ignore P-CSCF : %s", v); else self.p_cscf6[self.num_of_p_cscf6++] = v; } else - d_warn("Ignore P-CSCF : %s", v); + ogs_warn("Ignore P-CSCF : %s", v); } } while( - yaml_iter_type(&dns_iter) == + ogs_yaml_iter_type(&dns_iter) == YAML_SEQUENCE_NODE); } else - d_warn("unknown key `%s`", pgw_key); + ogs_warn("unknown key `%s`", pgw_key); } } } rv = pgw_context_validation(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } -status_t pgw_context_setup_trace_module() -{ - int app = context_self()->logger.trace.app; - int diameter = context_self()->logger.trace.diameter; - int gtpv2 = context_self()->logger.trace.gtpv2; - int gtp = context_self()->logger.trace.gtp; - - if (app) - { - extern int _pgw_context; - d_trace_level(&_pgw_context, app); - } - - if (diameter) - { - extern int _pgw_fd_path; - d_trace_level(&_pgw_fd_path, diameter); - extern int _fd_init; - d_trace_level(&_fd_init, diameter); - extern int _fd_logger; - d_trace_level(&_fd_logger, diameter); - } - - if (gtpv2) - { - extern int _pgw_sm; - d_trace_level(&_pgw_sm, gtpv2); - extern int _pgw_s5c_build; - d_trace_level(&_pgw_s5c_build, gtpv2); - extern int _pgw_s5c_handler; - d_trace_level(&_pgw_s5c_handler, gtpv2); - - extern int _gtp_node; - d_trace_level(&_gtp_node, gtpv2); - extern int _gtp_message; - d_trace_level(&_gtp_message, gtpv2); - extern int _gtp_path; - d_trace_level(&_gtp_path, gtpv2); - extern int _gtp_xact; - d_trace_level(&_gtp_xact, gtpv2); - - extern int _tlv_msg; - d_trace_level(&_tlv_msg, gtpv2); - } - - if (gtp) - { - extern int _pgw_gtp_path; - d_trace_level(&_pgw_gtp_path, gtp); - extern int _pgw_ipfw; - d_trace_level(&_pgw_ipfw, gtp); - } - - return CORE_OK; -} - -static void *sess_hash_keygen(c_uint8_t *out, int *out_len, - c_uint8_t *imsi, int imsi_len, c_int8_t *apn) +static void *sess_hash_keygen(uint8_t *out, int *out_len, + uint8_t *imsi, int imsi_len, char *apn) { memcpy(out, imsi, imsi_len); - core_cpystrn((char*)(out+imsi_len), apn, MAX_APN_LEN+1); + ogs_cpystrn((char*)(out+imsi_len), apn, MAX_APN_LEN+1); *out_len = imsi_len+strlen((char*)(out+imsi_len)); return out; } pgw_sess_t *pgw_sess_add( - c_uint8_t *imsi, int imsi_len, c_int8_t *apn, - c_uint8_t pdn_type, c_uint8_t ebi) + uint8_t *imsi, int imsi_len, char *apn, + uint8_t pdn_type, uint8_t ebi) { - char buf1[CORE_ADDRSTRLEN]; - char buf2[CORE_ADDRSTRLEN]; + char buf1[OGS_ADDRSTRLEN]; + char buf2[OGS_ADDRSTRLEN]; pgw_sess_t *sess = NULL; pgw_bearer_t *bearer = NULL; pgw_subnet_t *subnet6 = NULL; - index_alloc(&pgw_sess_pool, &sess); - d_assert(sess, return NULL, "Null param"); + ogs_pool_alloc(&pgw_sess_pool, &sess); + ogs_assert(sess); + sess->index = ogs_pool_index(&pgw_sess_pool, sess); + ogs_assert(sess->index > 0 && sess->index <= MAX_POOL_OF_SESS); sess->gnode = NULL; @@ -940,37 +867,33 @@ pgw_sess_t *pgw_sess_add( /* Set IMSI */ sess->imsi_len = imsi_len; memcpy(sess->imsi, imsi, sess->imsi_len); - core_buffer_to_bcd(sess->imsi, sess->imsi_len, sess->imsi_bcd); + ogs_buffer_to_bcd(sess->imsi, sess->imsi_len, sess->imsi_bcd); /* Set APN */ - core_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1); + ogs_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1); - list_init(&sess->bearer_list); + ogs_list_init(&sess->bearer_list); - core_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1); + ogs_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1); bearer = pgw_bearer_add(sess); - d_assert(bearer, pgw_sess_remove(sess); return NULL, - "Can't add default bearer context"); + ogs_assert(bearer); bearer->ebi = ebi; sess->pdn.paa.pdn_type = pdn_type; if (pdn_type == GTP_PDN_TYPE_IPV4) { sess->ipv4 = pgw_ue_ip_alloc(AF_INET, apn); - d_assert(sess->ipv4, pgw_sess_remove(sess); return NULL, - "Can't allocate IPv4 Pool"); + ogs_assert(sess->ipv4); sess->pdn.paa.addr = sess->ipv4->addr[0]; } else if (pdn_type == GTP_PDN_TYPE_IPV6) { sess->ipv6 = pgw_ue_ip_alloc(AF_INET6, apn); - d_assert(sess->ipv6, pgw_sess_remove(sess); return NULL, - "Can't allocate IPv6 Pool"); + ogs_assert(sess->ipv6); subnet6 = sess->ipv6->subnet; - d_assert(subnet6, pgw_sess_remove(sess); return NULL, - "No IPv6 subnet"); + ogs_assert(subnet6); sess->pdn.paa.len = subnet6->prefixlen; memcpy(sess->pdn.paa.addr6, sess->ipv6->addr, IPV6_LEN); @@ -978,41 +901,38 @@ pgw_sess_t *pgw_sess_add( else if (pdn_type == GTP_PDN_TYPE_IPV4V6) { sess->ipv4 = pgw_ue_ip_alloc(AF_INET, apn); - d_assert(sess->ipv4, pgw_sess_remove(sess); return NULL, - "Can't allocate IPv4 Pool"); + ogs_assert(sess->ipv4); sess->ipv6 = pgw_ue_ip_alloc(AF_INET6, apn); - d_assert(sess->ipv6, pgw_sess_remove(sess); return NULL, - "Can't allocate IPv6 Pool"); + ogs_assert(sess->ipv6); subnet6 = sess->ipv6->subnet; - d_assert(subnet6, pgw_sess_remove(sess); return NULL, - "No IPv6 subnet"); + ogs_assert(subnet6); sess->pdn.paa.both.addr = sess->ipv4->addr[0]; sess->pdn.paa.both.len = subnet6->prefixlen; memcpy(sess->pdn.paa.both.addr6, sess->ipv6->addr, IPV6_LEN); } else - d_assert(0, return NULL, "Unsupported PDN Type(%d)", pdn_type); + ogs_assert_if_reached(); - d_trace(1, "UE IPv4:[%s] IPv6:[%s]\n", + ogs_info("UE IPv4:[%s] IPv6:[%s]", sess->ipv4 ? INET_NTOP(&sess->ipv4->addr, buf1) : "", sess->ipv6 ? INET6_NTOP(&sess->ipv6->addr, buf2) : ""); /* Generate Hash Key : IMSI + APN */ sess_hash_keygen(sess->hash_keybuf, &sess->hash_keylen, imsi, imsi_len, apn); - hash_set(self.sess_hash, sess->hash_keybuf, sess->hash_keylen, sess); + ogs_hash_set(self.sess_hash, sess->hash_keybuf, sess->hash_keylen, sess); return sess; } -status_t pgw_sess_remove(pgw_sess_t *sess) +int pgw_sess_remove(pgw_sess_t *sess) { - d_assert(self.sess_hash, return CORE_ERROR, "Null param"); - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(self.sess_hash); + ogs_assert(sess); - hash_set(self.sess_hash, sess->hash_keybuf, sess->hash_keylen, NULL); + ogs_hash_set(self.sess_hash, sess->hash_keybuf, sess->hash_keylen, NULL); if (sess->ipv4) pgw_ue_ip_free(sess->ipv4); @@ -1021,14 +941,14 @@ status_t pgw_sess_remove(pgw_sess_t *sess) pgw_bearer_remove_all(sess); - index_free(&pgw_sess_pool, sess); + ogs_pool_free(&pgw_sess_pool, sess); - return CORE_OK; + return OGS_OK; } -status_t pgw_sess_remove_all() +void pgw_sess_remove_all() { - hash_index_t *hi = NULL; + ogs_hash_index_t *hi = NULL; pgw_sess_t *sess = NULL; for (hi = pgw_sess_first(); hi; hi = pgw_sess_next(hi)) @@ -1036,36 +956,34 @@ status_t pgw_sess_remove_all() sess = pgw_sess_this(hi); pgw_sess_remove(sess); } - - return CORE_OK; } -pgw_sess_t* pgw_sess_find(index_t index) +pgw_sess_t* pgw_sess_find(uint32_t index) { - d_assert(index, return NULL, "Invalid Index"); - return index_find(&pgw_sess_pool, index); + ogs_assert(index); + return ogs_pool_find(&pgw_sess_pool, index); } -pgw_sess_t* pgw_sess_find_by_teid(c_uint32_t teid) +pgw_sess_t* pgw_sess_find_by_teid(uint32_t teid) { return pgw_sess_find(teid); } pgw_sess_t* pgw_sess_find_by_imsi_apn( - c_uint8_t *imsi, int imsi_len, c_int8_t *apn) + uint8_t *imsi, int imsi_len, char *apn) { - c_uint8_t keybuf[MAX_IMSI_LEN+MAX_APN_LEN+1]; + uint8_t keybuf[MAX_IMSI_LEN+MAX_APN_LEN+1]; int keylen = 0; - d_assert(self.sess_hash, return NULL, "Null param"); + ogs_assert(self.sess_hash); sess_hash_keygen(keybuf, &keylen, imsi, imsi_len, apn); - return (pgw_sess_t *)hash_get(self.sess_hash, keybuf, keylen); + return (pgw_sess_t *)ogs_hash_get(self.sess_hash, keybuf, keylen); } gtp_node_t *pgw_sgw_add_by_message(gtp_message_t *message) { - status_t rv; + int rv; gtp_node_t *sgw = NULL; gtp_f_teid_t *sgw_s5c_teid = NULL; @@ -1073,24 +991,24 @@ gtp_node_t *pgw_sgw_add_by_message(gtp_message_t *message) if (req->sender_f_teid_for_control_plane.presence == 0) { - d_error("No Sender F-TEID"); + ogs_error("No Sender F-TEID"); return NULL; } sgw_s5c_teid = req->sender_f_teid_for_control_plane.data; - d_assert(sgw_s5c_teid, return NULL,); + ogs_assert(sgw_s5c_teid); sgw = gtp_find_node(&pgw_self()->sgw_s5c_list, sgw_s5c_teid); if (!sgw) { sgw = gtp_add_node(&pgw_self()->sgw_s5c_list, sgw_s5c_teid, pgw_self()->gtpc_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(sgw, return NULL,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(sgw); - rv = gtp_client(sgw); - d_assert(rv == CORE_OK, return NULL,); + rv = gtp_connect(pgw_self()->gtpc_sock, pgw_self()->gtpc_sock6, sgw); + ogs_assert(rv == OGS_OK); } return sgw; @@ -1098,39 +1016,39 @@ gtp_node_t *pgw_sgw_add_by_message(gtp_message_t *message) pgw_sess_t *pgw_sess_add_by_message(gtp_message_t *message) { pgw_sess_t *sess = NULL; - c_int8_t apn[MAX_APN_LEN]; + char apn[MAX_APN_LEN]; gtp_create_session_request_t *req = &message->create_session_request; if (req->imsi.presence == 0) { - d_error("No IMSI"); + ogs_error("No IMSI"); return NULL; } if (req->access_point_name.presence == 0) { - d_error("No APN"); + ogs_error("No APN"); return NULL; } if (req->bearer_contexts_to_be_created.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return NULL; } if (req->bearer_contexts_to_be_created.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return NULL; } if (req->pdn_type.presence == 0) { - d_error("No PDN Type"); + ogs_error("No PDN Type"); return NULL; } apn_parse(apn, req->access_point_name.data, req->access_point_name.len); - d_trace(9, "pgw_sess_add_by_message() [APN:%s, PDN:%d, EDI:%d]\n", + ogs_trace("pgw_sess_add_by_message() [APN:%s, PDN:%d, EDI:%d]", apn, req->pdn_type.u8, req->bearer_contexts_to_be_created.eps_bearer_id.u8); @@ -1140,104 +1058,96 @@ pgw_sess_t *pgw_sess_add_by_message(gtp_message_t *message) sess = pgw_sess_add(req->imsi.data, req->imsi.len, apn, req->pdn_type.u8, req->bearer_contexts_to_be_created.eps_bearer_id.u8); - d_assert(sess, return NULL, "No Session Context"); + ogs_assert(sess); } return sess; } -hash_index_t* pgw_sess_first() +ogs_hash_index_t* pgw_sess_first() { - d_assert(self.sess_hash, return NULL, "Null param"); - return hash_first(self.sess_hash); + ogs_assert(self.sess_hash); + return ogs_hash_first(self.sess_hash); } -hash_index_t* pgw_sess_next(hash_index_t *hi) +ogs_hash_index_t* pgw_sess_next(ogs_hash_index_t *hi) { - return hash_next(hi); + return ogs_hash_next(hi); } -pgw_sess_t *pgw_sess_this(hash_index_t *hi) +pgw_sess_t *pgw_sess_this(ogs_hash_index_t *hi) { - d_assert(hi, return NULL, "Null param"); - return hash_this_val(hi); + ogs_assert(hi); + return ogs_hash_this_val(hi); } pgw_bearer_t* pgw_bearer_add(pgw_sess_t *sess) { pgw_bearer_t *bearer = NULL; - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); - index_alloc(&pgw_bearer_pool, &bearer); - d_assert(bearer, return NULL, "Bearer context allocation failed"); + ogs_pool_alloc(&pgw_bearer_pool, &bearer); + ogs_assert(bearer); + bearer->index = ogs_pool_index(&pgw_bearer_pool, bearer); + ogs_assert(bearer->index > 0 && bearer->index <= MAX_POOL_OF_BEARER); bearer->name = NULL; - list_init(&bearer->pf_list); + ogs_list_init(&bearer->pf_list); bearer->pgw_s5u_teid = bearer->index; bearer->sess = sess; bearer->gnode = NULL; - list_append(&sess->bearer_list, bearer); + ogs_list_add(&sess->bearer_list, bearer); return bearer; } -status_t pgw_bearer_remove(pgw_bearer_t *bearer) +int pgw_bearer_remove(pgw_bearer_t *bearer) { - d_assert(bearer, return CORE_ERROR, "Null param"); - d_assert(bearer->sess, return CORE_ERROR, "Null param"); + ogs_assert(bearer); + ogs_assert(bearer->sess); - list_remove(&bearer->sess->bearer_list, bearer); + ogs_list_remove(&bearer->sess->bearer_list, bearer); if (bearer->name) - CORE_FREE(bearer->name); + ogs_free(bearer->name); pgw_pf_remove_all(bearer); - index_free(&pgw_bearer_pool, bearer); + ogs_pool_free(&pgw_bearer_pool, bearer); - return CORE_OK; + return OGS_OK; } -status_t pgw_bearer_remove_all(pgw_sess_t *sess) +void pgw_bearer_remove_all(pgw_sess_t *sess) { pgw_bearer_t *bearer = NULL, *next_bearer = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); - - bearer = list_first(&sess->bearer_list); - while (bearer) - { - next_bearer = list_next(bearer); - + ogs_assert(sess); + ogs_list_for_each_safe(&sess->bearer_list, next_bearer, bearer) pgw_bearer_remove(bearer); - - bearer = next_bearer; - } - - return CORE_OK; } -pgw_bearer_t* pgw_bearer_find(index_t index) +pgw_bearer_t* pgw_bearer_find(uint32_t index) { - d_assert(index, return NULL, "Invalid Index"); - return index_find(&pgw_bearer_pool, index); + ogs_assert(index); + return ogs_pool_find(&pgw_bearer_pool, index); } -pgw_bearer_t* pgw_bearer_find_by_pgw_s5u_teid(c_uint32_t pgw_s5u_teid) +pgw_bearer_t* pgw_bearer_find_by_pgw_s5u_teid(uint32_t pgw_s5u_teid) { return pgw_bearer_find(pgw_s5u_teid); } -pgw_bearer_t* pgw_bearer_find_by_ebi(pgw_sess_t *sess, c_uint8_t ebi) +pgw_bearer_t* pgw_bearer_find_by_ebi(pgw_sess_t *sess, uint8_t ebi) { pgw_bearer_t *bearer = NULL; - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); bearer = pgw_bearer_first(sess); while (bearer) @@ -1251,12 +1161,12 @@ pgw_bearer_t* pgw_bearer_find_by_ebi(pgw_sess_t *sess, c_uint8_t ebi) return bearer; } -pgw_bearer_t* pgw_bearer_find_by_name(pgw_sess_t *sess, c_int8_t *name) +pgw_bearer_t* pgw_bearer_find_by_name(pgw_sess_t *sess, char *name) { pgw_bearer_t *bearer = NULL; - d_assert(sess, return NULL, "Null param"); - d_assert(name, return NULL, "Null param"); + ogs_assert(sess); + ogs_assert(name); bearer = pgw_bearer_first(sess); while (bearer) @@ -1271,14 +1181,14 @@ pgw_bearer_t* pgw_bearer_find_by_name(pgw_sess_t *sess, c_int8_t *name) } pgw_bearer_t* pgw_bearer_find_by_qci_arp(pgw_sess_t *sess, - c_uint8_t qci, - c_uint8_t priority_level, - c_uint8_t pre_emption_capability, - c_uint8_t pre_emption_vulnerability) + uint8_t qci, + uint8_t priority_level, + uint8_t pre_emption_capability, + uint8_t pre_emption_vulnerability) { pgw_bearer_t *bearer = NULL; - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); bearer = pgw_default_bearer_in_sess(sess); if (!bearer) return NULL; @@ -1318,63 +1228,53 @@ pgw_bearer_t* pgw_default_bearer_in_sess(pgw_sess_t *sess) pgw_bearer_t* pgw_bearer_first(pgw_sess_t *sess) { - d_assert(sess, return NULL, "Null param"); - return list_first(&sess->bearer_list); + ogs_assert(sess); + return ogs_list_first(&sess->bearer_list); } pgw_bearer_t* pgw_bearer_next(pgw_bearer_t *bearer) { - return list_next(bearer); + return ogs_list_next(bearer); } -pgw_pf_t *pgw_pf_add(pgw_bearer_t *bearer, c_uint32_t precedence) +pgw_pf_t *pgw_pf_add(pgw_bearer_t *bearer, uint32_t precedence) { pgw_pf_t *pf = NULL; - d_assert(bearer, return NULL, "Null param"); + ogs_assert(bearer); - pool_alloc_node(&pgw_pf_pool, &pf); - d_assert(pf, return NULL, "Null param"); + ogs_pool_alloc(&pgw_pf_pool, &pf); + ogs_assert(pf); pf->identifier = NEXT_ID(bearer->pf_identifier, 1, 15); pf->bearer = bearer; - list_append(&bearer->pf_list, pf); + ogs_list_add(&bearer->pf_list, pf); return pf; } -status_t pgw_pf_remove(pgw_pf_t *pf) +int pgw_pf_remove(pgw_pf_t *pf) { - d_assert(pf, return CORE_ERROR, "Null param"); - d_assert(pf->bearer, return CORE_ERROR, "Null param"); + ogs_assert(pf); + ogs_assert(pf->bearer); - list_remove(&pf->bearer->pf_list, pf); - pool_free_node(&pgw_pf_pool, pf); + ogs_list_remove(&pf->bearer->pf_list, pf); + ogs_pool_free(&pgw_pf_pool, pf); - return CORE_OK; + return OGS_OK; } -status_t pgw_pf_remove_all(pgw_bearer_t *bearer) +void pgw_pf_remove_all(pgw_bearer_t *bearer) { pgw_pf_t *pf = NULL, *next_pf = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); - - pf = pgw_pf_first(bearer); - while (pf) - { - next_pf = pgw_pf_next(pf); - + ogs_assert(bearer); + ogs_list_for_each_safe(&bearer->pf_list, next_pf, pf) pgw_pf_remove(pf); - - pf = next_pf; - } - - return CORE_OK; } -pgw_pf_t* pgw_pf_find_by_id(pgw_bearer_t *bearer, c_uint8_t id) +pgw_pf_t* pgw_pf_find_by_id(pgw_bearer_t *bearer, uint8_t id) { pgw_pf_t *pf = NULL; @@ -1387,20 +1287,20 @@ pgw_pf_t* pgw_pf_find_by_id(pgw_bearer_t *bearer, c_uint8_t id) pf = pgw_pf_next(pf); } - return CORE_OK; + return OGS_OK; } pgw_pf_t* pgw_pf_first(pgw_bearer_t *bearer) { - return list_first(&bearer->pf_list); + return ogs_list_first(&bearer->pf_list); } pgw_pf_t* pgw_pf_next(pgw_pf_t *pf) { - return list_next(pf); + return ogs_list_next(pf); } -status_t pgw_ue_pool_generate() +int pgw_ue_pool_generate() { int j; pgw_subnet_t *subnet = NULL; @@ -1408,8 +1308,8 @@ status_t pgw_ue_pool_generate() for (subnet = pgw_subnet_first(); subnet; subnet = pgw_subnet_next(subnet)) { int index = 0; - c_uint32_t mask_count; - c_uint32_t broadcast[4]; + uint32_t mask_count; + uint32_t broadcast[4]; if (subnet->family == AF_INET) { @@ -1418,7 +1318,10 @@ status_t pgw_ue_pool_generate() else if (subnet->prefixlen < 32) mask_count = (0xffffffff >> subnet->prefixlen) + 1; else - d_assert(0, return CORE_ERROR,); + { + ogs_assert_if_reached(); + return OGS_ERROR; + } } else if (subnet->family == AF_INET6) { @@ -1429,10 +1332,16 @@ status_t pgw_ue_pool_generate() else if (subnet->prefixlen <= 96) mask_count = 0xffffffff; else - d_assert(0, return CORE_ERROR,); + { + ogs_assert_if_reached(); + return OGS_ERROR; + } } else - d_assert(0, return CORE_ERROR,); + { + ogs_assert_if_reached(); + return OGS_ERROR; + } for (j = 0; j < 4; j++) { @@ -1445,8 +1354,8 @@ status_t pgw_ue_pool_generate() int maxbytes = 0; int lastindex = 0; - ue_ip = &subnet->pool.pool[index]; - d_assert(ue_ip, return CORE_ERROR,); + ue_ip = &subnet->pool.array[index]; + ogs_assert(ue_ip); memset(ue_ip, 0, sizeof *ue_ip); if (subnet->family == AF_INET) @@ -1478,22 +1387,22 @@ status_t pgw_ue_pool_generate() subnet->pool.size = subnet->pool.avail = index; } - return CORE_OK; + return OGS_OK; } static pgw_subnet_t *find_subnet(int family, const char *apn) { pgw_subnet_t *subnet = NULL; - d_assert(apn, return NULL,); - d_assert(family == AF_INET || family == AF_INET6, return NULL,); + ogs_assert(apn); + ogs_assert(family == AF_INET || family == AF_INET6); for (subnet = pgw_subnet_first(); subnet; subnet = pgw_subnet_next(subnet)) { if (strlen(subnet->apn)) { if (subnet->family == family && strcmp(subnet->apn, apn) == 0 && - pool_avail(&subnet->pool)) + ogs_pool_avail(&subnet->pool)) { return subnet; } @@ -1505,7 +1414,7 @@ static pgw_subnet_t *find_subnet(int family, const char *apn) if (strlen(subnet->apn) == 0) { if (subnet->family == family && - pool_avail(&subnet->pool)) + ogs_pool_avail(&subnet->pool)) { return subnet; } @@ -1513,7 +1422,7 @@ static pgw_subnet_t *find_subnet(int family, const char *apn) } if (subnet == NULL) - d_error("CHECK CONFIGURATION: Cannot find UE Pool"); + ogs_error("CHECK CONFIGURATION: Cannot find UE Pool"); return subnet; } @@ -1523,83 +1432,74 @@ pgw_ue_ip_t *pgw_ue_ip_alloc(int family, const char *apn) pgw_subnet_t *subnet = NULL; pgw_ue_ip_t *ue_ip = NULL; - d_assert(apn, return NULL,); + ogs_assert(apn); subnet = find_subnet(family, apn); - d_assert(subnet, return NULL,); + ogs_assert(subnet); - pool_alloc_node(&subnet->pool, &ue_ip); - d_assert(ue_ip, return NULL,); + ogs_pool_alloc(&subnet->pool, &ue_ip); + ogs_assert(ue_ip); return ue_ip; } -status_t pgw_ue_ip_free(pgw_ue_ip_t *ue_ip) +int pgw_ue_ip_free(pgw_ue_ip_t *ue_ip) { pgw_subnet_t *subnet = NULL; - d_assert(ue_ip, return CORE_ERROR,); + ogs_assert(ue_ip); subnet = ue_ip->subnet; - d_assert(subnet, return CORE_ERROR,); - pool_free_node(&subnet->pool, ue_ip); + ogs_assert(subnet); + ogs_pool_free(&subnet->pool, ue_ip); - return CORE_OK; + return OGS_OK; } pgw_dev_t *pgw_dev_add(const char *ifname) { pgw_dev_t *dev = NULL; - d_assert(ifname, return NULL,); + ogs_assert(ifname); - pool_alloc_node(&pgw_dev_pool, &dev); - d_assert(dev, return NULL,); + ogs_pool_alloc(&pgw_dev_pool, &dev); + ogs_assert(dev); memset(dev, 0, sizeof *dev); strcpy(dev->ifname, ifname); - list_append(&self.dev_list, dev); + ogs_list_add(&self.dev_list, dev); return dev; } -status_t pgw_dev_remove(pgw_dev_t *dev) +int pgw_dev_remove(pgw_dev_t *dev) { - d_assert(dev, return CORE_ERROR, "Null param"); + ogs_assert(dev); - list_remove(&self.dev_list, dev); + ogs_list_remove(&self.dev_list, dev); if (dev->link_local_addr) - core_freeaddrinfo(dev->link_local_addr); + ogs_freeaddrinfo(dev->link_local_addr); - pool_free_node(&pgw_dev_pool, dev); + ogs_pool_free(&pgw_dev_pool, dev); - return CORE_OK; + return OGS_OK; } -status_t pgw_dev_remove_all() +void pgw_dev_remove_all() { pgw_dev_t *dev = NULL, *next_dev = NULL; - dev = pgw_dev_first(); - while (dev) - { - next_dev = pgw_dev_next(dev); - + ogs_list_for_each_safe(&self.dev_list, next_dev, dev) pgw_dev_remove(dev); - - dev = next_dev; - } - - return CORE_OK; } pgw_dev_t* pgw_dev_find_by_ifname(const char *ifname) { pgw_dev_t *dev = NULL; - d_assert(ifname, return NULL,); + ogs_assert(ifname); dev = pgw_dev_first(); while (dev) @@ -1610,47 +1510,47 @@ pgw_dev_t* pgw_dev_find_by_ifname(const char *ifname) dev = pgw_dev_next(dev); } - return CORE_OK; + return OGS_OK; } pgw_dev_t* pgw_dev_first() { - return list_first(&self.dev_list); + return ogs_list_first(&self.dev_list); } pgw_dev_t* pgw_dev_next(pgw_dev_t *dev) { - return list_next(dev); + return ogs_list_next(dev); } pgw_subnet_t *pgw_subnet_add( const char *ipstr, const char *mask_or_numbits, const char *apn, const char *ifname) { - status_t rv; + int rv; pgw_dev_t *dev = NULL; pgw_subnet_t *subnet = NULL; - d_assert(ipstr, return NULL,); - d_assert(mask_or_numbits, return NULL,); - d_assert(ifname, return NULL,); + ogs_assert(ipstr); + ogs_assert(mask_or_numbits); + ogs_assert(ifname); dev = pgw_dev_find_by_ifname(ifname); if (!dev) dev = pgw_dev_add(ifname); - d_assert(dev, return NULL,); + ogs_assert(dev); - pool_alloc_node(&pgw_subnet_pool, &subnet); - d_assert(subnet, return NULL,); + ogs_pool_alloc(&pgw_subnet_pool, &subnet); + ogs_assert(subnet); memset(subnet, 0, sizeof *subnet); subnet->dev = dev; - rv = core_ipsubnet(&subnet->gw, ipstr, NULL); - d_assert(rv == CORE_OK, return NULL,); + rv = ogs_ipsubnet(&subnet->gw, ipstr, NULL); + ogs_assert(rv == OGS_OK); - rv = core_ipsubnet(&subnet->sub, ipstr, mask_or_numbits); - d_assert(rv == CORE_OK, return NULL,); + rv = ogs_ipsubnet(&subnet->sub, ipstr, mask_or_numbits); + ogs_assert(rv == OGS_OK); if (apn) strcpy(subnet->apn, apn); @@ -1658,56 +1558,40 @@ pgw_subnet_t *pgw_subnet_add( subnet->family = subnet->gw.family; subnet->prefixlen = atoi(mask_or_numbits); - pool_init(&subnet->pool, MAX_POOL_OF_SESS); + ogs_pool_init(&subnet->pool, MAX_POOL_OF_SESS); - list_append(&self.subnet_list, subnet); + ogs_list_add(&self.subnet_list, subnet); return subnet; } -status_t pgw_subnet_remove(pgw_subnet_t *subnet) +int pgw_subnet_remove(pgw_subnet_t *subnet) { - d_assert(subnet, return CORE_ERROR, "Null param"); + ogs_assert(subnet); - list_remove(&self.subnet_list, subnet); + ogs_list_remove(&self.subnet_list, subnet); - if (pool_used(&subnet->pool)) - { - d_warn("%d not freed in ue_ip_pool[%d] in PGW-Context", - pool_used(&subnet->pool), pool_size(&subnet->pool)); - } - d_trace(9, "%d not freed in ue_ip_pool[%d] in PGW-Context\n", - pool_used(&subnet->pool), pool_size(&subnet->pool)); - pool_final(&subnet->pool); + ogs_pool_final(&subnet->pool); - pool_free_node(&pgw_subnet_pool, subnet); + ogs_pool_free(&pgw_subnet_pool, subnet); - return CORE_OK; + return OGS_OK; } -status_t pgw_subnet_remove_all() +void pgw_subnet_remove_all() { pgw_subnet_t *subnet = NULL, *next_subnet = NULL; - subnet = pgw_subnet_first(); - while (subnet) - { - next_subnet = pgw_subnet_next(subnet); - + ogs_list_for_each_safe(&self.subnet_list, next_subnet, subnet) pgw_subnet_remove(subnet); - - subnet = next_subnet; - } - - return CORE_OK; } pgw_subnet_t* pgw_subnet_first() { - return list_first(&self.subnet_list); + return ogs_list_first(&self.subnet_list); } pgw_subnet_t* pgw_subnet_next(pgw_subnet_t *subnet) { - return list_next(subnet); + return ogs_list_next(subnet); } diff --git a/src/pgw/pgw_context.h b/src/pgw/pgw_context.h index feb3b6e28..d66efdd4e 100644 --- a/src/pgw/pgw_context.h +++ b/src/pgw/pgw_context.h @@ -1,14 +1,6 @@ #ifndef __PGW_CONTEXT_H__ #define __PGW_CONTEXT_H__ -#include "core_list.h" -#include "core_index.h" -#include "core_errno.h" -#include "core_hash.h" -#include "core_network.h" -#include "core_msgq.h" -#include "core_timer.h" - #include "gtp/gtp_types.h" #include "gtp/gtp_message.h" @@ -19,6 +11,11 @@ extern "C" { #define MAX_NUM_OF_DEV 16 #define MAX_NUM_OF_SUBNET 16 +extern int __pgw_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __pgw_log_domain + typedef struct _gtp_node_t gtp_node_t; typedef struct _fd_config_t fd_config_t; @@ -26,29 +23,30 @@ typedef struct _pgw_context_t { const char* fd_conf_path; /* PGW freeDiameter conf path */ fd_config_t *fd_config; /* PGW freeDiameter config */ - c_uint32_t gtpc_port; /* Default: PGW GTP-C local port */ - c_uint32_t gtpu_port; /* Default: PGW GTP-U local port */ + uint32_t gtpc_port; /* Default: PGW GTP-C local port */ + uint32_t gtpu_port; /* Default: PGW GTP-U local port */ const char *tun_ifname; /* Default:: pgwtun */ - list_t gtpc_list; /* PGW GTPC IPv4 Server List */ - list_t gtpc_list6; /* PGW GTPC IPv6 Server List */ - sock_id gtpc_sock; /* PGW GTPC IPv4 Socket */ - sock_id gtpc_sock6; /* PGW GTPC IPv6 Socket */ - c_sockaddr_t *gtpc_addr; /* PGW GTPC IPv4 Address */ - c_sockaddr_t *gtpc_addr6; /* PGW GTPC IPv6 Address */ + ogs_list_t gtpc_list; /* PGW GTPC IPv4 Server List */ + ogs_list_t gtpc_list6; /* PGW GTPC IPv6 Server List */ + ogs_sock_t *gtpc_sock; /* PGW GTPC IPv4 Socket */ + ogs_sock_t *gtpc_sock6; /* PGW GTPC IPv6 Socket */ + ogs_sockaddr_t *gtpc_addr; /* PGW GTPC IPv4 Address */ + ogs_sockaddr_t *gtpc_addr6; /* PGW GTPC IPv6 Address */ - list_t gtpu_list; /* PGW GTPU IPv4 Server List */ - list_t gtpu_list6; /* PGW GTPU IPv6 Server List */ - sock_id gtpu_sock; /* PGW GTPU IPv4 Socket */ - sock_id gtpu_sock6; /* PGW GTPU IPv6 Socket */ - c_sockaddr_t *gtpu_addr; /* PGW GTPU IPv4 Address */ - c_sockaddr_t *gtpu_addr6; /* PGW GTPU IPv6 Address */ + ogs_list_t gtpu_list; /* PGW GTPU IPv4 Server List */ + ogs_list_t gtpu_list6; /* PGW GTPU IPv6 Server List */ + ogs_sock_t *gtpu_sock; /* PGW GTPU IPv4 Socket */ + ogs_sock_t *gtpu_sock6; /* PGW GTPU IPv6 Socket */ + ogs_sockaddr_t *gtpu_addr; /* PGW GTPU IPv4 Address */ + ogs_sockaddr_t *gtpu_addr6; /* PGW GTPU IPv6 Address */ - list_t dev_list; /* PGW Tun Device List */ - list_t subnet_list; /* PGW UE Subnet List */ + ogs_list_t dev_list; /* PGW Tun Device List */ + ogs_list_t subnet_list; /* PGW UE Subnet List */ - msgq_id queue_id; /* Qsesssess for processing PGW control plane */ - tm_service_t tm_service; /* Timer Service */ + ogs_queue_t *queue; /* Queue for processing PGW control */ + ogs_timer_mgr_t *timer_mgr; /* Timer Manager */ + ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */ #define MAX_NUM_OF_DNS 2 const char *dns[MAX_NUM_OF_DNS]; @@ -62,63 +60,58 @@ typedef struct _pgw_context_t { int num_of_p_cscf6; int p_cscf6_index; - list_t sgw_s5c_list; /* SGW GTPC Node List */ - list_t sgw_s5u_list; /* SGW GTPU Node List */ - list_t ip_pool_list; + ogs_list_t sgw_s5c_list; /* SGW GTPC Node List */ + ogs_list_t sgw_s5u_list; /* SGW GTPU Node List */ + ogs_list_t ip_pool_list; - hash_t *sess_hash; /* hash table (IMSI+APN) */ + ogs_hash_t *sess_hash; /* hash table (IMSI+APN) */ } pgw_context_t; typedef struct _pgw_subnet_t pgw_subnet_t; typedef struct _pgw_ue_ip_t { - c_uint32_t addr[4]; + uint32_t addr[4]; /* Related Context */ pgw_subnet_t *subnet; } pgw_ue_ip_t; typedef struct _pgw_dev_t { - lnode_t node; + ogs_lnode_t node; - c_int8_t ifname[IFNAMSIZ]; - sock_id sock; + char ifname[IFNAMSIZ]; + ogs_socket_t fd; - c_sockaddr_t *link_local_addr; + ogs_sockaddr_t *link_local_addr; + ogs_poll_t *poll; } pgw_dev_t; typedef struct _pgw_subnet_t { - lnode_t node; + ogs_lnode_t node; - ipsubnet_t sub; /* Subnet : cafe::0/64 */ - ipsubnet_t gw; /* Gateway : cafe::1 */ - c_int8_t apn[MAX_APN_LEN]; /* APN : "internet", "volte", .. */ + ogs_ipsubnet_t sub; /* Subnet : cafe::0/64 */ + ogs_ipsubnet_t gw; /* Gateway : cafe::1 */ + char apn[MAX_APN_LEN]; /* APN : "internet", "volte", .. */ - int family; /* AF_INET or AF_INET6 */ - c_uint8_t prefixlen; /* prefixlen */ - - struct { - int head, tail; - int size, avail; - mutex_id mut; - pgw_ue_ip_t *free[MAX_POOL_OF_SESS], pool[MAX_POOL_OF_SESS]; - } pool; + int family; /* AF_INET or AF_INET6 */ + uint8_t prefixlen; /* prefixlen */ + OGS_POOL(pool, pgw_ue_ip_t); /* Related Context */ pgw_dev_t *dev; } pgw_subnet_t; typedef struct _pgw_sess_t { - index_t index; /**< An index of this node */ + uint32_t index; /**< An index of this node */ - c_uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is derived from INDEX */ - c_uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is received from SGW */ + uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is derived from INDEX */ + uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is received from SGW */ - c_int8_t *gx_sid; /* Gx Session ID */ + char *gx_sid; /* Gx Session ID */ /* IMSI */ - c_uint8_t imsi[MAX_IMSI_LEN]; + uint8_t imsi[MAX_IMSI_LEN]; int imsi_len; - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; /* APN Configuration */ pdn_t pdn; @@ -130,145 +123,139 @@ typedef struct _pgw_sess_t { e_cgi_t e_cgi; /* Hash Key : IMSI+APN */ - c_uint8_t hash_keybuf[MAX_IMSI_LEN+MAX_APN_LEN+1]; + uint8_t hash_keybuf[MAX_IMSI_LEN+MAX_APN_LEN+1]; int hash_keylen; - list_t bearer_list; + ogs_list_t bearer_list; /* Related Context */ gtp_node_t *gnode; } pgw_sess_t; typedef struct _pgw_bearer_t { - lnode_t node; /**< A node of list_t */ - index_t index; + ogs_lnode_t node; /**< A node of list_t */ + uint32_t index; - c_uint8_t ebi; + uint8_t ebi; - c_uint32_t pgw_s5u_teid; /* PGW_S5U is derived from INDEX */ - c_uint32_t sgw_s5u_teid; /* SGW_S5U is received from SGW */ + uint32_t pgw_s5u_teid; /* PGW_S5U is derived from INDEX */ + uint32_t sgw_s5u_teid; /* SGW_S5U is received from SGW */ - c_int8_t *name; /* PCC Rule Name */ + char *name; /* PCC Rule Name */ qos_t qos; /* QoS Infomration */ /* Packet Filter Identifier Generator(1~15) */ - c_uint8_t pf_identifier; + uint8_t pf_identifier; /* Packet Filter List */ - list_t pf_list; + ogs_list_t pf_list; pgw_sess_t *sess; gtp_node_t *gnode; } pgw_bearer_t; typedef struct _pgw_rule_t { - c_uint8_t proto; -ED5(c_uint8_t ipv4_local:1;, - c_uint8_t ipv4_remote:1;, - c_uint8_t ipv6_local:1;, - c_uint8_t ipv6_remote:1;, - c_uint8_t reserved:4;) + uint8_t proto; +ED5(uint8_t ipv4_local:1;, + uint8_t ipv4_remote:1;, + uint8_t ipv6_local:1;, + uint8_t ipv6_remote:1;, + uint8_t reserved:4;) struct { struct { - c_uint32_t addr[4]; - c_uint32_t mask[4]; + uint32_t addr[4]; + uint32_t mask[4]; } local; struct { - c_uint32_t addr[4]; - c_uint32_t mask[4]; + uint32_t addr[4]; + uint32_t mask[4]; } remote; } ip; struct { struct { - c_uint16_t low; - c_uint16_t high; + uint16_t low; + uint16_t high; } local; struct { - c_uint16_t low; - c_uint16_t high; + uint16_t low; + uint16_t high; } remote; } port; } pgw_rule_t; typedef struct _pgw_pf_t { - lnode_t node; + ogs_lnode_t node; -ED3(c_uint8_t spare:2;, - c_uint8_t direction:2;, - c_uint8_t identifier:4;) +ED3(uint8_t spare:2;, + uint8_t direction:2;, + uint8_t identifier:4;) pgw_rule_t rule; pgw_bearer_t *bearer; } pgw_pf_t; -CORE_DECLARE(status_t) pgw_context_init(void); -CORE_DECLARE(status_t) pgw_context_final(void); -CORE_DECLARE(pgw_context_t*) pgw_self(void); +int pgw_context_init(void); +int pgw_context_final(void); +pgw_context_t *pgw_self(void); -CORE_DECLARE(status_t) pgw_context_parse_config(void); -CORE_DECLARE(status_t) pgw_context_setup_trace_module(void); +int pgw_context_parse_config(void); -CORE_DECLARE(gtp_node_t *) pgw_sgw_add_by_message(gtp_message_t *message); -CORE_DECLARE(pgw_sess_t *) pgw_sess_add_by_message(gtp_message_t *message); +gtp_node_t *pgw_sgw_add_by_message(gtp_message_t *message); +pgw_sess_t *pgw_sess_add_by_message(gtp_message_t *message); -CORE_DECLARE(pgw_sess_t*) pgw_sess_add( - c_uint8_t *imsi, int imsi_len, c_int8_t *apn, - c_uint8_t pdn_type, c_uint8_t ebi); -CORE_DECLARE(status_t ) pgw_sess_remove(pgw_sess_t *sess); -CORE_DECLARE(status_t ) pgw_sess_remove_all(); -CORE_DECLARE(pgw_sess_t*) pgw_sess_find(index_t index); -CORE_DECLARE(pgw_sess_t*) pgw_sess_find_by_teid(c_uint32_t teid); -CORE_DECLARE(pgw_sess_t*) pgw_sess_find_by_imsi_apn( - c_uint8_t *imsi, int imsi_len, c_int8_t *apn); -CORE_DECLARE(hash_index_t *) pgw_sess_first(); -CORE_DECLARE(hash_index_t *) pgw_sess_next(hash_index_t *hi); -CORE_DECLARE(pgw_sess_t *) pgw_sess_this(hash_index_t *hi); +pgw_sess_t *pgw_sess_add( + uint8_t *imsi, int imsi_len, char *apn, + uint8_t pdn_type, uint8_t ebi); +int pgw_sess_remove(pgw_sess_t *sess); +void pgw_sess_remove_all(); +pgw_sess_t *pgw_sess_find(uint32_t index); +pgw_sess_t *pgw_sess_find_by_teid(uint32_t teid); +pgw_sess_t *pgw_sess_find_by_imsi_apn(uint8_t *imsi, int imsi_len, char *apn); +ogs_hash_index_t *pgw_sess_first(); +ogs_hash_index_t *pgw_sess_next(ogs_hash_index_t *hi); +pgw_sess_t *pgw_sess_this(ogs_hash_index_t *hi); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_add(pgw_sess_t *sess); -CORE_DECLARE(status_t) pgw_bearer_remove(pgw_bearer_t *bearer); -CORE_DECLARE(status_t) pgw_bearer_remove_all(pgw_sess_t *sess); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find(index_t index); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_pgw_s5u_teid( - c_uint32_t pgw_s5u_teid); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_ebi( - pgw_sess_t *sess, c_uint8_t ebi); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_name( - pgw_sess_t *sess, c_int8_t *name); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_qci_arp(pgw_sess_t *sess, - c_uint8_t qci, - c_uint8_t priority_level, - c_uint8_t pre_emption_capability, - c_uint8_t pre_emption_vulnerability); -CORE_DECLARE(pgw_bearer_t*) pgw_default_bearer_in_sess(pgw_sess_t *sess); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_first(pgw_sess_t *sess); -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_next(pgw_bearer_t *bearer); +pgw_bearer_t *pgw_bearer_add(pgw_sess_t *sess); +int pgw_bearer_remove(pgw_bearer_t *bearer); +void pgw_bearer_remove_all(pgw_sess_t *sess); +pgw_bearer_t *pgw_bearer_find(uint32_t index); +pgw_bearer_t *pgw_bearer_find_by_pgw_s5u_teid(uint32_t pgw_s5u_teid); +pgw_bearer_t *pgw_bearer_find_by_ebi(pgw_sess_t *sess, uint8_t ebi); +pgw_bearer_t *pgw_bearer_find_by_name(pgw_sess_t *sess, char *name); +pgw_bearer_t *pgw_bearer_find_by_qci_arp(pgw_sess_t *sess, + uint8_t qci, + uint8_t priority_level, + uint8_t pre_emption_capability, + uint8_t pre_emption_vulnerability); +pgw_bearer_t *pgw_default_bearer_in_sess(pgw_sess_t *sess); +pgw_bearer_t *pgw_bearer_first(pgw_sess_t *sess); +pgw_bearer_t *pgw_bearer_next(pgw_bearer_t *bearer); -CORE_DECLARE(pgw_pf_t*) pgw_pf_add( - pgw_bearer_t *bearer, c_uint32_t precedence); -CORE_DECLARE(status_t ) pgw_pf_remove(pgw_pf_t *pf); -CORE_DECLARE(status_t ) pgw_pf_remove_all(pgw_bearer_t *bearer); -CORE_DECLARE(pgw_pf_t*) pgw_pf_find_by_id( - pgw_bearer_t *pgw_bearer, c_uint8_t id); -CORE_DECLARE(pgw_pf_t*) pgw_pf_first(pgw_bearer_t *bearer); -CORE_DECLARE(pgw_pf_t*) pgw_pf_next(pgw_pf_t *pf); +pgw_pf_t *pgw_pf_add(pgw_bearer_t *bearer, uint32_t precedence); +int pgw_pf_remove(pgw_pf_t *pf); +void pgw_pf_remove_all(pgw_bearer_t *bearer); +pgw_pf_t *pgw_pf_find_by_id(pgw_bearer_t *pgw_bearer, uint8_t id); +pgw_pf_t *pgw_pf_first(pgw_bearer_t *bearer); +pgw_pf_t *pgw_pf_next(pgw_pf_t *pf); -CORE_DECLARE(status_t ) pgw_ue_pool_generate(); -CORE_DECLARE(pgw_ue_ip_t *) pgw_ue_ip_alloc(int family, const char *apn); -CORE_DECLARE(status_t) pgw_ue_ip_free(pgw_ue_ip_t *ip); +int pgw_ue_pool_generate(); +pgw_ue_ip_t *pgw_ue_ip_alloc(int family, const char *apn); +int pgw_ue_ip_free(pgw_ue_ip_t *ip); -CORE_DECLARE(pgw_dev_t*) pgw_dev_add(const char *ifname); -CORE_DECLARE(status_t ) pgw_dev_remove(pgw_dev_t *dev); -CORE_DECLARE(status_t ) pgw_dev_remove_all(); -CORE_DECLARE(pgw_dev_t*) pgw_dev_find_by_ifname(const char *ifname); -CORE_DECLARE(pgw_dev_t*) pgw_dev_first(); -CORE_DECLARE(pgw_dev_t*) pgw_dev_next(pgw_dev_t *dev); +pgw_dev_t *pgw_dev_add(const char *ifname); +int pgw_dev_remove(pgw_dev_t *dev); +void pgw_dev_remove_all(); +pgw_dev_t *pgw_dev_find_by_ifname(const char *ifname); +pgw_dev_t *pgw_dev_first(); +pgw_dev_t *pgw_dev_next(pgw_dev_t *dev); -CORE_DECLARE(pgw_subnet_t*) pgw_subnet_add( +pgw_subnet_t *pgw_subnet_add( const char *ipstr, const char *mask_or_numbits, const char *apn, const char *ifname); -CORE_DECLARE(status_t ) pgw_subnet_remove(pgw_subnet_t *subnet); -CORE_DECLARE(status_t ) pgw_subnet_remove_all(); -CORE_DECLARE(pgw_subnet_t*) pgw_subnet_first(); -CORE_DECLARE(pgw_subnet_t*) pgw_subnet_next(pgw_subnet_t *subnet); +pgw_subnet_t *pgw_subnet_next(pgw_subnet_t *subnet); +int pgw_subnet_remove(pgw_subnet_t *subnet); +void pgw_subnet_remove_all(); +pgw_subnet_t *pgw_subnet_first(); +pgw_subnet_t *gw_subnet_next(pgw_subnet_t *subnet); #ifdef __cplusplus } diff --git a/src/pgw/pgw_event.c b/src/pgw/pgw_event.c index 42806ec75..92ac528e9 100644 --- a/src/pgw/pgw_event.c +++ b/src/pgw/pgw_event.c @@ -1,27 +1,91 @@ -#define TRACE_MODULE _pgw_event - #include "pgw_event.h" #include "pgw_context.h" -char* pgw_event_get_name(event_t *e) +#if defined(HAVE_KQUEUE) +/* + * kqueue does not support TUN/TAP character device + * So, PGW should use select action in I/O multiplexing + */ +extern const ogs_pollset_actions_t ogs_select_actions; + +extern ogs_pollset_actions_t ogs_pollset_actions; +extern bool ogs_pollset_actions_initialized; + +static void pollset_action_setup(void) +{ + ogs_pollset_actions = ogs_select_actions; + ogs_pollset_actions_initialized = true; +} +#endif + +#define EVENT_POOL 32 /* FIXME : 32 */ +static OGS_POOL(pool, pgw_event_t); + +void pgw_event_init(void) +{ + ogs_pool_init(&pool, EVENT_POOL); + +#if defined(HAVE_KQUEUE) + pollset_action_setup(); +#endif + + pgw_self()->queue = ogs_queue_create(EVENT_POOL); + ogs_assert(pgw_self()->queue); + pgw_self()->timer_mgr = ogs_timer_mgr_create(); + ogs_assert(pgw_self()->timer_mgr); + pgw_self()->pollset = ogs_pollset_create(); + ogs_assert(pgw_self()->pollset); +} + +void pgw_event_term(void) +{ + ogs_queue_term(pgw_self()->queue); + ogs_pollset_notify(pgw_self()->pollset); +} + +void pgw_event_final(void) +{ + if (pgw_self()->pollset) + ogs_pollset_destroy(pgw_self()->pollset); + if (pgw_self()->timer_mgr) + ogs_timer_mgr_destroy(pgw_self()->timer_mgr); + if (pgw_self()->queue) + ogs_queue_destroy(pgw_self()->queue); + + ogs_pool_final(&pool); +} + +pgw_event_t *pgw_event_new(pgw_event_e id) +{ + pgw_event_t *e = NULL; + + ogs_pool_alloc(&pool, &e); + ogs_assert(e); + e->id = id; + + return e; +} + +void pgw_event_free(pgw_event_t *e) +{ + ogs_assert(e); + ogs_pool_free(&pool, e); +} + +const char* pgw_event_get_name(pgw_event_t *e) { if (e == NULL) - return FSM_NAME_INIT_SIG; + return OGS_FSM_NAME_INIT_SIG; - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: - return FSM_NAME_ENTRY_SIG; - case FSM_EXIT_SIG: - return FSM_NAME_EXIT_SIG; + case OGS_FSM_ENTRY_SIG: + return OGS_FSM_NAME_ENTRY_SIG; + case OGS_FSM_EXIT_SIG: + return OGS_FSM_NAME_EXIT_SIG; case PGW_EVT_S5C_MESSAGE: return "PGW_EVT_S5C_MESSAGE"; - case PGW_EVT_S5C_T3_RESPONSE: - return "PGW_EVT_S5C_T3_RESPONSE"; - case PGW_EVT_S5C_T3_HOLDING: - return "PGW_EVT_S5C_T3_HOLDING"; - case PGW_EVT_GX_MESSAGE: return "PGW_EVT_GX_SESSION_MSG"; @@ -29,5 +93,5 @@ char* pgw_event_get_name(event_t *e) break; } - return EVT_NAME_UNKNOWN; + return "UNKNOWN_EVENT"; } diff --git a/src/pgw/pgw_event.h b/src/pgw/pgw_event.h index d1403b9e3..8b7412e34 100644 --- a/src/pgw/pgw_event.h +++ b/src/pgw/pgw_event.h @@ -1,29 +1,41 @@ #ifndef __PGW_EVENT_H__ #define __PGW_EVENT_H__ -#include "core_event.h" -#include "core_fsm.h" +#include "ogs-core.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef enum { - PGW_EVT_BASE = FSM_USER_SIG, + PGW_EVT_BASE = OGS_FSM_USER_SIG, PGW_EVT_S5C_MESSAGE, - PGW_EVT_S5C_T3_RESPONSE, - PGW_EVT_S5C_T3_HOLDING, - PGW_EVT_GX_MESSAGE, PGW_EVT_TOP, -} event_e; +} pgw_event_e; -#define pgw_event_send(__ptr_e) event_send(pgw_self()->queue_id, (__ptr_e)) +typedef struct pgw_event_s { + int id; + void *gtpbuf; + void *gxbuf; + ogs_index_t sess_index; + ogs_index_t xact_index; +} pgw_event_t; -CORE_DECLARE(char*) pgw_event_get_name(event_t *e); +void pgw_event_init(void); +void pgw_event_term(void); +void pgw_event_final(void); + +pgw_event_t *pgw_event_new(pgw_event_e id); +void pgw_event_free(pgw_event_t *e); + +#define pgw_event_send(__ptr_e) \ + ogs_assert(ogs_queue_push(pgw_self()->queue, ((__ptr_e))) == OGS_OK) + +const char *pgw_event_get_name(pgw_event_t *e); #ifdef __cplusplus } diff --git a/src/pgw/pgw_fd_path.c b/src/pgw/pgw_fd_path.c index 6e939af3d..26076b53e 100644 --- a/src/pgw/pgw_fd_path.c +++ b/src/pgw/pgw_fd_path.c @@ -1,9 +1,3 @@ -#define TRACE_MODULE _pgw_fd_path - -#include "core_debug.h" -#include "core_pool.h" -#include "core_lib.h" - #include "gtp/gtp_xact.h" #include "fd/fd_lib.h" @@ -22,17 +16,15 @@ struct sess_state { pgw_sess_t *sess; gtp_xact_t *xact; - pkbuf_t *gtpbuf; + ogs_pkbuf_t *gtpbuf; - c_uint32_t cc_request_type; - c_uint32_t cc_request_number; + uint32_t cc_request_type; + uint32_t cc_request_number; struct timespec ts; /* Time of sending the message */ }; -pool_declare(pgw_gx_sess_pool, struct sess_state, MAX_POOL_OF_DIAMETER_SESS); - -static status_t decode_pcc_rule_definition( +static int decode_pcc_rule_definition( pcc_rule_t *pcc_rule, struct avp *avpch1, int *perror); static void pgw_gx_cca_cb(void *data, struct msg **msg); @@ -40,12 +32,9 @@ static __inline__ struct sess_state *new_state(os0_t sid) { struct sess_state *new = NULL; - pool_alloc_node(&pgw_gx_sess_pool, &new); - d_assert(new, return NULL,); - memset(new, 0, sizeof *new); - - new->gx_sid = (os0_t)core_strdup((char *)sid); - d_assert(new->gx_sid, return NULL,); + new = ogs_calloc(1, sizeof(*new)); + new->gx_sid = (os0_t)ogs_strdup((char *)sid); + ogs_assert(new->gx_sid); return new; } @@ -53,13 +42,13 @@ static __inline__ struct sess_state *new_state(os0_t sid) static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque) { if (sess_data->gx_sid) - CORE_FREE(sess_data->gx_sid); + ogs_free(sess_data->gx_sid); - pool_free_node(&pgw_gx_sess_pool, sess_data); + ogs_free(sess_data); } void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, - pkbuf_t *gtpbuf, c_uint32_t cc_request_type) + ogs_pkbuf_t *gtpbuf, uint32_t cc_request_type) { int ret; @@ -73,17 +62,17 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, gtp_message_t *message = NULL; paa_t paa; /* For changing Framed-IPv6-Prefix Length to 128 */ - d_assert(sess, return,); - d_assert(sess->ipv4 || sess->ipv6, return,); - d_assert(gtpbuf, return, ); - message = gtpbuf->payload; - d_assert(message, return, ); + ogs_assert(sess); + ogs_assert(sess->ipv4 || sess->ipv6); + ogs_assert(gtpbuf); + message = gtpbuf->data; + ogs_assert(message); - d_trace(3, "[PGW] Credit-Control-Request\n"); + ogs_debug("[PGW2] Credit-Control-Request"); /* Create the request */ ret = fd_msg_new(gx_cmd_ccr, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Find Diameter Gx Session */ if (sess->gx_sid) @@ -91,12 +80,12 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, /* Retrieve session by Session-Id */ size_t sidlen = strlen(sess->gx_sid); ret = fd_sess_fromsid_msg((os0_t)sess->gx_sid, sidlen, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return,); + ogs_assert(ret == 0); + ogs_assert(new == 0); /* Add Session-Id to the message */ ret = fd_message_session_id_set(req, (os0_t)sess->gx_sid, sidlen); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Save the session associated with the message */ ret = fd_msg_sess_set(req, session); } @@ -106,9 +95,9 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, #define GX_APP_SID_OPT "app_gx" ret = fd_msg_new_session(req, (os0_t)GX_APP_SID_OPT, CONSTSTRLEN(GX_APP_SID_OPT)); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_sess_get(fd_g_config->cnf_dict, req, &session, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Retrieve session state in this session */ @@ -119,14 +108,14 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, size_t sidlen; ret = fd_sess_getsid(session, &sid, &sidlen); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Allocate new session state memory */ sess_data = new_state(sid); - d_assert(sess_data, return,); + ogs_assert(sess_data); /* Save Session-Id to PGW Session Context */ - sess->gx_sid = (c_int8_t *)sess_data->gx_sid; + sess->gx_sid = (char*)sess_data->gx_sid; } /* Update session state */ @@ -143,232 +132,232 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = GX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set CC-Request-Type, CC-Request-Number */ ret = fd_msg_avp_new(gx_cc_request_type, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = sess_data->cc_request_type; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_cc_request_number, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = sess_data->cc_request_number; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Subscription-Id */ ret = fd_msg_avp_new(gx_subscription_id, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_subscription_id_type, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = GX_SUBSCRIPTION_ID_TYPE_END_USER_IMSI; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_subscription_id_data, 0, &avpch1); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t *)sess->imsi_bcd; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)sess->imsi_bcd; val.os.len = strlen(sess->imsi_bcd); ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (cc_request_type != GX_CC_REQUEST_TYPE_TERMINATION_REQUEST) { /* Set Supported-Features */ ret = fd_msg_avp_new(gx_supported_features, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_feature_list_id, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_feature_list, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = 0x0000000b; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Network-Request-Support */ ret = fd_msg_avp_new(gx_network_request_support, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Framed-IP-Address */ if (sess->ipv4) { ret = fd_msg_avp_new(gx_framed_ip_address, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t*)&sess->ipv4->addr; + ogs_assert(ret == 0); + val.os.data = (uint8_t*)&sess->ipv4->addr; val.os.len = IPV4_LEN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Set Framed-IPv6-Prefix */ if (sess->ipv6) { ret = fd_msg_avp_new(gx_framed_ipv6_prefix, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); memcpy(&paa, &sess->pdn.paa, PAA_IPV6_LEN); #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ paa.len = FRAMED_IPV6_PREFIX_LENGTH; - val.os.data = (c_uint8_t*)&paa; + val.os.data = (uint8_t*)&paa; val.os.len = PAA_IPV6_LEN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Set IP-Can-Type */ ret = fd_msg_avp_new(gx_ip_can_type, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = GX_IP_CAN_TYPE_3GPP_EPS; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set RAT-Type */ ret = fd_msg_avp_new(gx_rat_type, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = GX_RAT_TYPE_EUTRAN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set QoS-Information */ if (sess->pdn.ambr.downlink || sess->pdn.ambr.uplink) { ret = fd_msg_avp_new(gx_qos_information, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (sess->pdn.ambr.uplink) { ret = fd_msg_avp_new(gx_apn_aggregate_max_bitrate_ul, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = sess->pdn.ambr.uplink; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } if (sess->pdn.ambr.downlink) { ret = fd_msg_avp_new(gx_apn_aggregate_max_bitrate_dl, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = sess->pdn.ambr.downlink; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Set Default-EPS-Bearer-QoS */ ret = fd_msg_avp_new(gx_default_eps_bearer_qos, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = sess->pdn.qos.qci; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_allocation_retention_priority, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_priority_level, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = sess->pdn.qos.arp.priority_level; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = sess->pdn.qos.arp.pre_emption_capability; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(gx_pre_emption_vulnerability, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.u32 = sess->pdn.qos.arp.pre_emption_vulnerability; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set 3GPP-User-Location-Info */ { struct gx_uli_t { - c_uint8_t type; + uint8_t type; tai_t tai; e_cgi_t e_cgi; } gx_uli; @@ -383,38 +372,38 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, gx_uli.e_cgi.cell_id = htonl(sess->e_cgi.cell_id); ret = fd_msg_avp_new(gx_3gpp_user_location_info, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t*)&gx_uli; + ogs_assert(ret == 0); + val.os.data = (uint8_t*)&gx_uli; val.os.len = sizeof(gx_uli); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Set 3GPP-MS-Timezone */ if (message->create_session_request.ue_time_zone.presence) { ret = fd_msg_avp_new(gx_3gpp_ms_timezone, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.os.data = message->create_session_request.ue_time_zone.data; val.os.len = message->create_session_request.ue_time_zone.len; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } } /* Set Called-Station-Id */ ret = fd_msg_avp_new(gx_called_station_id, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t*)sess->pdn.apn; + ogs_assert(ret == 0); + val.os.data = (uint8_t*)sess->pdn.apn; val.os.len = strlen(sess->pdn.apn); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = clock_gettime(CLOCK_REALTIME, &sess_data->ts); @@ -424,22 +413,22 @@ void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, /* Store this value in the session */ ret = fd_sess_state_store(pgw_gx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the request */ ret = fd_msg_send(&req, pgw_gx_cca_cb, svg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); } static void pgw_gx_cca_cb(void *data, struct msg **msg) { - status_t rv; + int rv; int ret; struct sess_state *sess_data = NULL; @@ -451,40 +440,40 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) int error = 0; int new; - event_t e; + pgw_event_t *e = NULL; gtp_xact_t *xact = NULL; pgw_sess_t *sess = NULL; - pkbuf_t *gxbuf = NULL, *gtpbuf = NULL; + ogs_pkbuf_t *gxbuf = NULL, *gtpbuf = NULL; gx_message_t *gx_message = NULL; - c_uint16_t gxbuf_len = 0; + uint16_t gxbuf_len = 0; - d_trace(3, "[PGW] Credit-Control-Answer\n"); + ogs_debug("[PGW] Credit-Control-Answer"); ret = clock_gettime(CLOCK_REALTIME, &ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); ret = fd_sess_state_retrieve(pgw_gx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data && (void *)sess_data == data, return, ); + ogs_assert(ret == 0); + ogs_assert(sess_data && (void *)sess_data == data); xact = sess_data->xact; - d_assert(xact, return, "Null param"); + ogs_assert(xact); sess = sess_data->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); gtpbuf = sess_data->gtpbuf; - d_assert(gtpbuf, return, "Null param"); + ogs_assert(gtpbuf); gxbuf_len = sizeof(gx_message_t); - d_assert(gxbuf_len < 8192, return, "Not supported size:%d", gxbuf_len); - gxbuf = pkbuf_alloc(0, gxbuf_len); - d_assert(gxbuf, return, "Null param"); - gx_message = gxbuf->payload; - d_assert(gx_message, return, "Null param"); + ogs_assert(gxbuf_len < 8192); + gxbuf = ogs_pkbuf_alloc(NULL, gxbuf_len); + ogs_pkbuf_put(gxbuf, gxbuf_len); + gx_message = gxbuf->data; + ogs_assert(gx_message); /* Set Credit Control Command */ memset(gx_message, 0, gxbuf_len); @@ -492,155 +481,155 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->result_code = hdr->avp_value->i32; - d_trace(5, " Result Code: %d\n", hdr->avp_value->i32); + ogs_debug(" Result Code: %d", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->result_code = hdr->avp_value->i32; - d_trace(5, " Experimental Result Code: %d\n", + ogs_debug(" Experimental Result Code: %d", gx_message->result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); error++; } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " From '%.*s'\n", + ogs_assert(ret == 0); + ogs_debug(" From '%.*s'", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host"); + ogs_error("no_Origin-Host"); error++; } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(5, " ('%.*s')\n", + ogs_assert(ret == 0); + ogs_debug(" ('%.*s')", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm"); + ogs_error("no_Origin-Realm"); error++; } if (gx_message->result_code != ER_DIAMETER_SUCCESS) { - d_warn("ERROR DIAMETER Result Code(%d)", gx_message->result_code); + ogs_warn("ERROR DIAMETER Result Code(%d)", gx_message->result_code); goto out; } ret = fd_msg_search_avp(*msg, gx_cc_request_type, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->cc_request_type = hdr->avp_value->i32; } else { - d_error("no_CC-Request-Type"); + ogs_error("no_CC-Request-Type"); error++; } ret = fd_msg_search_avp(*msg, gx_qos_information, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, gx_apn_aggregate_max_bitrate_ul, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->pdn.ambr.uplink = hdr->avp_value->u32; } ret = fd_avp_search_avp(avp, gx_apn_aggregate_max_bitrate_dl, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->pdn.ambr.downlink = hdr->avp_value->u32; } } ret = fd_msg_search_avp(*msg, gx_default_eps_bearer_qos, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, gx_qos_class_identifier, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->pdn.qos.qci = hdr->avp_value->u32; } ret = fd_avp_search_avp(avp, gx_allocation_retention_priority, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_avp_search_avp(avpch1, gx_priority_level, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->pdn.qos.arp.priority_level = hdr->avp_value->u32; } ret = fd_avp_search_avp(avpch1, gx_pre_emption_capability, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->pdn.qos.arp.pre_emption_capability = hdr->avp_value->u32; } ret = fd_avp_search_avp(avpch1, gx_pre_emption_vulnerability, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); gx_message->pdn.qos.arp.pre_emption_vulnerability = hdr->avp_value->u32; } @@ -648,11 +637,11 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) } ret = fd_msg_browse(*msg, MSG_BRW_FIRST_CHILD, &avp, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); while(avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case AC_SESSION_ID: @@ -674,11 +663,11 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) case GX_AVP_CODE_CHARGING_RULE_INSTALL: { ret = fd_msg_browse(avp, MSG_BRW_FIRST_CHILD, &avpch1, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); while(avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case GX_AVP_CODE_CHARGING_RULE_DEFINITION: @@ -688,7 +677,7 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) rv = decode_pcc_rule_definition( pcc_rule, avpch1, &error); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); pcc_rule->type = PCC_RULE_TYPE_INSTALL; gx_message->num_of_pcc_rule++; @@ -696,7 +685,7 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) } default: { - d_error("Not supported(%d)", hdr->avp_code); + ogs_error("Not supported(%d)", hdr->avp_code); break; } } @@ -706,7 +695,7 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) } default: { - d_warn("Not supported(%d)", hdr->avp_code); + ogs_warn("Not supported(%d)", hdr->avp_code); break; } } @@ -716,23 +705,26 @@ static void pgw_gx_cca_cb(void *data, struct msg **msg) out: if (!error) { - event_set(&e, PGW_EVT_GX_MESSAGE); - event_set_param1(&e, (c_uintptr_t)sess->index); - event_set_param2(&e, (c_uintptr_t)gxbuf); - event_set_param3(&e, (c_uintptr_t)xact->index); - event_set_param4(&e, (c_uintptr_t)gtpbuf); - pgw_event_send(&e); + e = pgw_event_new(PGW_EVT_GX_MESSAGE); + ogs_assert(e); + + e->sess_index = sess->index; + e->gxbuf = gxbuf; + e->xact_index = xact->index; + e->gtpbuf = gtpbuf; + pgw_event_send(e); + ogs_pollset_notify(pgw_self()->pollset); } else { gx_message_free(gx_message); - pkbuf_free(gxbuf); + ogs_pkbuf_free(gxbuf); - pkbuf_free(gtpbuf); + ogs_pkbuf_free(gtpbuf); } /* Free the message */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (fd_logger_self()->stats.nb_recv) @@ -758,23 +750,23 @@ out: else fd_logger_self()->stats.nb_recv++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - d_trace(15, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - d_trace(15, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (sess_data->cc_request_type != GX_CC_REQUEST_TYPE_TERMINATION_REQUEST) { ret = fd_sess_state_store(pgw_gx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == NULL, return,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); } else { @@ -782,7 +774,7 @@ out: } ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; return; @@ -792,7 +784,7 @@ static int pgw_gx_fb_cb(struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { /* This CB should never be called */ - d_warn("Unexpected message received!"); + ogs_warn("Unexpected message received!"); return ENOTSUP; } @@ -800,7 +792,7 @@ static int pgw_gx_fb_cb(struct msg **msg, struct avp *avp, static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, struct session *session, void *opaque, enum disp_action *act) { - status_t rv; + int rv; int ret; struct msg *ans, *qry; @@ -809,25 +801,24 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, union avp_value val; struct sess_state *sess_data = NULL; - event_t e; - c_uint16_t gxbuf_len = 0; - pkbuf_t *gxbuf = NULL; + pgw_event_t *e = NULL; + uint16_t gxbuf_len = 0; + ogs_pkbuf_t *gxbuf = NULL; pgw_sess_t *sess = NULL; gx_message_t *gx_message = NULL; - c_uint32_t result_code = FD_DIAMETER_UNKNOWN_SESSION_ID; + uint32_t result_code = FD_DIAMETER_UNKNOWN_SESSION_ID; - d_assert(msg, return EINVAL,); + ogs_assert(msg); - d_trace(3, "[PGW] Re-Auth-Request\n"); + ogs_debug("[PGW] Re-Auth-Request"); gxbuf_len = sizeof(gx_message_t); - d_assert(gxbuf_len < 8192, return EINVAL, - "Not supported size:%d", gxbuf_len); - gxbuf = pkbuf_alloc(0, gxbuf_len); - d_assert(gxbuf, return EINVAL, "Null param"); - gx_message = gxbuf->payload; - d_assert(gx_message, return EINVAL, "Null param"); + ogs_assert(gxbuf_len < 8192); + gxbuf = ogs_pkbuf_alloc(NULL, gxbuf_len); + ogs_pkbuf_put(gxbuf, gxbuf_len); + gx_message = gxbuf->data; + ogs_assert(gx_message); /* Set Credit Control Command */ memset(gx_message, 0, gxbuf_len); @@ -836,27 +827,27 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ans = *msg; ret = fd_sess_state_retrieve(pgw_gx_reg, session, &sess_data); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (!sess_data) { - d_error("No Session Data"); + ogs_error("No Session Data"); goto out; } /* Get Session Information */ sess = sess_data->sess; - d_assert(sess, return EINVAL,); + ogs_assert(sess); ret = fd_msg_browse(qry, MSG_BRW_FIRST_CHILD, &avp, NULL); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); while(avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case AC_SESSION_ID: @@ -873,11 +864,11 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, case GX_AVP_CODE_CHARGING_RULE_INSTALL: { ret = fd_msg_browse(avp, MSG_BRW_FIRST_CHILD, &avpch1, NULL); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); while(avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case GX_AVP_CODE_CHARGING_RULE_DEFINITION: @@ -887,7 +878,7 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, rv = decode_pcc_rule_definition( pcc_rule, avpch1, NULL); - d_assert(rv == CORE_OK, return EINVAL,); + ogs_assert(rv == OGS_OK); pcc_rule->type = PCC_RULE_TYPE_INSTALL; gx_message->num_of_pcc_rule++; @@ -895,7 +886,7 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, } default: { - d_error("Not supported(%d)", hdr->avp_code); + ogs_error("Not supported(%d)", hdr->avp_code); break; } } @@ -906,11 +897,11 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, case GX_AVP_CODE_CHARGING_RULE_REMOVE: { ret = fd_msg_browse(avp, MSG_BRW_FIRST_CHILD, &avpch1, NULL); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); while(avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case GX_AVP_CODE_CHARGING_RULE_NAME: @@ -919,8 +910,8 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, [gx_message->num_of_pcc_rule]; pcc_rule->name = - core_strdup((char*)hdr->avp_value->os.data); - d_assert(pcc_rule->name, return CORE_ERROR,); + ogs_strdup((char*)hdr->avp_value->os.data); + ogs_assert(pcc_rule->name); pcc_rule->type = PCC_RULE_TYPE_REMOVE; gx_message->num_of_pcc_rule++; @@ -928,7 +919,7 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, } default: { - d_error("Not supported(%d)", hdr->avp_code); + ogs_error("Not supported(%d)", hdr->avp_code); break; } } @@ -938,7 +929,7 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, } default: { - d_warn("Not supported(%d)", hdr->avp_code); + ogs_warn("Not supported(%d)", hdr->avp_code); break; } } @@ -946,39 +937,42 @@ static int pgw_gx_rar_cb( struct msg **msg, struct avp *avp, } /* Send Gx Event to PGW State Machine */ - event_set(&e, PGW_EVT_GX_MESSAGE); - event_set_param1(&e, (c_uintptr_t)sess->index); - event_set_param2(&e, (c_uintptr_t)gxbuf); - pgw_event_send(&e); + e = pgw_event_new(PGW_EVT_GX_MESSAGE); + ogs_assert(e); + + e->sess_index = sess->index; + e->gxbuf = gxbuf; + pgw_event_send(e); + ogs_pollset_notify(pgw_self()->pollset); /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = GX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Store this value in the session */ ret = fd_sess_state_store(pgw_gx_reg, session, &sess_data); - d_assert(ret == 0, return EINVAL,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); - d_trace(3, "[PGW] Re-Auth-Answer\n"); + ogs_debug("[PGW] Re-Auth-Answer"); /* Add this value to the stats */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); return 0; @@ -987,63 +981,61 @@ out: { ret = fd_msg_rescode_set(ans, "DIAMETER_UNKNOWN_SESSION_ID", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else { ret = fd_message_experimental_rescode_set(ans, result_code); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } /* Store this value in the session */ ret = fd_sess_state_store(pgw_gx_reg, session, &sess_data); - d_assert(ret == 0, return EINVAL,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); gx_message_free(gx_message); - pkbuf_free(gxbuf); + ogs_pkbuf_free(gxbuf); return 0; } -status_t pgw_fd_init(void) +int pgw_fd_init(void) { int ret; struct disp_when data; - pool_init(&pgw_gx_sess_pool, MAX_POOL_OF_DIAMETER_SESS); - ret = fd_init(FD_MODE_CLIENT|FD_MODE_SERVER, pgw_self()->fd_conf_path, pgw_self()->fd_config); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Install objects definitions for this application */ ret = gx_dict_init(); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Create handler for sessions */ ret = fd_sess_handler_create(&pgw_gx_reg, state_cleanup, NULL, NULL); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); memset(&data, 0, sizeof(data)); data.app = gx_application; ret = fd_disp_register(pgw_gx_fb_cb, DISP_HOW_APPID, &data, NULL, &hdl_gx_fb); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); data.command = gx_cmd_rar; ret = fd_disp_register(pgw_gx_rar_cb, DISP_HOW_CC, &data, NULL, &hdl_gx_rar); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Advertise the support for the application in the peer */ ret = fd_disp_app_support(gx_application, fd_vendor, 1, 0); - return CORE_OK; + return OGS_OK; } void pgw_fd_final(void) @@ -1051,7 +1043,7 @@ void pgw_fd_final(void) int ret; ret = fd_sess_handler_destroy(&pgw_gx_reg, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); if (hdl_gx_fb) (void) fd_disp_unregister(&hdl_gx_fb, NULL); @@ -1059,43 +1051,35 @@ void pgw_fd_final(void) (void) fd_disp_unregister(&hdl_gx_rar, NULL); fd_final(); - - if (pool_used(&pgw_gx_sess_pool)) - d_error("%d not freed in pgw_gx_sess_pool[%d] of GX-SM", - pool_used(&pgw_gx_sess_pool), pool_size(&pgw_gx_sess_pool)); - d_trace(9, "%d not freed in pgw_gx_sess_pool[%d] of GX-SM\n", - pool_used(&pgw_gx_sess_pool), pool_size(&pgw_gx_sess_pool)); - - pool_final(&pgw_gx_sess_pool); } -static status_t decode_pcc_rule_definition( +static int decode_pcc_rule_definition( pcc_rule_t *pcc_rule, struct avp *avpch1, int *perror) { int ret = 0, error = 0; struct avp *avpch2, *avpch3, *avpch4; struct avp_hdr *hdr; - d_assert(pcc_rule, return CORE_ERROR,); - d_assert(avpch1, return CORE_ERROR,); + ogs_assert(pcc_rule); + ogs_assert(avpch1); ret = fd_msg_browse(avpch1, MSG_BRW_FIRST_CHILD, &avpch2, NULL); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); while(avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); switch(hdr->avp_code) { case GX_AVP_CODE_CHARGING_RULE_NAME: { if (pcc_rule->name) { - d_error("PCC Rule Name has already been defined"); - CORE_FREE(pcc_rule->name); + ogs_error("PCC Rule Name has already been defined"); + ogs_free(pcc_rule->name); } - pcc_rule->name = core_strdup((char*)hdr->avp_value->os.data); - d_assert(pcc_rule->name, return CORE_ERROR,); + pcc_rule->name = ogs_strdup((char*)hdr->avp_value->os.data); + ogs_assert(pcc_rule->name); break; } case GX_AVP_CODE_FLOW_INFORMATION: @@ -1104,22 +1088,22 @@ static status_t decode_pcc_rule_definition( &pcc_rule->flow[pcc_rule->num_of_flow]; ret = fd_avp_search_avp(avpch2, gx_flow_direction, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr( avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); flow->direction = hdr->avp_value->i32; } ret = fd_avp_search_avp(avpch2, gx_flow_description, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); - flow->description = core_malloc(hdr->avp_value->os.len+1); - core_cpystrn(flow->description, + ogs_assert(ret == 0); + flow->description = ogs_malloc(hdr->avp_value->os.len+1); + ogs_cpystrn(flow->description, (char*)hdr->avp_value->os.data, hdr->avp_value->os.len+1); } @@ -1136,110 +1120,110 @@ static status_t decode_pcc_rule_definition( { ret = fd_avp_search_avp(avpch2, gx_qos_class_identifier, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.qci = hdr->avp_value->u32; } else { - d_error("no_QCI"); + ogs_error("no_QCI"); error++; } ret = fd_avp_search_avp(avpch2, gx_allocation_retention_priority, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_avp_search_avp(avpch3, gx_priority_level, &avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.arp.priority_level = hdr->avp_value->u32; } else { - d_error("no_Priority-Level"); + ogs_error("no_Priority-Level"); error++; } ret = fd_avp_search_avp(avpch3, gx_pre_emption_capability, &avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.arp.pre_emption_capability = hdr->avp_value->u32; } else { - d_error("no_Preemption-Capability"); + ogs_error("no_Preemption-Capability"); error++; } ret = fd_avp_search_avp(avpch3, gx_pre_emption_vulnerability, &avpch4); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.arp.pre_emption_vulnerability = hdr->avp_value->u32; } else { - d_error("no_Preemption-Vulnerability"); + ogs_error("no_Preemption-Vulnerability"); error++; } } else { - d_error("no_ARP"); + ogs_error("no_ARP"); error++; } ret = fd_avp_search_avp(avpch2, gx_max_requested_bandwidth_ul, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.mbr.uplink = hdr->avp_value->u32; } ret = fd_avp_search_avp(avpch2, gx_max_requested_bandwidth_dl, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.mbr.downlink = hdr->avp_value->u32; } ret = fd_avp_search_avp(avpch2, gx_guaranteed_bitrate_ul, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.gbr.uplink = hdr->avp_value->u32; } ret = fd_avp_search_avp(avpch2, gx_guaranteed_bitrate_dl, &avpch3); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); pcc_rule->qos.gbr.downlink = hdr->avp_value->u32; } break; @@ -1251,7 +1235,7 @@ static status_t decode_pcc_rule_definition( } default: { - d_error("Not implemented(%d)", hdr->avp_code); + ogs_error("Not implemented(%d)", hdr->avp_code); break; } } @@ -1261,5 +1245,5 @@ static status_t decode_pcc_rule_definition( if (perror) *perror = error; - return CORE_OK; + return OGS_OK; } diff --git a/src/pgw/pgw_fd_path.h b/src/pgw/pgw_fd_path.h index a0b6822c5..b59b2e899 100644 --- a/src/pgw/pgw_fd_path.h +++ b/src/pgw/pgw_fd_path.h @@ -1,8 +1,6 @@ #ifndef __PGW_FD_PATH_H__ #define __PGW_FD_PATH_H__ -#include "core_errno.h" - #include "pgw_context.h" #ifdef __cplusplus @@ -11,11 +9,11 @@ extern "C" { typedef struct _gtp_xact_t gtp_xact_t; -CORE_DECLARE(status_t) pgw_fd_init(void); -CORE_DECLARE(void) pgw_fd_final(void); +int pgw_fd_init(void); +void pgw_fd_final(void); -CORE_DECLARE(void) pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, - pkbuf_t *gtpbuf, c_uint32_t cc_request_type); +void pgw_gx_send_ccr(pgw_sess_t *sess, gtp_xact_t *xact, + ogs_pkbuf_t *gtpbuf, uint32_t cc_request_type); #ifdef __cplusplus } diff --git a/src/pgw/pgw_gtp_path.c b/src/pgw/pgw_gtp_path.c index 9e46a2602..292947ace 100644 --- a/src/pgw/pgw_gtp_path.c +++ b/src/pgw/pgw_gtp_path.c @@ -1,12 +1,25 @@ -#define TRACE_MODULE _pgw_gtp_path -#include "core_debug.h" -#include "core_pkbuf.h" +#include "base/base.h" + +#if HAVE_NETINET_IP_H +#include +#endif + +#if HAVE_NETINET_IP6_H +#include +#endif + +#if HAVE_NETINET_IP_ICMP_H +#include +#endif + +#if HAVE_NETINET_ICMP6_H +#include +#endif -#include "3gpp_types.h" #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" -#include "common/context.h" +#include "app/context.h" #include "pgw_context.h" #include "pgw_event.h" #include "pgw_gtp_path.h" @@ -14,34 +27,33 @@ #define PGW_GTP_HANDLED 1 -c_uint16_t in_cksum(c_uint16_t *addr, int len); -static status_t pgw_gtp_handle_multicast(pkbuf_t *recvbuf); -static status_t pgw_gtp_handle_slaac(pgw_sess_t *sess, pkbuf_t *recvbuf); -static status_t pgw_gtp_send_to_bearer(pgw_bearer_t *bearer, pkbuf_t *sendbuf); -static status_t pgw_gtp_send_router_advertisement( - pgw_sess_t *sess, c_uint8_t *ip6_dst); +uint16_t in_cksum(uint16_t *addr, int len); +static int pgw_gtp_handle_multicast(ogs_pkbuf_t *recvbuf); +static int pgw_gtp_handle_slaac(pgw_sess_t *sess, ogs_pkbuf_t *recvbuf); +static int pgw_gtp_send_to_bearer(pgw_bearer_t *bearer, ogs_pkbuf_t *sendbuf); +static int pgw_gtp_send_router_advertisement( + pgw_sess_t *sess, uint8_t *ip6_dst); -static int _gtpv1_tun_recv_cb(sock_id sock, void *data) +static void _gtpv1_tun_recv_cb(short when, ogs_socket_t fd, void *data) { - pkbuf_t *recvbuf = NULL; + ogs_pkbuf_t *recvbuf = NULL; int n; - status_t rv; + int rv; pgw_bearer_t *bearer = NULL; - recvbuf = pkbuf_alloc(GTPV1U_HEADER_LEN, MAX_SDU_LEN); - d_assert(recvbuf, return -1, "pkbuf_alloc error"); + recvbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_reserve(recvbuf, GTPV1U_HEADER_LEN); + ogs_pkbuf_put(recvbuf, MAX_SDU_LEN-GTPV1U_HEADER_LEN); - n = sock_read(sock, recvbuf->payload, recvbuf->len); + n = ogs_read(fd, recvbuf->data, recvbuf->len); if (n <= 0) { - pkbuf_free(recvbuf); - return -1; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, "ogs_read() failed"); + ogs_pkbuf_free(recvbuf); + return; } - recvbuf->len = n; - - d_trace(50, "[TUN] RECV : "); - d_trace_hex(50, recvbuf->payload, recvbuf->len); + ogs_pkbuf_trim(recvbuf, n); /* Find the bearer by packet filter */ bearer = pgw_bearer_find_by_packet(recvbuf); @@ -49,98 +61,84 @@ static int _gtpv1_tun_recv_cb(sock_id sock, void *data) { /* Unicast */ rv = pgw_gtp_send_to_bearer(bearer, recvbuf); - d_assert(rv == CORE_OK,, "pgw_gtp_send_to_bearer() failed"); + ogs_assert(rv == OGS_OK); } else { - if (context_self()->parameter.multicast) + if (context_self()->config.parameter.multicast) { rv = pgw_gtp_handle_multicast(recvbuf); - d_assert(rv != CORE_ERROR,, "pgw_gtp_handle_multicast() failed"); + ogs_assert(rv != OGS_ERROR); } } - pkbuf_free(recvbuf); - return 0; - + ogs_pkbuf_free(recvbuf); } -static int _gtpv2_c_recv_cb(sock_id sock, void *data) +static void _gtpv2_c_recv_cb(short when, ogs_socket_t fd, void *data) { - event_t e; - status_t rv; - pkbuf_t *pkbuf = NULL; + pgw_event_t *e = NULL; + int rv; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(sock, return -1, "Null param"); + ogs_assert(fd != INVALID_SOCKET); - rv = gtp_recv(sock, &pkbuf); - if (rv != CORE_OK) + rv = gtp_recv(fd, &pkbuf); + if (rv != OGS_OK) { - if (errno == EAGAIN) - return 0; - - return -1; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, "gtp_recv() failed"); + return; } - event_set(&e, PGW_EVT_S5C_MESSAGE); - event_set_param1(&e, (c_uintptr_t)pkbuf); - rv = pgw_event_send(&e); - if (rv != CORE_OK) - { - d_error("pgw_event_send error"); - pkbuf_free(pkbuf); - return 0; - } + e = pgw_event_new(PGW_EVT_S5C_MESSAGE); + ogs_assert(e); + e->gtpbuf = pkbuf; - return 0; + pgw_event_send(e); } -static int _gtpv1_u_recv_cb(sock_id sock, void *data) +static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data) { - status_t rv; - pkbuf_t *pkbuf = NULL; - c_uint32_t size = GTPV1U_HEADER_LEN; + int rv; + ogs_pkbuf_t *pkbuf = NULL; + uint32_t size = GTPV1U_HEADER_LEN; gtp_header_t *gtp_h = NULL; struct ip *ip_h = NULL; - c_uint32_t teid; + uint32_t teid; pgw_bearer_t *bearer = NULL; pgw_sess_t *sess = NULL; pgw_subnet_t *subnet = NULL; pgw_dev_t *dev = NULL; - d_assert(sock, return -1, "Null param"); + ogs_assert(fd != INVALID_SOCKET); - rv = gtp_recv(sock, &pkbuf); - if (rv != CORE_OK) + rv = gtp_recv(fd, &pkbuf); + if (rv != OGS_OK) { - if (errno == EAGAIN) - return 0; - - return -1; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, "gtp_recv() failed"); + return; } - d_assert(pkbuf, return 0,); - d_assert(pkbuf->payload, goto cleanup,); - d_trace(50, "[PGW] RECV : "); - d_trace_hex(50, pkbuf->payload, pkbuf->len); + ogs_assert(pkbuf); + ogs_assert(pkbuf->len); - gtp_h = pkbuf->payload; + gtp_h = pkbuf->data; if (gtp_h->flags & GTPU_FLAGS_S) size += 4; teid = ntohl(gtp_h->teid); - d_trace(3, "[PGW] RECV GPU-U from SGW : TEID[0x%x]\n", teid); + ogs_debug("[PGW] RECV GPU-U from SGW : TEID[0x%x]", teid); /* Remove GTP header and send packets to TUN interface */ - d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, goto cleanup,); + ogs_assert(ogs_pkbuf_pull(pkbuf, size)); - ip_h = pkbuf->payload; - d_assert(ip_h, goto cleanup,); + ip_h = pkbuf->data; + ogs_assert(ip_h); bearer = pgw_bearer_find_by_pgw_s5u_teid(teid); - d_assert(bearer, goto cleanup,); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, goto cleanup,); + ogs_assert(sess); if (ip_h->ip_v == 4 && sess->ipv4) subnet = sess->ipv4->subnet; @@ -149,66 +147,105 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) if (!subnet) { - d_trace_hex(9, pkbuf->payload, pkbuf->len); - d_trace(9, "[DROP] Cannot find subnet V:%d, IPv4:%p, IPv6:%p\n", + ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data, pkbuf->len); + ogs_trace("[DROP] Cannot find subnet V:%d, IPv4:%p, IPv6:%p", ip_h->ip_v, sess->ipv4, sess->ipv6); goto cleanup; } /* Check IPv6 */ - if (context_self()->parameter.no_slaac == 0 && ip_h->ip_v == 6) + if (context_self()->config.parameter.no_slaac == 0 && ip_h->ip_v == 6) { rv = pgw_gtp_handle_slaac(sess, pkbuf); if (rv == PGW_GTP_HANDLED) { - pkbuf_free(pkbuf); - return 0; + ogs_pkbuf_free(pkbuf); + return; } - d_assert(rv == CORE_OK,, "pgw_gtp_handle_slaac() failed"); + ogs_assert(rv == OGS_OK); } dev = subnet->dev; - d_assert(dev, goto cleanup,); - if (sock_write(dev->sock, pkbuf->payload, pkbuf->len) <= 0) - d_error("sock_write() failed"); + ogs_assert(dev); + if (ogs_write(dev->fd, pkbuf->data, pkbuf->len) <= 0) + ogs_error("ogs_write() failed"); cleanup: - pkbuf_free(pkbuf); - return 0; + ogs_pkbuf_free(pkbuf); } -status_t pgw_gtp_open() +int pgw_gtp_open() { - status_t rv; + int rv; pgw_dev_t *dev = NULL; pgw_subnet_t *subnet = NULL; + ogs_socknode_t *snode = NULL; + ogs_sock_t *sock = NULL; int rc; - rv = gtp_server_list(&pgw_self()->gtpc_list, _gtpv2_c_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = gtp_server_list(&pgw_self()->gtpc_list6, _gtpv2_c_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_list_for_each(&pgw_self()->gtpc_list, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(pgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, NULL); + ogs_assert(snode->poll); + } + ogs_list_for_each(&pgw_self()->gtpc_list6, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(pgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, NULL); + ogs_assert(snode->poll); + } pgw_self()->gtpc_sock = gtp_local_sock_first(&pgw_self()->gtpc_list); pgw_self()->gtpc_sock6 = gtp_local_sock_first(&pgw_self()->gtpc_list6); pgw_self()->gtpc_addr = gtp_local_addr_first(&pgw_self()->gtpc_list); pgw_self()->gtpc_addr6 = gtp_local_addr_first(&pgw_self()->gtpc_list6); - d_assert(pgw_self()->gtpc_addr || pgw_self()->gtpc_addr6, - return CORE_ERROR, "No GTP Server"); + ogs_assert(pgw_self()->gtpc_addr || pgw_self()->gtpc_addr6); - rv = gtp_server_list(&pgw_self()->gtpu_list, _gtpv1_u_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = gtp_server_list(&pgw_self()->gtpu_list6, _gtpv1_u_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_list_for_each(&pgw_self()->gtpu_list, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(pgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, NULL); + ogs_assert(snode->poll); + } + ogs_list_for_each(&pgw_self()->gtpu_list6, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(pgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, NULL); + ogs_assert(snode->poll); + } pgw_self()->gtpu_sock = gtp_local_sock_first(&pgw_self()->gtpu_list); pgw_self()->gtpu_sock6 = gtp_local_sock_first(&pgw_self()->gtpu_list6); pgw_self()->gtpu_addr = gtp_local_addr_first(&pgw_self()->gtpu_list); pgw_self()->gtpu_addr6 = gtp_local_addr_first(&pgw_self()->gtpu_list6); - d_assert(pgw_self()->gtpu_addr || pgw_self()->gtpu_addr6, - return CORE_ERROR, "No GTP Server"); + ogs_assert(pgw_self()->gtpu_addr || pgw_self()->gtpu_addr6); /* NOTE : tun device can be created via following command. * @@ -224,20 +261,16 @@ status_t pgw_gtp_open() /* Open Tun interface */ for (dev = pgw_dev_first(); dev; dev = pgw_dev_next(dev)) { - rc = tun_open(&dev->sock, (char *)dev->ifname, 0); - if (rc != 0) + dev->fd = ogs_tun_open(dev->ifname, IFNAMSIZ, 0); + if (dev->fd == INVALID_SOCKET) { - d_error("tun_open(dev:%s) failed", dev->ifname); - return CORE_ERROR; + ogs_error("tun_open(dev:%s) failed", dev->ifname); + return OGS_ERROR; } - rc = sock_register(dev->sock, _gtpv1_tun_recv_cb, NULL); - if (rc != 0) - { - d_error("sock_register(dev:%s) failed", dev->ifname); - sock_delete(dev->sock); - return CORE_ERROR; - } + dev->poll = ogs_pollset_add(pgw_self()->pollset, + OGS_POLLIN, dev->fd, _gtpv1_tun_recv_cb, NULL); + ogs_assert(dev->poll); } /* @@ -253,73 +286,92 @@ status_t pgw_gtp_open() * Note that Linux will skip this configuration */ for (subnet = pgw_subnet_first(); subnet; subnet = pgw_subnet_next(subnet)) { - d_assert(subnet->dev, return CORE_ERROR,); - rc = tun_set_ip(subnet->dev->sock, &subnet->gw, &subnet->sub); - if (rc != 0) + ogs_assert(subnet->dev); + rc = ogs_tun_set_ip(subnet->dev->ifname, &subnet->gw, &subnet->sub); + if (rc != OGS_OK) { - d_error("tun_set_ip(dev:%s) failed", subnet->dev->ifname); - return CORE_ERROR; + ogs_error("ogs_tun_set_ip(dev:%s) failed", subnet->dev->ifname); + return OGS_ERROR; } } /* Link-Local Address for PGW_TUN */ for (dev = pgw_dev_first(); dev; dev = pgw_dev_next(dev)) - dev->link_local_addr = core_link_local_addr_by_dev(dev->ifname); + dev->link_local_addr = ogs_link_local_addr_by_dev(dev->ifname); - return CORE_OK; + return OGS_OK; } -status_t pgw_gtp_close() +int pgw_gtp_close() { pgw_dev_t *dev = NULL; + ogs_socknode_t *snode = NULL; - sock_delete_list(&pgw_self()->gtpc_list); - sock_delete_list(&pgw_self()->gtpc_list6); + ogs_list_for_each(&pgw_self()->gtpc_list, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + ogs_list_for_each(&pgw_self()->gtpc_list6, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } - sock_delete_list(&pgw_self()->gtpu_list); - sock_delete_list(&pgw_self()->gtpu_list6); + ogs_list_for_each(&pgw_self()->gtpu_list, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + ogs_list_for_each(&pgw_self()->gtpu_list6, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } for (dev = pgw_dev_first(); dev; dev = pgw_dev_next(dev)) - sock_delete(dev->sock); + { + ogs_pollset_remove(dev->poll); + ogs_closesocket(dev->fd); + } - return CORE_OK; + return OGS_OK; } -static status_t pgw_gtp_handle_multicast(pkbuf_t *recvbuf) +static int pgw_gtp_handle_multicast(ogs_pkbuf_t *recvbuf) { - status_t rv; + int rv; struct ip *ip_h = NULL; struct ip6_hdr *ip6_h = NULL; - ip_h = (struct ip *)recvbuf->payload; + ip_h = (struct ip *)recvbuf->data; if (ip_h->ip_v == 6) { #if COMPILE_ERROR_IN_MAC_OS_X /* Compiler error in Mac OS X platform */ - ip6_h = (struct ip6_hdr *)recvbuf->payload; + ip6_h = (struct ip6_hdr *)recvbuf->data; if (IN6_IS_ADDR_MULTICAST(&ip6_h->ip6_dst)) #else struct in6_addr ip6_dst; - ip6_h = (struct ip6_hdr *)recvbuf->payload; + ip6_h = (struct ip6_hdr *)recvbuf->data; memcpy(&ip6_dst, &ip6_h->ip6_dst, sizeof(struct in6_addr)); if (IN6_IS_ADDR_MULTICAST(&ip6_dst)) #endif { - hash_index_t *hi = NULL; + ogs_hash_index_t *hi = NULL; /* IPv6 Multicast */ for (hi = pgw_sess_first(); hi; hi = pgw_sess_next(hi)) { pgw_sess_t *sess = pgw_sess_this(hi); - d_assert(sess, return CORE_ERROR,); + ogs_assert(sess); if (sess->ipv6) { /* PDN IPv6 is avaiable */ pgw_bearer_t *bearer = pgw_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR,); + ogs_assert(bearer); rv = pgw_gtp_send_to_bearer(bearer, recvbuf); - d_assert(rv == CORE_OK,, - "pgw_gtp_send_to_bearer failed"); + ogs_assert(rv == OGS_OK); return PGW_GTP_HANDLED; } @@ -327,62 +379,55 @@ static status_t pgw_gtp_handle_multicast(pkbuf_t *recvbuf) } } - return CORE_OK; + return OGS_OK; } -static status_t pgw_gtp_handle_slaac(pgw_sess_t *sess, pkbuf_t *recvbuf) +static int pgw_gtp_handle_slaac(pgw_sess_t *sess, ogs_pkbuf_t *recvbuf) { - status_t rv; + int rv; struct ip *ip_h = NULL; - d_assert(sess, return CORE_ERROR,); - d_assert(recvbuf, return CORE_ERROR,); - d_assert(recvbuf->payload, return CORE_ERROR,); - ip_h = (struct ip *)recvbuf->payload; + ogs_assert(sess); + ogs_assert(recvbuf); + ogs_assert(recvbuf->len); + ip_h = (struct ip *)recvbuf->data; if (ip_h->ip_v == 6) { - struct ip6_hdr *ip6_h = (struct ip6_hdr *)recvbuf->payload; + struct ip6_hdr *ip6_h = (struct ip6_hdr *)recvbuf->data; if (ip6_h->ip6_nxt == IPPROTO_ICMPV6) { struct icmp6_hdr *icmp_h = - (struct icmp6_hdr *)(recvbuf->payload + sizeof(struct ip6_hdr)); + (struct icmp6_hdr *)(recvbuf->data + sizeof(struct ip6_hdr)); if (icmp_h->icmp6_type == ND_ROUTER_SOLICIT) { - d_trace(5, "[PGW] Router Solict\n"); + ogs_debug("[PGW] Router Solict"); if (sess->ipv6) { rv = pgw_gtp_send_router_advertisement( sess, ip6_h->ip6_src.s6_addr); - d_assert(rv == CORE_OK,,"send router advertisement failed"); + ogs_assert(rv == OGS_OK); } return PGW_GTP_HANDLED; } } } - return CORE_OK; + return OGS_OK; } -static status_t pgw_gtp_send_to_bearer(pgw_bearer_t *bearer, pkbuf_t *sendbuf) +static int pgw_gtp_send_to_bearer(pgw_bearer_t *bearer, ogs_pkbuf_t *sendbuf) { - char buf[CORE_ADDRSTRLEN]; - status_t rv; + char buf[OGS_ADDRSTRLEN]; + int rv; gtp_header_t *gtp_h = NULL; - d_assert(bearer, pkbuf_free(sendbuf); return CORE_ERROR,); - d_assert(bearer->gnode, pkbuf_free(sendbuf); return CORE_ERROR,); - d_assert(bearer->gnode->sock, pkbuf_free(sendbuf); return CORE_ERROR,); + ogs_assert(bearer); + ogs_assert(bearer->gnode); + ogs_assert(bearer->gnode->sock); /* Add GTP-U header */ - rv = pkbuf_header(sendbuf, GTPV1U_HEADER_LEN); - if (rv != CORE_OK) - { - d_error("pkbuf_header error"); - pkbuf_free(sendbuf); - return CORE_ERROR; - } - - gtp_h = (gtp_header_t *)sendbuf->payload; + ogs_assert(ogs_pkbuf_push(sendbuf, GTPV1U_HEADER_LEN)); + gtp_h = (gtp_header_t *)sendbuf->data; /* Bits 8 7 6 5 4 3 2 1 * +--+--+--+--+--+--+--+--+ * |version |PT| 1| E| S|PN| @@ -395,59 +440,57 @@ static status_t pgw_gtp_send_to_bearer(pgw_bearer_t *bearer, pkbuf_t *sendbuf) gtp_h->teid = htonl(bearer->sgw_s5u_teid); /* Send to SGW */ - d_trace(50, "[PGW] SEND : "); - d_trace_hex(50, sendbuf->payload, sendbuf->len); - - d_trace(3, "[PGW] SEND GPU-U to SGW[%s] : TEID[0x%x]\n", - CORE_ADDR(sock_remote_addr(bearer->gnode->sock), buf), + ogs_debug("[PGW] SEND GPU-U to SGW[%s] : TEID[0x%x]", + OGS_ADDR(&bearer->gnode->conn, buf), bearer->sgw_s5u_teid); - rv = gtp_send(bearer->gnode, sendbuf); + rv = gtp_sendto(bearer->gnode, sendbuf); return rv; } -static status_t pgw_gtp_send_router_advertisement( - pgw_sess_t *sess, c_uint8_t *ip6_dst) +static int pgw_gtp_send_router_advertisement( + pgw_sess_t *sess, uint8_t *ip6_dst) { - status_t rv; - pkbuf_t *pkbuf = NULL; + int rv; + ogs_pkbuf_t *pkbuf = NULL; pgw_bearer_t *bearer = NULL; pgw_ue_ip_t *ue_ip = NULL; pgw_subnet_t *subnet = NULL; pgw_dev_t *dev = NULL; - ipsubnet_t src_ipsub; - c_uint16_t plen = 0; - c_uint8_t nxt = 0; - c_uint8_t *p = NULL; + ogs_ipsubnet_t src_ipsub; + uint16_t plen = 0; + uint8_t nxt = 0; + uint8_t *p = NULL; struct ip6_hdr *ip6_h = NULL; struct nd_router_advert *advert_h = NULL; struct nd_opt_prefix_info *prefix = NULL; - d_assert(sess, return CORE_ERROR,); + ogs_assert(sess); bearer = pgw_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR,); + ogs_assert(bearer); ue_ip = sess->ipv6; - d_assert(ue_ip, return CORE_ERROR,); + ogs_assert(ue_ip); subnet = ue_ip->subnet; - d_assert(subnet, return CORE_ERROR,); + ogs_assert(subnet); dev = subnet->dev; - d_assert(dev, return CORE_ERROR,); + ogs_assert(dev); - pkbuf = pkbuf_alloc(GTPV1U_HEADER_LEN, 200); - d_assert(pkbuf, return CORE_ERROR,); + pkbuf = ogs_pkbuf_alloc(NULL, GTPV1U_HEADER_LEN+200); + ogs_pkbuf_reserve(pkbuf, GTPV1U_HEADER_LEN); + ogs_pkbuf_put(pkbuf, 200); pkbuf->len = sizeof *ip6_h + sizeof *advert_h + sizeof *prefix; - memset(pkbuf->payload, 0, pkbuf->len); + memset(pkbuf->data, 0, pkbuf->len); - p = (c_uint8_t *)pkbuf->payload; + p = (uint8_t *)pkbuf->data; ip6_h = (struct ip6_hdr *)p; - advert_h = (struct nd_router_advert *)((c_uint8_t *)ip6_h + sizeof *ip6_h); + advert_h = (struct nd_router_advert *)((uint8_t *)ip6_h + sizeof *ip6_h); prefix = (struct nd_opt_prefix_info *) - ((c_uint8_t*)advert_h + sizeof *advert_h); + ((uint8_t*)advert_h + sizeof *advert_h); - rv = core_ipsubnet(&src_ipsub, "fe80::1", NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_ipsubnet(&src_ipsub, "fe80::1", NULL); + ogs_assert(rv == OGS_OK); if (dev->link_local_addr) memcpy(src_ipsub.sub, dev->link_local_addr->sin6.sin6_addr.s6_addr, sizeof src_ipsub.sub); @@ -480,7 +523,7 @@ static status_t pgw_gtp_send_router_advertisement( p += IPV6_LEN; p += 2; memcpy(p, &plen, 2); p += 2; p += 3; *p = nxt; p += 1; - advert_h->nd_ra_cksum = in_cksum((c_uint16_t *)pkbuf->payload, pkbuf->len); + advert_h->nd_ra_cksum = in_cksum((uint16_t *)pkbuf->data, pkbuf->len); ip6_h->ip6_flow = htonl(0x60000001); ip6_h->ip6_plen = plen; @@ -490,20 +533,20 @@ static status_t pgw_gtp_send_router_advertisement( memcpy(ip6_h->ip6_dst.s6_addr, ip6_dst, IPV6_LEN); rv = pgw_gtp_send_to_bearer(bearer, pkbuf); - d_assert(rv == CORE_OK,, "pgw_gtp_send_to_bearer() faild"); + ogs_assert(rv == OGS_OK); - d_trace(5, "[PGW] Router Advertisement\n"); + ogs_debug("[PGW] Router Advertisement"); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); return rv; } -c_uint16_t in_cksum(c_uint16_t *addr, int len) +uint16_t in_cksum(uint16_t *addr, int len) { int nleft = len; - c_uint32_t sum = 0; - c_uint16_t *w = addr; - c_uint16_t answer = 0; + uint32_t sum = 0; + uint16_t *w = addr; + uint16_t answer = 0; // Adding 16 bits sequentially in sum while (nleft > 1) @@ -516,7 +559,7 @@ c_uint16_t in_cksum(c_uint16_t *addr, int len) // If an odd byte is left if (nleft == 1) { - *(c_uint8_t *) (&answer) = *(c_uint8_t *) w; + *(uint8_t *) (&answer) = *(uint8_t *) w; sum += answer; } diff --git a/src/pgw/pgw_gtp_path.h b/src/pgw/pgw_gtp_path.h index 5acd2dbb2..cb151f392 100644 --- a/src/pgw/pgw_gtp_path.h +++ b/src/pgw/pgw_gtp_path.h @@ -1,14 +1,15 @@ #ifndef __PGW_PATH_H__ #define __PGW_PATH_H__ +#include "ogs-tun.h" #include "gtp/gtp_xact.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) pgw_gtp_open(); -CORE_DECLARE(status_t) pgw_gtp_close(); +int pgw_gtp_open(); +int pgw_gtp_close(); #ifdef __cplusplus } diff --git a/src/pgw/pgw_gx_handler.c b/src/pgw/pgw_gx_handler.c index f0c1fdc16..434076e73 100644 --- a/src/pgw/pgw_gx_handler.c +++ b/src/pgw/pgw_gx_handler.c @@ -1,27 +1,23 @@ -#define TRACE_MODULE _pgw_gx_handler - -#include "core_debug.h" - #include "pgw_context.h" #include "fd/gx/gx_message.h" #include "pgw_gtp_path.h" #include "pgw_s5c_build.h" #include "pgw_ipfw.h" -static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message); +static int bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message); void pgw_gx_handle_cca_initial_request( pgw_sess_t *sess, gx_message_t *gx_message, gtp_xact_t *xact, gtp_create_session_request_t *req) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(sess, return, "Null param"); - d_assert(gx_message, return, "Null param"); - d_assert(xact, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(sess); + ogs_assert(gx_message); + ogs_assert(xact); + ogs_assert(req); /* Send Create Session Request with Creating Default Bearer */ memset(&h, 0, sizeof(gtp_header_t)); @@ -30,37 +26,37 @@ void pgw_gx_handle_cca_initial_request( rv = pgw_s5c_build_create_session_response( &pkbuf, h.type, sess, gx_message, req); - d_assert(rv == CORE_OK, return, "S11 build error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(xact, &h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); rv = bearer_binding(sess, gx_message); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } void pgw_gx_handle_cca_termination_request( pgw_sess_t *sess, gx_message_t *gx_message, gtp_xact_t *xact, gtp_delete_session_request_t *req) { - status_t rv; + int rv; gtp_header_t h; - pkbuf_t *pkbuf = NULL; - c_uint32_t sgw_s5c_teid; + ogs_pkbuf_t *pkbuf = NULL; + uint32_t sgw_s5c_teid; - d_assert(xact, return, "Null param"); - d_assert(sess, return, "Null param"); - d_assert(gx_message, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(sess); + ogs_assert(gx_message); + ogs_assert(req); /* backup sgw_s5c_teid in session context */ sgw_s5c_teid = sess->sgw_s5c_teid; - d_trace(3, "[PGW] Delete Session Response\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Delete Session Response"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); /* Remove a pgw session */ @@ -72,37 +68,37 @@ void pgw_gx_handle_cca_termination_request( rv = pgw_s5c_build_delete_session_response( &pkbuf, h.type, gx_message, req); - d_assert(rv == CORE_OK, return, "S11 build error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(xact, &h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void pgw_gx_handle_re_auth_request( pgw_sess_t *sess, gx_message_t *gx_message) { - status_t rv; + int rv; rv = bearer_binding(sess, gx_message); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } -static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) +static int bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) { - status_t rv; + int rv; int i, j; - d_assert(sess, return CORE_ERROR,); - d_assert(gx_message, return CORE_ERROR,); + ogs_assert(sess); + ogs_assert(gx_message); for (i = 0; i < gx_message->num_of_pcc_rule; i++) { gtp_xact_t *xact = NULL; gtp_header_t h; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; pgw_bearer_t *bearer = NULL; pcc_rule_t *pcc_rule = &gx_message->pcc_rule[i]; @@ -110,10 +106,10 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) int qos_presence = 0; int tft_presence = 0; - d_assert(pcc_rule, return CORE_ERROR,); + ogs_assert(pcc_rule); if (pcc_rule->name == NULL) { - d_error("No PCC Rule Name"); + ogs_error("No PCC Rule Name"); continue; } @@ -127,27 +123,19 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) if (!bearer) { bearer = pgw_bearer_add(sess); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); - bearer->name = core_strdup(pcc_rule->name); - d_assert(bearer->name, return CORE_ERROR,); + bearer->name = ogs_strdup(pcc_rule->name); + ogs_assert(bearer->name); memcpy(&bearer->qos, &pcc_rule->qos, sizeof(qos_t)); - d_assert(pcc_rule->num_of_flow, return CORE_ERROR, - "No Flow! [QCI:%d, ARP:%d,%d,%d]", - pcc_rule->qos.qci, - pcc_rule->qos.arp.priority_level, - pcc_rule->qos.arp.pre_emption_capability, - pcc_rule->qos.arp.pre_emption_vulnerability); + ogs_assert(pcc_rule->num_of_flow); bearer_created = 1; } else { - d_assert(strcmp(bearer->name, pcc_rule->name) == 0, - return CORE_ERROR, - "PCC Rule Name Mismatched! [%s:%s]", - bearer->name, pcc_rule->name); + ogs_assert(strcmp(bearer->name, pcc_rule->name) == 0); if (pcc_rule->num_of_flow) { @@ -176,7 +164,7 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) if (tft_presence == 0 && qos_presence == 0) { - d_warn("[IGNORE] Update Bearer Request : " + ogs_warn("[IGNORE] Update Bearer Request : " "Both QoS and TFT is NULL"); continue; } @@ -188,15 +176,14 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) pgw_rule_t rule; pgw_pf_t *pf = NULL; - d_assert(flow, return CORE_ERROR, "Null param"); - d_assert(flow->description, return CORE_ERROR, "Null param"); + ogs_assert(flow); + ogs_assert(flow->description); rv = pgw_compile_packet_filter(&rule, flow->description); - d_assert(rv == CORE_OK, return CORE_ERROR, - "Failed to compile packet filter"); + ogs_assert(rv == OGS_OK); pf = pgw_pf_add(bearer, pcc_rule->precedence); - d_assert(pf, return CORE_ERROR, "Null param"); + ogs_assert(pf); memcpy(&pf->rule, &rule, sizeof(pgw_rule_t)); pf->direction = flow->direction; @@ -210,7 +197,7 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) h.teid = sess->sgw_s5c_teid; rv = pgw_s5c_build_create_bearer_request(&pkbuf, h.type, bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); } else { @@ -219,39 +206,39 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) rv = pgw_s5c_build_update_bearer_request( &pkbuf, h.type, bearer, qos_presence, tft_presence); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); } xact = gtp_xact_local_create(sess->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); } else if (pcc_rule->type == PCC_RULE_TYPE_REMOVE) { bearer = pgw_bearer_find_by_name(sess, pcc_rule->name); - d_assert(bearer, return CORE_ERROR,); + ogs_assert(bearer); memset(&h, 0, sizeof(gtp_header_t)); h.type = GTP_DELETE_BEARER_REQUEST_TYPE; h.teid = sess->sgw_s5c_teid; rv = pgw_s5c_build_delete_bearer_request(&pkbuf, h.type, bearer); - d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(sess->gnode, &h, pkbuf); - d_assert(xact, return CORE_ERROR, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } else - d_assert(0, return CORE_ERROR, "Invalid type(%d)", pcc_rule->type); + ogs_assert_if_reached(); } - return CORE_OK; + return OGS_OK; } diff --git a/src/pgw/pgw_gx_handler.h b/src/pgw/pgw_gx_handler.h index 2fea2e353..e77a1cc1c 100644 --- a/src/pgw/pgw_gx_handler.h +++ b/src/pgw/pgw_gx_handler.h @@ -9,13 +9,13 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) pgw_gx_handle_cca_initial_request( +void pgw_gx_handle_cca_initial_request( pgw_sess_t *sess, gx_message_t *gx_message, gtp_xact_t *xact, gtp_create_session_request_t *req); -CORE_DECLARE(void) pgw_gx_handle_cca_termination_request( +void pgw_gx_handle_cca_termination_request( pgw_sess_t *sess, gx_message_t *gx_message, gtp_xact_t *xact, gtp_delete_session_request_t *req); -CORE_DECLARE(void) pgw_gx_handle_re_auth_request( +void pgw_gx_handle_re_auth_request( pgw_sess_t *sess, gx_message_t *gx_message); #ifdef __cplusplus diff --git a/src/pgw/pgw_init.c b/src/pgw/pgw_init.c index 1efe5cda4..39095ec72 100644 --- a/src/pgw/pgw_init.c +++ b/src/pgw/pgw_init.c @@ -1,117 +1,99 @@ -#define TRACE_MODULE _pgw_init - -#include "core_debug.h" -#include "core_thread.h" - #include "gtp/gtp_xact.h" +#include "app/context.h" #include "pgw_context.h" #include "pgw_event.h" #include "pgw_sm.h" #include "pgw_fd_path.h" -static thread_id pgw_thread; -static void *THREAD_FUNC pgw_main(thread_id id, void *data); +static ogs_thread_t *thread; +static void pgw_main(void *data); static int initialized = 0; -status_t pgw_initialize() +int pgw_initialize() { - status_t rv; + int rv; rv = pgw_context_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = pgw_context_parse_config(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - rv = pgw_context_setup_trace_module(); - if (rv != CORE_OK) return rv; + rv = context_setup_log_module(); + if (rv != OGS_OK) return rv; rv = pgw_ue_pool_generate(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = pgw_fd_init(); - if (rv != 0) return CORE_ERROR; + if (rv != 0) return OGS_ERROR; - rv = thread_create(&pgw_thread, NULL, pgw_main, NULL); - if (rv != CORE_OK) return rv; + thread = ogs_thread_create(pgw_main, NULL); + if (!thread) return OGS_ERROR; initialized = 1; - return CORE_OK; + return OGS_OK; } void pgw_terminate(void) { if (!initialized) return; - thread_delete(pgw_thread); + pgw_event_term(); + + ogs_thread_destroy(thread); pgw_fd_final(); pgw_context_final(); gtp_xact_final(); + + pgw_event_final(); } -static void *THREAD_FUNC pgw_main(thread_id id, void *data) +static void pgw_main(void *data) { - event_t event; - fsm_t pgw_sm; - c_time_t prev_tm, now_tm; - status_t rv; + ogs_fsm_t pgw_sm; + int rv; - memset(&event, 0, sizeof(event_t)); + pgw_event_init(); + gtp_xact_init(pgw_self()->timer_mgr); - pgw_self()->queue_id = event_create(MSGQ_O_NONBLOCK); - d_assert(pgw_self()->queue_id, return NULL, - "PGW event queue creation failed"); - tm_service_init(&pgw_self()->tm_service); - gtp_xact_init(&pgw_self()->tm_service, - PGW_EVT_S5C_T3_RESPONSE, PGW_EVT_S5C_T3_HOLDING); + ogs_fsm_create(&pgw_sm, pgw_state_initial, pgw_state_final); + ogs_fsm_init(&pgw_sm, 0); - fsm_create(&pgw_sm, pgw_state_initial, pgw_state_final); - fsm_init(&pgw_sm, 0); - - prev_tm = time_now(); - -#define EVENT_LOOP_TIMEOUT 10 /* 10ms */ - while ((!thread_should_stop())) + for ( ;; ) { - sock_select_loop(EVENT_LOOP_TIMEOUT); - do + ogs_pollset_poll(pgw_self()->pollset, + ogs_timer_mgr_next(pgw_self()->timer_mgr)); + + ogs_timer_mgr_expire(pgw_self()->timer_mgr); + + for ( ;; ) { - rv = event_recv(pgw_self()->queue_id, &event); + pgw_event_t *e = NULL; - d_assert(rv != CORE_ERROR, continue, - "While receiving a event message, error occurs"); + rv = ogs_queue_trypop(pgw_self()->queue, (void**)&e); + ogs_assert(rv != OGS_ERROR); - now_tm = time_now(); + if (rv == OGS_DONE) + goto done; - /* if the gap is over event_loop timeout, execute preriodic jobs */ - if (now_tm - prev_tm > (EVENT_LOOP_TIMEOUT * 1000)) - { - tm_execute_tm_service( - &pgw_self()->tm_service, pgw_self()->queue_id); + if (rv == OGS_RETRY) + break; - prev_tm = now_tm; - } - - if (rv == CORE_EAGAIN) - { - continue; - } - - fsm_dispatch(&pgw_sm, (fsm_event_t*)&event); - } while(rv == CORE_OK); + ogs_assert(e); + ogs_fsm_dispatch(&pgw_sm, e); + pgw_event_free(e); + } } +done: - fsm_final(&pgw_sm, 0); - fsm_clear(&pgw_sm); - - event_delete(pgw_self()->queue_id); - - return NULL; + ogs_fsm_fini(&pgw_sm, 0); + ogs_fsm_delete(&pgw_sm); } diff --git a/src/pgw/pgw_ipfw.c b/src/pgw/pgw_ipfw.c index f1d987747..15ee14a24 100644 --- a/src/pgw/pgw_ipfw.c +++ b/src/pgw/pgw_ipfw.c @@ -1,7 +1,14 @@ -#define TRACE_MODULE _pgw_ipfw +#include "base/base.h" -#include "core_network.h" -#include "pgw_ipfw.h" +#if HAVE_NETINET_IP_H +#include +#endif + +#if HAVE_NETINET_IP6_H +#include +#endif + +#include "pgw_context.h" #include "ipfw/ipfw2.h" #include "ipfw/objs/include_e/netinet/ip_fw.h" @@ -11,7 +18,7 @@ void compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, void *tstate); -status_t pgw_compile_packet_filter(pgw_rule_t *pgw_rule, c_int8_t *description) +int pgw_compile_packet_filter(pgw_rule_t *pgw_rule, char *description) { pgw_rule_t zero_rule; char *token, *dir; @@ -26,8 +33,7 @@ status_t pgw_compile_packet_filter(pgw_rule_t *pgw_rule, c_int8_t *description) int l; ipfw_insn *cmd; - d_assert(pgw_rule, return CORE_ERROR, "Null param"); - d_assert(description, return CORE_ERROR, "Null param"); + ogs_assert(pgw_rule); rbufsize = sizeof(rulebuf); memset(rulebuf, 0, rbufsize); @@ -35,11 +41,16 @@ status_t pgw_compile_packet_filter(pgw_rule_t *pgw_rule, c_int8_t *description) av[0] = NULL; /* ACTION */ + if (!description) { + /* FIXME : OLD gcc generates uninitialized warning */ + ogs_assert_if_reached(); + return OGS_ERROR; + } token = strtok_r(description, " ", &saveptr); if (strcmp(token, "permit") != 0) { - d_error("Not begins with reserved keyword : 'permit'"); - return CORE_ERROR; + ogs_error("Not begins with reserved keyword : 'permit'"); + return OGS_ERROR; } av[1] = token; @@ -47,8 +58,8 @@ status_t pgw_compile_packet_filter(pgw_rule_t *pgw_rule, c_int8_t *description) dir = token = strtok_r(NULL, " ", &saveptr); if (strcmp(token, "out") != 0) { - d_error("Not begins with reserved keyword : 'permit out'"); - return CORE_ERROR; + ogs_error("Not begins with reserved keyword : 'permit out'"); + return OGS_ERROR; } /* ADDR */ @@ -143,35 +154,35 @@ status_t pgw_compile_packet_filter(pgw_rule_t *pgw_rule, c_int8_t *description) memset(&zero_rule, 0, sizeof(pgw_rule_t)); if (memcmp(pgw_rule, &zero_rule, sizeof(pgw_rule_t)) == 0) { - d_error("Cannot find Flow-Description"); - return CORE_ERROR; + ogs_error("Cannot find Flow-Description"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -static status_t decode_ipv6_header( - struct ip6_hdr *ip6_h, c_uint8_t *proto, c_uint16_t *hlen) +static int decode_ipv6_header( + struct ip6_hdr *ip6_h, uint8_t *proto, uint16_t *hlen) { int done = 0; - c_uint8_t *p, *jp, *endp; - c_uint8_t nxt; /* Next Header */ + uint8_t *p, *jp, *endp; + uint8_t nxt; /* Next Header */ - d_assert(ip6_h, return CORE_ERROR,); - d_assert(proto, return CORE_ERROR,); - d_assert(hlen, return CORE_ERROR,); + ogs_assert(ip6_h); + ogs_assert(proto); + ogs_assert(hlen); nxt = ip6_h->ip6_nxt; - p = (c_uint8_t *)ip6_h + sizeof(*ip6_h); + p = (uint8_t *)ip6_h + sizeof(*ip6_h); endp = p + ntohs(ip6_h->ip6_plen); jp = p + sizeof(struct ip6_hbh); while(p == endp) /* Jumbo Frame */ { - c_uint32_t jp_len = 0; + uint32_t jp_len = 0; struct ip6_opt_jumbo *jumbo = NULL; - d_assert(nxt == 0, return CORE_ERROR,); + ogs_assert(nxt == 0); jumbo = (struct ip6_opt_jumbo *)jp; memcpy(&jp_len, jumbo->ip6oj_jumbo_len, sizeof(jp_len)); @@ -223,30 +234,30 @@ static status_t decode_ipv6_header( } *proto = nxt; - *hlen = p - (c_uint8_t *)ip6_h; + *hlen = p - (uint8_t *)ip6_h; - return CORE_OK; + return OGS_OK; } -pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) +pgw_bearer_t *pgw_bearer_find_by_packet(ogs_pkbuf_t *pkt) { - hash_index_t *hi = NULL; + ogs_hash_index_t *hi = NULL; struct ip *ip_h = NULL; struct ip6_hdr *ip6_h = NULL; - c_uint32_t *src_addr = NULL; - c_uint32_t *dst_addr = NULL; + uint32_t *src_addr = NULL; + uint32_t *dst_addr = NULL; int addr_len = 0; - c_uint8_t proto = 0; - c_uint16_t ip_hlen = 0; - char buf[CORE_ADDRSTRLEN]; + uint8_t proto = 0; + uint16_t ip_hlen = 0; + char buf[OGS_ADDRSTRLEN]; - d_assert(pkt, return NULL, "pkt is NULL"); - d_assert(pkt->payload, return NULL, "pkt is NULL"); + ogs_assert(pkt); + ogs_assert(pkt->len); - ip_h = (struct ip *)pkt->payload; + ip_h = (struct ip *)pkt->data; if (ip_h->ip_v == 4) { - ip_h = (struct ip *)pkt->payload; + ip_h = (struct ip *)pkt->data; ip6_h = NULL; proto = ip_h->ip_p; @@ -259,22 +270,22 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) else if (ip_h->ip_v == 6) { ip_h = NULL; - ip6_h = (struct ip6_hdr *)pkt->payload; + ip6_h = (struct ip6_hdr *)pkt->data; decode_ipv6_header(ip6_h, &proto, &ip_hlen); - src_addr = (c_uint32_t *)ip6_h->ip6_src.s6_addr; - dst_addr = (c_uint32_t *)ip6_h->ip6_dst.s6_addr; + src_addr = (uint32_t *)ip6_h->ip6_src.s6_addr; + dst_addr = (uint32_t *)ip6_h->ip6_dst.s6_addr; addr_len = 16; } else - d_error("Invalid IP version = %d\n", ip_h->ip_v); + ogs_error("Invalid IP version = %d", ip_h->ip_v); - d_trace(5, "[PGW] PROTO:%d SRC:%08x %08x %08x %08x\n", + ogs_debug("[PGW] PROTO:%d SRC:%08x %08x %08x %08x", proto, ntohl(src_addr[0]), ntohl(src_addr[1]), ntohl(src_addr[2]), ntohl(src_addr[3])); - d_trace(5, "[PGW] HLEN:%d DST:%08x %08x %08x %08x\n", + ogs_debug("[PGW] HLEN:%d DST:%08x %08x %08x %08x", ip_hlen, ntohl(dst_addr[0]), ntohl(dst_addr[1]), ntohl(dst_addr[2]), ntohl(dst_addr[3])); @@ -287,13 +298,13 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) for (hi = pgw_sess_first(); hi; hi = pgw_sess_next(hi)) { pgw_sess_t *sess = pgw_sess_this(hi); - d_assert(sess, return NULL,); + ogs_assert(sess); if (sess->ipv4) - d_trace(5, "[PGW] PAA IPv4:%s\n", + ogs_debug("[PGW] PAA IPv4:%s", INET_NTOP(&sess->ipv4->addr, buf)); if (sess->ipv6) - d_trace(5, "[PGW] PAA IPv6:%s\n", + ogs_debug("[PGW] PAA IPv6:%s", INET6_NTOP(&sess->ipv6->addr, buf)); if ((sess->ipv4 && memcmp(dst_addr, sess->ipv4->addr, addr_len) == 0) || @@ -304,10 +315,10 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) /* Save the default bearer */ default_bearer = pgw_default_bearer_in_sess(sess); - d_assert(default_bearer, return NULL, "No default Bearer"); + ogs_assert(default_bearer); /* Found */ - d_trace(5, "[PGW] Found Session : EBI[%d]\n", default_bearer->ebi); + ogs_debug("[PGW] Found Session : EBI[%d]", default_bearer->ebi); bearer = pgw_bearer_next(default_bearer); /* Find the bearer with matched */ @@ -324,16 +335,16 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) for (pf = pgw_pf_first(bearer); pf; pf = pgw_pf_next(pf)) { int k; - c_uint32_t src_mask[4]; - c_uint32_t dst_mask[4]; + uint32_t src_mask[4]; + uint32_t dst_mask[4]; - d_trace(5, "DIR:%d PROTO:%d SRC:%d-%d DST:%d-%d\n", + ogs_debug("DIR:%d PROTO:%d SRC:%d-%d DST:%d-%d", pf->direction, pf->rule.proto, pf->rule.port.local.low, pf->rule.port.local.high, pf->rule.port.remote.low, pf->rule.port.remote.high); - d_trace(5, "SRC:%08x %08x %08x %08x/%08x %08x %08x %08x\n", + ogs_debug("SRC:%08x %08x %08x %08x/%08x %08x %08x %08x", ntohl(pf->rule.ip.local.addr[0]), ntohl(pf->rule.ip.local.addr[1]), ntohl(pf->rule.ip.local.addr[2]), @@ -342,7 +353,7 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) ntohl(pf->rule.ip.local.mask[1]), ntohl(pf->rule.ip.local.mask[2]), ntohl(pf->rule.ip.local.mask[3])); - d_trace(5, "DST:%08x %08x %08x %08x/%08x %08x %08x %08x\n", + ogs_debug("DST:%08x %08x %08x %08x/%08x %08x %08x %08x", ntohl(pf->rule.ip.remote.addr[0]), ntohl(pf->rule.ip.remote.addr[1]), ntohl(pf->rule.ip.remote.addr[2]), @@ -381,7 +392,7 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) { struct tcphdr *tcph = (struct tcphdr *) - ((char *)pkt->payload + ip_hlen); + ((char *)pkt->data + ip_hlen); /* Source port */ if (pf->rule.port.local.low && @@ -420,7 +431,7 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) { struct udphdr *udph = (struct udphdr *) - ((char *)pkt->payload + ip_hlen); + ((char *)pkt->data + ip_hlen); /* Source port */ if (pf->rule.port.local.low && @@ -469,7 +480,7 @@ pgw_bearer_t *pgw_bearer_find_by_packet(pkbuf_t *pkt) if (pf) { bearer = pf->bearer; - d_trace(5, "Found Dedicated Bearer : EBI[%d]\n", bearer->ebi); + ogs_debug("Found Dedicated Bearer : EBI[%d]", bearer->ebi); break; } diff --git a/src/pgw/pgw_ipfw.h b/src/pgw/pgw_ipfw.h index 3c75adeef..2f1f50db3 100644 --- a/src/pgw/pgw_ipfw.h +++ b/src/pgw/pgw_ipfw.h @@ -1,13 +1,9 @@ #ifndef __PGW_IPFW_H__ #define __PGW_IPFW_H__ -#include "core_debug.h" - #include "pgw_context.h" -CORE_DECLARE(status_t) pgw_compile_packet_filter( - pgw_rule_t *pf, c_int8_t *description); - -CORE_DECLARE(pgw_bearer_t*) pgw_bearer_find_by_packet(pkbuf_t *pkt); +int pgw_compile_packet_filter(pgw_rule_t *pf, char *description); +pgw_bearer_t *pgw_bearer_find_by_packet(ogs_pkbuf_t *pkt); #endif /* __PGW_IPFW_H__ */ diff --git a/src/pgw/pgw_s5c_build.c b/src/pgw/pgw_s5c_build.c index 8fe67daf8..db3861355 100644 --- a/src/pgw/pgw_s5c_build.c +++ b/src/pgw/pgw_s5c_build.c @@ -1,8 +1,4 @@ -#define TRACE_MODULE _pgw_s5c_build - -#include "core_debug.h" - -#include "3gpp_types.h" +#include "base/types.h" #include "gtp/gtp_types.h" #include "gtp/gtp_conv.h" #include "gtp/gtp_message.h" @@ -12,13 +8,13 @@ #include "pgw_context.h" -static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco); +static int16_t pgw_pco_build(uint8_t *pco_buf, tlv_pco_t *tlv_pco); -status_t pgw_s5c_build_create_session_response( - pkbuf_t **pkbuf, c_uint8_t type, pgw_sess_t *sess, +int pgw_s5c_build_create_session_response( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_sess_t *sess, gx_message_t *gx_message, gtp_create_session_request_t *req) { - status_t rv; + int rv; pgw_bearer_t *bearer = NULL; gtp_message_t gtp_message; @@ -27,19 +23,19 @@ status_t pgw_s5c_build_create_session_response( gtp_cause_t cause; gtp_f_teid_t pgw_s5c_teid, pgw_s5u_teid; int len; - c_uint8_t pco_buf[MAX_PCO_LEN]; - c_int16_t pco_len; + uint8_t pco_buf[MAX_PCO_LEN]; + int16_t pco_len; - d_trace(3, "[PGW] Create Session Response\n"); + ogs_debug("[PGW] Create Session Response"); - d_assert(sess, return CORE_ERROR, "Null param"); - d_assert(req, return CORE_ERROR, "Null param"); + ogs_assert(sess); + ogs_assert(req); bearer = pgw_default_bearer_in_sess(sess); - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]\n", + ogs_debug(" SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]", bearer->sgw_s5u_teid, bearer->pgw_s5u_teid); rsp = >p_message.create_session_response; @@ -58,7 +54,7 @@ status_t pgw_s5c_build_create_session_response( pgw_s5c_teid.teid = htonl(sess->pgw_s5c_teid); rv = gtp_sockaddr_to_f_teid( pgw_self()->gtpc_addr, pgw_self()->gtpc_addr6, &pgw_s5c_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface. presence = 1; rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface. @@ -75,7 +71,7 @@ status_t pgw_s5c_build_create_session_response( else if (sess->ipv6) rsp->pdn_address_allocation.len = PAA_IPV6_LEN; else - d_assert(0, return CORE_ERROR, "No IP Pool"); + ogs_assert_if_reached(); rsp->pdn_address_allocation.presence = 1; /* APN Restriction */ @@ -89,7 +85,7 @@ status_t pgw_s5c_build_create_session_response( if (req->protocol_configuration_options.presence == 1) { pco_len = pgw_pco_build(pco_buf, &req->protocol_configuration_options); - d_assert(pco_len > 0, return CORE_ERROR, "pco build failed"); + ogs_assert(pco_len > 0); rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len; @@ -109,33 +105,33 @@ status_t pgw_s5c_build_create_session_response( pgw_s5u_teid.teid = htonl(bearer->pgw_s5u_teid); rv = gtp_sockaddr_to_f_teid( pgw_self()->gtpu_addr, pgw_self()->gtpu_addr6, &pgw_s5u_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.presence = 1; rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.data = &pgw_s5u_teid; rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.len = len; gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t pgw_s5c_build_delete_session_response( - pkbuf_t **pkbuf, c_uint8_t type, +int pgw_s5c_build_delete_session_response( + ogs_pkbuf_t **pkbuf, uint8_t type, gx_message_t *gx_message, gtp_delete_session_request_t *req) { - status_t rv; + int rv; gtp_message_t gtp_message; gtp_delete_session_response_t *rsp = NULL; gtp_cause_t cause; - c_uint8_t pco_buf[MAX_PCO_LEN]; - c_int16_t pco_len; + uint8_t pco_buf[MAX_PCO_LEN]; + int16_t pco_len; - d_assert(gx_message, return CORE_ERROR, "Null param"); - d_assert(req, return CORE_ERROR, "Null param"); + ogs_assert(gx_message); + ogs_assert(req); /* prepare cause */ memset(&cause, 0, sizeof(cause)); @@ -155,7 +151,7 @@ status_t pgw_s5c_build_delete_session_response( if (req->protocol_configuration_options.presence == 1) { pco_len = pgw_pco_build(pco_buf, &req->protocol_configuration_options); - d_assert(pco_len > 0, return CORE_ERROR, "pco build failed"); + ogs_assert(pco_len > 0); rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len; @@ -166,9 +162,9 @@ status_t pgw_s5c_build_delete_session_response( /* build */ gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } static void encode_traffic_flow_template(gtp_tft_t *tft, pgw_bearer_t *bearer) @@ -176,8 +172,8 @@ static void encode_traffic_flow_template(gtp_tft_t *tft, pgw_bearer_t *bearer) int i, j, len; pgw_pf_t *pf = NULL; - d_assert(tft, return,); - d_assert(bearer, return,); + ogs_assert(tft); + ogs_assert(bearer); memset(tft, 0, sizeof(*tft)); tft->code = GTP_TFT_CODE_CREATE_NEW_TFT; @@ -224,7 +220,7 @@ static void encode_traffic_flow_template(gtp_tft_t *tft, pgw_bearer_t *bearer) memcpy(tft->pf[i].component[j].ipv6.addr, pf->rule.ip.local.addr, sizeof pf->rule.ip.local.addr); tft->pf[i].component[j].ipv6.prefixlen = - contigmask((c_uint8_t *)pf->rule.ip.local.mask, 128); + contigmask((uint8_t *)pf->rule.ip.local.mask, 128); j++; len += 18; } @@ -235,7 +231,7 @@ static void encode_traffic_flow_template(gtp_tft_t *tft, pgw_bearer_t *bearer) memcpy(tft->pf[i].component[j].ipv6.addr, pf->rule.ip.remote.addr, sizeof pf->rule.ip.remote.addr); tft->pf[i].component[j].ipv6.prefixlen = - contigmask((c_uint8_t *)pf->rule.ip.remote.mask, 128); + contigmask((uint8_t *)pf->rule.ip.remote.mask, 128); j++; len += 18; } @@ -286,10 +282,10 @@ static void encode_traffic_flow_template(gtp_tft_t *tft, pgw_bearer_t *bearer) tft->num_of_packet_filter = i; } -status_t pgw_s5c_build_create_bearer_request( - pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer) +int pgw_s5c_build_create_bearer_request( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_bearer_t *bearer) { - status_t rv; + int rv; pgw_sess_t *sess = NULL; pgw_bearer_t *linked_bearer = NULL; @@ -303,14 +299,14 @@ status_t pgw_s5c_build_create_bearer_request( int len; char tft_buf[GTP_MAX_TRAFFIC_FLOW_TEMPLATE]; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); linked_bearer = pgw_default_bearer_in_sess(sess); - d_assert(linked_bearer, return CORE_ERROR, "Null param"); + ogs_assert(linked_bearer); - d_trace(3, "[PGW] Create Bearer Request\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Create Bearer Request"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); req = >p_message.create_bearer_request; @@ -331,7 +327,7 @@ status_t pgw_s5c_build_create_bearer_request( pgw_s5u_teid.teid = htonl(bearer->pgw_s5u_teid); rv = gtp_sockaddr_to_f_teid( pgw_self()->gtpu_addr, pgw_self()->gtpu_addr6, &pgw_s5u_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); req->bearer_contexts.s5_s8_u_sgw_f_teid.presence = 1; req->bearer_contexts.s5_s8_u_sgw_f_teid.data = &pgw_s5u_teid; req->bearer_contexts.s5_s8_u_sgw_f_teid.len = len; @@ -361,16 +357,16 @@ status_t pgw_s5c_build_create_bearer_request( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t pgw_s5c_build_update_bearer_request( - pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer, +int pgw_s5c_build_update_bearer_request( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_bearer_t *bearer, int qos_presence, int tft_presence) { - status_t rv; + int rv; pgw_sess_t *sess = NULL; pgw_bearer_t *linked_bearer = NULL; @@ -382,14 +378,14 @@ status_t pgw_s5c_build_update_bearer_request( gtp_tft_t tft; char tft_buf[GTP_MAX_TRAFFIC_FLOW_TEMPLATE]; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); linked_bearer = pgw_default_bearer_in_sess(sess); - d_assert(linked_bearer, return CORE_ERROR, "Null param"); + ogs_assert(linked_bearer); - d_trace(3, "[PGW] Update Bearer Request\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Update Bearer Request"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); req = >p_message.update_bearer_request; memset(>p_message, 0, sizeof(gtp_message_t)); @@ -430,29 +426,29 @@ status_t pgw_s5c_build_update_bearer_request( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -status_t pgw_s5c_build_delete_bearer_request( - pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer) +int pgw_s5c_build_delete_bearer_request( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_bearer_t *bearer) { - status_t rv; + int rv; pgw_sess_t *sess = NULL; pgw_bearer_t *linked_bearer = NULL; gtp_message_t gtp_message; gtp_delete_bearer_request_t *req = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return CORE_ERROR, "Null param"); + ogs_assert(sess); linked_bearer = pgw_default_bearer_in_sess(sess); - d_assert(linked_bearer, return CORE_ERROR, "Null param"); + ogs_assert(linked_bearer); - d_trace(3, "[PGW] Delete Bearer Request\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Delete Bearer Request"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); req = >p_message.delete_bearer_request; memset(>p_message, 0, sizeof(gtp_message_t)); @@ -472,26 +468,26 @@ status_t pgw_s5c_build_delete_bearer_request( gtp_message.h.type = type; rv = gtp_build_msg(pkbuf, >p_message); - d_assert(rv == CORE_OK, return CORE_ERROR, "gtp build failed"); + ogs_assert(rv == OGS_OK); - return CORE_OK; + return OGS_OK; } -static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) +static int16_t pgw_pco_build(uint8_t *pco_buf, tlv_pco_t *tlv_pco) { - status_t rv; + int rv; pco_t ue, pgw; pco_ipcp_t pco_ipcp; - ipsubnet_t dns_primary, dns_secondary, dns6_primary, dns6_secondary; - ipsubnet_t p_cscf, p_cscf6; - c_int8_t size = 0; + ogs_ipsubnet_t dns_primary, dns_secondary, dns6_primary, dns6_secondary; + ogs_ipsubnet_t p_cscf, p_cscf6; + int size = 0; int i = 0; - d_assert(pco_buf, return -1, "Null param"); - d_assert(tlv_pco, return -1, "Null param"); + ogs_assert(pco_buf); + ogs_assert(tlv_pco); size = pco_parse(&ue, tlv_pco->data, tlv_pco->len); - d_assert(size, return -1, "pco parse failed"); + ogs_assert(size); memset(&pgw, 0, sizeof(pco_t)); pgw.ext = ue.ext; @@ -499,7 +495,7 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) for(i = 0; i < ue.num_of_id; i++) { - c_uint8_t *data = ue.ids[i].data; + uint8_t *data = ue.ids[i].data; switch(ue.ids[i].id) { case PCO_ID_CHALLENGE_HANDSHAKE_AUTHENTICATION_PROTOCOL: @@ -509,7 +505,7 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = 4; pgw.ids[pgw.num_of_id].data = - (c_uint8_t *)"\x03\x00\x00\x04"; /* Code : Success */ + (uint8_t *)"\x03\x00\x00\x04"; /* Code : Success */ pgw.num_of_id++; } break; @@ -518,7 +514,7 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) { if (data[0] == 1) /* Code : Configuration Request */ { - c_uint16_t len = 16; + uint16_t len = 16; memset(&pco_ipcp, 0, sizeof(pco_ipcp_t)); pco_ipcp.code = 2; /* Code : Configuration Ack */ @@ -527,9 +523,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) /* Primary DNS Server IP Address */ if (pgw_self()->dns[0]) { - rv = core_ipsubnet( + rv = ogs_ipsubnet( &dns_primary, pgw_self()->dns[0], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pco_ipcp.options[0].type = 129; pco_ipcp.options[0].len = 6; pco_ipcp.options[0].addr = dns_primary.sub[0]; @@ -538,9 +534,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) /* Secondary DNS Server IP Address */ if (pgw_self()->dns[1]) { - rv = core_ipsubnet( + rv = ogs_ipsubnet( &dns_secondary, pgw_self()->dns[1], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pco_ipcp.options[1].type = 131; pco_ipcp.options[1].len = 6; pco_ipcp.options[1].addr = dns_secondary.sub[0]; @@ -548,7 +544,7 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = len; - pgw.ids[pgw.num_of_id].data = (c_uint8_t *)&pco_ipcp; + pgw.ids[pgw.num_of_id].data = (uint8_t *)&pco_ipcp; pgw.num_of_id++; } @@ -558,9 +554,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) { if (pgw_self()->dns[0]) { - rv = core_ipsubnet( + rv = ogs_ipsubnet( &dns_primary, pgw_self()->dns[0], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = IPV4_LEN; pgw.ids[pgw.num_of_id].data = dns_primary.sub; @@ -569,9 +565,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) if (pgw_self()->dns[1]) { - rv = core_ipsubnet( + rv = ogs_ipsubnet( &dns_secondary, pgw_self()->dns[1], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = IPV4_LEN; pgw.ids[pgw.num_of_id].data = dns_secondary.sub; @@ -583,9 +579,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) { if (pgw_self()->dns6[0]) { - rv = core_ipsubnet( + rv = ogs_ipsubnet( &dns6_primary, pgw_self()->dns6[0], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = IPV6_LEN; pgw.ids[pgw.num_of_id].data = dns6_primary.sub; @@ -594,9 +590,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) if (pgw_self()->dns6[1]) { - rv = core_ipsubnet( + rv = ogs_ipsubnet( &dns6_secondary, pgw_self()->dns6[1], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = IPV6_LEN; pgw.ids[pgw.num_of_id].data = dns6_secondary.sub; @@ -608,9 +604,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) { if (pgw_self()->num_of_p_cscf) { - rv = core_ipsubnet(&p_cscf, + rv = ogs_ipsubnet(&p_cscf, pgw_self()->p_cscf[pgw_self()->p_cscf_index], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = IPV4_LEN; pgw.ids[pgw.num_of_id].data = p_cscf.sub; @@ -625,9 +621,9 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) { if (pgw_self()->num_of_p_cscf6) { - rv = core_ipsubnet(&p_cscf6, + rv = ogs_ipsubnet(&p_cscf6, pgw_self()->p_cscf6[pgw_self()->p_cscf6_index], NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); pgw.ids[pgw.num_of_id].id = ue.ids[i].id; pgw.ids[pgw.num_of_id].len = IPV6_LEN; pgw.ids[pgw.num_of_id].data = p_cscf6.sub; @@ -645,7 +641,7 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) /* TODO */ break; default: - d_warn("Unknown PCO ID:(0x%x)", ue.ids[i].id); + ogs_warn("Unknown PCO ID:(0x%x)", ue.ids[i].id); } } diff --git a/src/pgw/pgw_s5c_build.h b/src/pgw/pgw_s5c_build.h index 78c2a3dd0..7a5b215b4 100644 --- a/src/pgw/pgw_s5c_build.h +++ b/src/pgw/pgw_s5c_build.h @@ -7,20 +7,20 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) pgw_s5c_build_create_session_response( - pkbuf_t **pkbuf, c_uint8_t type, pgw_sess_t *sess, +int pgw_s5c_build_create_session_response( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_sess_t *sess, gx_message_t *gx_message, gtp_create_session_request_t *req); -CORE_DECLARE(status_t) pgw_s5c_build_delete_session_response( - pkbuf_t **pkbuf, c_uint8_t type, +int pgw_s5c_build_delete_session_response( + ogs_pkbuf_t **pkbuf, uint8_t type, gx_message_t *gx_message, gtp_delete_session_request_t *req); -CORE_DECLARE(status_t) pgw_s5c_build_create_bearer_request( - pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer); -CORE_DECLARE(status_t) pgw_s5c_build_update_bearer_request( - pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer, +int pgw_s5c_build_create_bearer_request( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_bearer_t *bearer); +int pgw_s5c_build_update_bearer_request( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_bearer_t *bearer, int qos_presence, int tft_presence); -CORE_DECLARE(status_t) pgw_s5c_build_delete_bearer_request( - pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer); +int pgw_s5c_build_delete_bearer_request( + ogs_pkbuf_t **pkbuf, uint8_t type, pgw_bearer_t *bearer); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/pgw/pgw_s5c_handler.c b/src/pgw/pgw_s5c_handler.c index 362267dfe..e9b51c9b7 100644 --- a/src/pgw/pgw_s5c_handler.c +++ b/src/pgw/pgw_s5c_handler.c @@ -1,13 +1,8 @@ -#define TRACE_MODULE _pgw_s5c_handler - -#include "core_debug.h" -#include "core_lib.h" - #include "gtp/gtp_types.h" #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" -#include "common/context.h" +#include "app/context.h" #include "pgw_event.h" #include "pgw_context.h" #include "pgw_gtp_path.h" @@ -16,71 +11,71 @@ void pgw_s5c_handle_create_session_request( pgw_sess_t *sess, gtp_xact_t *xact, gtp_create_session_request_t *req) { - status_t rv; + int rv; gtp_f_teid_t *sgw_s5c_teid, *sgw_s5u_teid; gtp_node_t *sgw = NULL; pgw_bearer_t *bearer = NULL; gtp_bearer_qos_t bearer_qos; gtp_ambr_t *ambr = NULL; gtp_uli_t uli; - c_uint16_t decoded = 0; + uint16_t decoded = 0; - d_assert(xact, return, "Null param"); - d_assert(sess, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(sess); + ogs_assert(req); bearer = pgw_default_bearer_in_sess(sess); - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); - d_trace(3, "[PGW] Create Session Reqeust\n"); + ogs_debug("[PGW] Create Session Reqeust"); if (req->imsi.presence == 0) { - d_error("No IMSI"); + ogs_error("No IMSI"); return; } if (req->sender_f_teid_for_control_plane.presence == 0) { - d_error("No TEID"); + ogs_error("No TEID"); return; } if (req->bearer_contexts_to_be_created.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts_to_be_created.bearer_level_qos.presence == 0) { - d_error("No EPS Bearer QoS"); + ogs_error("No EPS Bearer QoS"); return; } if (req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.presence == 0) { - d_error("No TEID"); + ogs_error("No TEID"); return; } if (req->user_location_information.presence == 0) { - d_error("No User Location Inforamtion"); + ogs_error("No User Location Inforamtion"); return; } /* Set IMSI */ sess->imsi_len = req->imsi.len; memcpy(sess->imsi, req->imsi.data, sess->imsi_len); - core_buffer_to_bcd(sess->imsi, sess->imsi_len, sess->imsi_bcd); + ogs_buffer_to_bcd(sess->imsi, sess->imsi_len, sess->imsi_bcd); /* Control Plane(DL) : SGW-S5C */ sgw_s5c_teid = req->sender_f_teid_for_control_plane.data; - d_assert(sgw_s5c_teid, return, "Null param"); + ogs_assert(sgw_s5c_teid); sess->sgw_s5c_teid = ntohl(sgw_s5c_teid->teid); /* Control Plane(DL) : SGW-S5U */ sgw_s5u_teid = req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.data; - d_assert(sgw_s5u_teid, return, "Null param"); + ogs_assert(sgw_s5u_teid); bearer->sgw_s5u_teid = ntohl(sgw_s5u_teid->teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]\n", + ogs_debug(" SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]", bearer->sgw_s5u_teid, bearer->pgw_s5u_teid); sgw = gtp_find_node(&pgw_self()->sgw_s5u_list, sgw_s5u_teid); @@ -88,21 +83,22 @@ void pgw_s5c_handle_create_session_request( { sgw = gtp_add_node(&pgw_self()->sgw_s5u_list, sgw_s5u_teid, pgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(sgw, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(sgw); - rv = gtp_client(sgw); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect( + pgw_self()->gtpu_sock, pgw_self()->gtpu_sock6, sgw); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(bearer, sgw); decoded = gtp_parse_bearer_qos(&bearer_qos, &req->bearer_contexts_to_be_created.bearer_level_qos); - d_assert(req->bearer_contexts_to_be_created.bearer_level_qos.len == - decoded, return,); + ogs_assert(req->bearer_contexts_to_be_created.bearer_level_qos.len == + decoded); sess->pdn.qos.qci = bearer_qos.qci; sess->pdn.qos.arp.priority_level = bearer_qos.priority_level; sess->pdn.qos.arp.pre_emption_capability = @@ -120,7 +116,7 @@ void pgw_s5c_handle_create_session_request( /* Set User Location Information */ decoded = gtp_parse_uli(&uli, &req->user_location_information); - d_assert(req->user_location_information.len == decoded, return,); + ogs_assert(req->user_location_information.len == decoded); memcpy(&sess->tai.plmn_id, &uli.tai.plmn_id, sizeof(uli.tai.plmn_id)); sess->tai.tac = uli.tai.tac; memcpy(&sess->e_cgi.plmn_id, &uli.e_cgi.plmn_id, sizeof(uli.e_cgi.plmn_id)); @@ -130,56 +126,56 @@ void pgw_s5c_handle_create_session_request( void pgw_s5c_handle_delete_session_request( pgw_sess_t *sess, gtp_xact_t *xact, gtp_delete_session_request_t *req) { - d_assert(sess, return, "Null param"); + ogs_assert(sess); - d_trace(3, "[PGW] Delete Session Request\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Delete Session Request"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); } void pgw_s5c_handle_create_bearer_response( pgw_sess_t *sess, gtp_xact_t *xact, gtp_create_bearer_response_t *req) { - status_t rv; + int rv; gtp_f_teid_t *sgw_s5u_teid, *pgw_s5u_teid; gtp_node_t *sgw = NULL; pgw_bearer_t *bearer = NULL; - d_assert(xact, return, "Null param"); - d_assert(sess, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(sess); + ogs_assert(req); - d_trace(3, "[PGW] Create Bearer Response\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Create Bearer Response"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } if (req->bearer_contexts.s5_s8_u_pgw_f_teid.presence == 0) { - d_error("No PGW TEID"); + ogs_error("No PGW TEID"); return; } if (req->bearer_contexts.s5_s8_u_sgw_f_teid.presence == 0) { - d_error("No SGW TEID"); + ogs_error("No SGW TEID"); return; } /* Correlate with PGW-S%U-TEID */ pgw_s5u_teid = req->bearer_contexts.s5_s8_u_pgw_f_teid.data; - d_assert(pgw_s5u_teid, return, "Null param"); + ogs_assert(pgw_s5u_teid); /* Find the Bearer by PGW-S5U-TEID */ bearer = pgw_bearer_find_by_pgw_s5u_teid(ntohl(pgw_s5u_teid->teid)); - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); /* Set EBI */ bearer->ebi = req->bearer_contexts.eps_bearer_id.u8; @@ -192,87 +188,86 @@ void pgw_s5c_handle_create_bearer_response( { sgw = gtp_add_node(&pgw_self()->sgw_s5u_list, sgw_s5u_teid, pgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(sgw, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(sgw); - rv = gtp_client(sgw); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect(pgw_self()->gtpu_sock, pgw_self()->gtpu_sock6, sgw); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(bearer, sgw); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); - d_trace(3, "[PGW] Create Bearer Response : SGW[0x%x] --> PGW[0x%x]\n", + ogs_debug("[PGW] Create Bearer Response : SGW[0x%x] --> PGW[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); } void pgw_s5c_handle_update_bearer_response( pgw_sess_t *sess, gtp_xact_t *xact, gtp_update_bearer_response_t *req) { - status_t rv; + int rv; - d_assert(xact, return, "Null param"); - d_assert(sess, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(sess); + ogs_assert(req); - d_trace(3, "[PGW] Update Bearer Request\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Update Bearer Request"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); - d_trace(3, "[PGW] Update Bearer Response : SGW[0x%x] --> PGW[0x%x]\n", + ogs_debug("[PGW] Update Bearer Response : SGW[0x%x] --> PGW[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); } void pgw_s5c_handle_delete_bearer_response( pgw_sess_t *sess, gtp_xact_t *xact, gtp_delete_bearer_response_t *req) { - status_t rv; + int rv; pgw_bearer_t *bearer = NULL; - d_assert(xact, return, "Null param"); - d_assert(sess, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(xact); + ogs_assert(sess); + ogs_assert(req); - d_trace(3, "[PGW] Delete Bearer Request\n"); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug("[PGW] Delete Bearer Request"); + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } bearer = pgw_bearer_find_by_ebi( sess, req->bearer_contexts.eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context[EBI:%d]", - req->bearer_contexts.eps_bearer_id); + ogs_assert(bearer); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); - d_trace(3, "[PGW] Delete Bearer Response : SGW[0x%x] --> PGW[0x%x]\n", + ogs_debug("[PGW] Delete Bearer Response : SGW[0x%x] --> PGW[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); pgw_bearer_remove(bearer); diff --git a/src/pgw/pgw_s5c_handler.h b/src/pgw/pgw_s5c_handler.h index 3f61ae269..7f1234c19 100644 --- a/src/pgw/pgw_s5c_handler.h +++ b/src/pgw/pgw_s5c_handler.h @@ -9,15 +9,15 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) pgw_s5c_handle_create_session_request( +void pgw_s5c_handle_create_session_request( pgw_sess_t *sess, gtp_xact_t *xact, gtp_create_session_request_t *req); -CORE_DECLARE(void) pgw_s5c_handle_delete_session_request( +void pgw_s5c_handle_delete_session_request( pgw_sess_t *sess, gtp_xact_t *xact, gtp_delete_session_request_t *req); -CORE_DECLARE(void) pgw_s5c_handle_create_bearer_response( +void pgw_s5c_handle_create_bearer_response( pgw_sess_t *sess, gtp_xact_t *xact, gtp_create_bearer_response_t *req); -CORE_DECLARE(void) pgw_s5c_handle_update_bearer_response( +void pgw_s5c_handle_update_bearer_response( pgw_sess_t *sess, gtp_xact_t *xact, gtp_update_bearer_response_t *req); -CORE_DECLARE(void) pgw_s5c_handle_delete_bearer_response( +void pgw_s5c_handle_delete_bearer_response( pgw_sess_t *sess, gtp_xact_t *xact, gtp_delete_bearer_response_t *req); #ifdef __cplusplus diff --git a/src/pgw/pgw_sm.c b/src/pgw/pgw_sm.c index 21c6710a4..8dcb44fdf 100644 --- a/src/pgw/pgw_sm.c +++ b/src/pgw/pgw_sm.c @@ -1,8 +1,3 @@ -#define TRACE_MODULE _pgw_sm - -#include "core_debug.h" -#include "core_lib.h" - #include "gtp/gtp_node.h" #include "fd/fd_lib.h" #include "fd/gx/gx_message.h" @@ -15,79 +10,79 @@ #include "pgw_gx_handler.h" #include "pgw_fd_path.h" -void pgw_state_initial(fsm_t *s, event_t *e) +void pgw_state_initial(ogs_fsm_t *s, pgw_event_t *e) { - pgw_sm_trace(3, e); + pgw_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); - FSM_TRAN(s, &pgw_state_operational); + OGS_FSM_TRAN(s, &pgw_state_operational); } -void pgw_state_final(fsm_t *s, event_t *e) +void pgw_state_final(ogs_fsm_t *s, pgw_event_t *e) { - pgw_sm_trace(3, e); + pgw_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); } -void pgw_state_operational(fsm_t *s, event_t *e) +void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e) { - status_t rv; + int rv; - pgw_sm_trace(3, e); + pgw_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { rv = pgw_gtp_open(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't establish PGW path"); + ogs_error("Can't establish PGW path"); break; } break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { rv = pgw_gtp_close(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't close PGW path"); + ogs_error("Can't close PGW path"); break; } break; } case PGW_EVT_S5C_MESSAGE: { - status_t rv; - pkbuf_t *recvbuf = (pkbuf_t *)event_get_param1(e); - pkbuf_t *copybuf = NULL; - c_uint16_t copybuf_len = 0; + int rv; + ogs_pkbuf_t *recvbuf = NULL; + ogs_pkbuf_t *copybuf = NULL; + uint16_t copybuf_len = 0; gtp_xact_t *xact = NULL; gtp_message_t *message = NULL; pgw_sess_t *sess = NULL; - d_assert(recvbuf, break, "Null param"); + ogs_assert(e); + recvbuf = e->gtpbuf; + ogs_assert(recvbuf); copybuf_len = sizeof(gtp_message_t); - copybuf = pkbuf_alloc(0, copybuf_len); - d_assert(copybuf, break, "Null param"); - message = copybuf->payload; - d_assert(message, break, "Null param"); + copybuf = ogs_pkbuf_alloc(NULL, copybuf_len); + ogs_pkbuf_put(copybuf, copybuf_len); + message = copybuf->data; + ogs_assert(message); rv = gtp_parse_msg(message, recvbuf); - d_assert(rv == CORE_OK, - pkbuf_free(recvbuf); pkbuf_free(copybuf); break, - "parse error"); + ogs_assert(rv == OGS_OK); if (message->h.teid == 0) { gtp_node_t *sgw = pgw_sgw_add_by_message(message); - d_assert(sgw, pkbuf_free(recvbuf);pkbuf_free(copybuf); break,); + ogs_assert(sgw); sess = pgw_sess_add_by_message(message); SETUP_GTP_NODE(sess, sgw); } @@ -95,14 +90,13 @@ void pgw_state_operational(fsm_t *s, event_t *e) { sess = pgw_sess_find_by_teid(message->h.teid); } - d_assert(sess, pkbuf_free(recvbuf); pkbuf_free(copybuf); break, - "No Session Context"); + ogs_assert(sess); rv = gtp_xact_receive(sess->gnode, &message->h, &xact); - if (rv != CORE_OK) + if (rv != OGS_OK) { - pkbuf_free(recvbuf); - pkbuf_free(copybuf); + ogs_pkbuf_free(recvbuf); + ogs_pkbuf_free(copybuf); break; } @@ -123,67 +117,66 @@ void pgw_state_operational(fsm_t *s, event_t *e) case GTP_CREATE_BEARER_RESPONSE_TYPE: pgw_s5c_handle_create_bearer_response( sess, xact, &message->create_bearer_response); - pkbuf_free(copybuf); + ogs_pkbuf_free(copybuf); break; case GTP_UPDATE_BEARER_RESPONSE_TYPE: pgw_s5c_handle_update_bearer_response( sess, xact, &message->update_bearer_response); - pkbuf_free(copybuf); + ogs_pkbuf_free(copybuf); break; case GTP_DELETE_BEARER_RESPONSE_TYPE: pgw_s5c_handle_delete_bearer_response( sess, xact, &message->delete_bearer_response); - pkbuf_free(copybuf); + ogs_pkbuf_free(copybuf); break; default: - d_warn("Not implmeneted(type:%d)", message->h.type); - pkbuf_free(copybuf); + ogs_warn("Not implmeneted(type:%d)", message->h.type); + ogs_pkbuf_free(copybuf); break; } - pkbuf_free(recvbuf); - break; - } - case PGW_EVT_S5C_T3_RESPONSE: - case PGW_EVT_S5C_T3_HOLDING: - { - gtp_xact_timeout(event_get_param1(e), event_get(e)); + ogs_pkbuf_free(recvbuf); break; } case PGW_EVT_GX_MESSAGE: { - index_t sess_index = event_get_param1(e); + ogs_index_t sess_index; pgw_sess_t *sess = NULL; - pkbuf_t *gxbuf = (pkbuf_t *)event_get_param2(e); + ogs_pkbuf_t *gxbuf = NULL; gx_message_t *gx_message = NULL; - d_assert(sess_index, return, "Null param"); + ogs_assert(e); + sess_index = e->sess_index; + ogs_assert(sess_index); sess = pgw_sess_find(sess_index); - d_assert(sess, return, "Null param"); + ogs_assert(sess); - d_assert(gxbuf, return, "Null param"); - gx_message = gxbuf->payload; - d_assert(gx_message, return, "Null param"); + gxbuf = e->gxbuf; + ogs_assert(gxbuf); + gx_message = gxbuf->data; + ogs_assert(gx_message); switch(gx_message->cmd_code) { case GX_CMD_CODE_CREDIT_CONTROL: { - index_t xact_index = event_get_param3(e); + uint32_t xact_index; gtp_xact_t *xact = NULL; - pkbuf_t *gtpbuf = (pkbuf_t *)event_get_param4(e); + ogs_pkbuf_t *gtpbuf = NULL; gtp_message_t *message = NULL; - d_assert(xact_index, return, "Null param"); + xact_index = e->xact_index; + ogs_assert(xact_index); xact = gtp_xact_find(xact_index); - d_assert(xact, return, "Null param"); + ogs_assert(xact); - d_assert(gtpbuf, return, "Null param"); - message = gtpbuf->payload; + gtpbuf = e->gtpbuf; + ogs_assert(gtpbuf); + message = gtpbuf->data; if (gx_message->result_code != ER_DIAMETER_SUCCESS) { - d_error("Diameter Error(%d)", gx_message->result_code); + ogs_error("Diameter Error(%d)", gx_message->result_code); break; } switch(gx_message->cc_request_type) @@ -204,12 +197,13 @@ void pgw_state_operational(fsm_t *s, event_t *e) } default: { - d_error("Not implemented(%d)", event_get_param4(e)); + ogs_error("Not implemented(%d)", + gx_message->cc_request_type); break; } } - pkbuf_free(gtpbuf); + ogs_pkbuf_free(gtpbuf); break; } case GX_CMD_RE_AUTH: @@ -219,18 +213,18 @@ void pgw_state_operational(fsm_t *s, event_t *e) } default: { - d_error("Invalid type(%d)", event_get_param3(e)); + ogs_error("Invalid type(%d)", gx_message->cmd_code); break; } } gx_message_free(gx_message); - pkbuf_free(gxbuf); + ogs_pkbuf_free(gxbuf); break; } default: { - d_error("No handler for event %s", pgw_event_get_name(e)); + ogs_error("No handler for event %s", pgw_event_get_name(e)); break; } } diff --git a/src/pgw/pgw_sm.h b/src/pgw/pgw_sm.h index e0c028d0d..3948b1e1f 100644 --- a/src/pgw/pgw_sm.h +++ b/src/pgw/pgw_sm.h @@ -1,24 +1,19 @@ #ifndef __PGW_SM_H__ #define __PGW_SM_H__ -#include "core_param.h" -#include "core_fsm.h" -#include "core_event.h" +#include "pgw_event.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -void pgw_state_initial(fsm_t *s, event_t *e); -void pgw_state_final(fsm_t *s, event_t *e); -void pgw_state_operational(fsm_t *s, event_t *e); -void pgw_state_exception(fsm_t *s, event_t *e); +void pgw_state_initial(ogs_fsm_t *s, pgw_event_t *e); +void pgw_state_final(ogs_fsm_t *s, pgw_event_t *e); +void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e); +void pgw_state_exception(ogs_fsm_t *s, pgw_event_t *e); -#define pgw_sm_print(__pe) \ - d_print("%s(): %s\n", __func__, pgw_event_get_name(__pe)) - -#define pgw_sm_trace(__l, __pe) \ - d_trace(__l, "%s(): %s\n", __func__, pgw_event_get_name(__pe)) +#define pgw_sm_debug(__pe) \ + ogs_debug("%s(): %s", __func__, pgw_event_get_name(__pe)) #ifdef __cplusplus } diff --git a/src/sgw.c b/src/sgw.c index 2fe59ff47..b598ce7fa 100644 --- a/src/sgw.c +++ b/src/sgw.c @@ -1,54 +1,42 @@ -#define TRACE_MODULE _sgw_main - -#include "core_debug.h" -#include "core_signal.h" -#include "core_semaphore.h" - -#include "common/context.h" -#include "common/application.h" +#include "app/context.h" +#include "app/application.h" #include "app_init.h" -status_t app_initialize( - const char *config_path, const char *log_path, const char *pid_path) +extern int __sgw_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __sgw_log_domain + +int app_initialize(app_param_t *param) { - status_t rv; - int app = 0; + int rv; - rv = app_log_pid(pid_path, "sgw"); - if (rv != CORE_OK) return rv; + param->name = "sgw"; + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_sgw_main, app); - } - - d_trace(1, "SGW try to initialize\n"); rv = sgw_initialize(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Failed to intialize SGW"); + ogs_error("Failed to intialize SGW"); return rv; } - d_trace(1, "SGW initialize...done\n"); + ogs_info("SGW initialize...done"); rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; + return OGS_OK; } void app_terminate(void) { app_will_terminate(); - d_trace(1, "SGW try to terminate\n"); + ogs_info("SGW try to terminate"); sgw_terminate(); - d_trace(1, "SGW terminate...done\n"); + ogs_info("SGW terminate...done"); app_did_terminate(); } diff --git a/src/sgw/Makefile.am b/src/sgw/Makefile.am index b5165e571..a1bcc8d4b 100644 --- a/src/sgw/Makefile.am +++ b/src/sgw/Makefile.am @@ -2,6 +2,8 @@ noinst_LTLIBRARIES = libsgw.la +SUBDIR = gtp + libsgw_la_SOURCES = \ sgw_event.h sgw_context.h \ sgw_gtp_path.h sgw_sm.h sgw_s11_handler.h sgw_s5c_handler.h \ @@ -11,16 +13,16 @@ libsgw_la_SOURCES = \ libsgw_la_DEPENDENCIES = \ $(top_srcdir)/lib/gtp/libgtp.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) libsgw_la_LIBADD = \ $(top_srcdir)/lib/gtp/libgtp.la \ - $(top_srcdir)/src/common/libcommon.la \ + $(top_srcdir)/src/app/libapp.la \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ @MONGOC_CFLAGS@ \ @@ -28,6 +30,3 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ -Wall -Werror - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = core *.stackdump diff --git a/src/sgw/sgw_context.c b/src/sgw/sgw_context.c index 9e8d51f19..6dd326f66 100644 --- a/src/sgw/sgw_context.c +++ b/src/sgw/sgw_context.c @@ -1,13 +1,5 @@ -#define TRACE_MODULE _sgw_context - -#include "core_debug.h" -#include "core_pool.h" -#include "core_index.h" -#include "core_lib.h" - #include #include -#include "common/yaml_helper.h" #include "gtp/gtp_types.h" #include "gtp/gtp_conv.h" @@ -15,62 +7,64 @@ #include "gtp/gtp_path.h" #include "gtp/gtp_xact.h" -#include "common/context.h" +#include "app/context.h" #include "sgw_context.h" static sgw_context_t self; -index_declare(sgw_ue_pool, sgw_ue_t, MAX_POOL_OF_UE); -index_declare(sgw_sess_pool, sgw_sess_t, MAX_POOL_OF_SESS); -index_declare(sgw_bearer_pool, sgw_bearer_t, MAX_POOL_OF_BEARER); -index_declare(sgw_tunnel_pool, sgw_tunnel_t, MAX_POOL_OF_TUNNEL); +int __sgw_log_domain; + +static OGS_POOL(sgw_ue_pool, sgw_ue_t); +static OGS_POOL(sgw_sess_pool, sgw_sess_t); +static OGS_POOL(sgw_bearer_pool, sgw_bearer_t); +static OGS_POOL(sgw_tunnel_pool, sgw_tunnel_t); static int context_initialized = 0; -status_t sgw_context_init() +int sgw_context_init() { - d_assert(context_initialized == 0, return CORE_ERROR, - "SGW context already has been initialized"); + ogs_assert(context_initialized == 0); memset(&self, 0, sizeof(sgw_context_t)); - list_init(&self.gtpc_list); - list_init(&self.gtpc_list6); - list_init(&self.gtpu_list); - list_init(&self.gtpu_list6); + ogs_log_install_domain(&__sgw_log_domain, "sgw", ogs_core()->log.level); + + ogs_list_init(&self.gtpc_list); + ogs_list_init(&self.gtpc_list6); + ogs_list_init(&self.gtpu_list); + ogs_list_init(&self.gtpu_list6); gtp_node_init(); - list_init(&self.mme_s11_list); - list_init(&self.pgw_s5c_list); - list_init(&self.enb_s1u_list); - list_init(&self.pgw_s5u_list); + ogs_list_init(&self.mme_s11_list); + ogs_list_init(&self.pgw_s5c_list); + ogs_list_init(&self.enb_s1u_list); + ogs_list_init(&self.pgw_s5u_list); - index_init(&sgw_ue_pool, MAX_POOL_OF_UE); - index_init(&sgw_sess_pool, MAX_POOL_OF_SESS); - index_init(&sgw_bearer_pool, MAX_POOL_OF_BEARER); - index_init(&sgw_tunnel_pool, MAX_POOL_OF_TUNNEL); + ogs_pool_init(&sgw_ue_pool, MAX_POOL_OF_UE); + ogs_pool_init(&sgw_sess_pool, MAX_POOL_OF_SESS); + ogs_pool_init(&sgw_bearer_pool, MAX_POOL_OF_BEARER); + ogs_pool_init(&sgw_tunnel_pool, MAX_POOL_OF_TUNNEL); - self.imsi_ue_hash = hash_make(); + self.imsi_ue_hash = ogs_hash_make(); context_initialized = 1; - return CORE_OK; + return OGS_OK; } -status_t sgw_context_final() +int sgw_context_final() { - d_assert(context_initialized == 1, return CORE_ERROR, - "SGW context already has been finalized"); + ogs_assert(context_initialized == 1); sgw_ue_remove_all(); - d_assert(self.imsi_ue_hash, , "Null param"); - hash_destroy(self.imsi_ue_hash); + ogs_assert(self.imsi_ue_hash); + ogs_hash_destroy(self.imsi_ue_hash); - index_final(&sgw_tunnel_pool); - index_final(&sgw_bearer_pool); - index_final(&sgw_sess_pool); - index_final(&sgw_ue_pool); + ogs_pool_final(&sgw_tunnel_pool); + ogs_pool_final(&sgw_bearer_pool); + ogs_pool_final(&sgw_sess_pool); + ogs_pool_final(&sgw_ue_pool); gtp_remove_all_nodes(&self.mme_s11_list); gtp_remove_all_nodes(&self.pgw_s5c_list); @@ -78,14 +72,14 @@ status_t sgw_context_final() gtp_remove_all_nodes(&self.pgw_s5u_list); gtp_node_final(); - sock_remove_all_nodes(&self.gtpc_list); - sock_remove_all_nodes(&self.gtpc_list6); - sock_remove_all_nodes(&self.gtpu_list); - sock_remove_all_nodes(&self.gtpu_list6); + ogs_sock_remove_all_nodes(&self.gtpc_list); + ogs_sock_remove_all_nodes(&self.gtpc_list6); + ogs_sock_remove_all_nodes(&self.gtpu_list); + ogs_sock_remove_all_nodes(&self.gtpu_list6); context_initialized = 0; - return CORE_OK; + return OGS_OK; } sgw_context_t* sgw_self() @@ -93,108 +87,107 @@ sgw_context_t* sgw_self() return &self; } -static status_t sgw_context_prepare() +static int sgw_context_prepare() { self.gtpc_port = GTPV2_C_UDP_PORT; self.gtpu_port = GTPV1_U_UDP_PORT; - return CORE_OK; + return OGS_OK; } -static status_t sgw_context_validation() +static int sgw_context_validation() { - if (list_first(&self.gtpc_list) == NULL && - list_first(&self.gtpc_list6) == NULL) + if (ogs_list_empty(&self.gtpc_list) && + ogs_list_empty(&self.gtpc_list6)) { - d_error("No sgw.gtpc in '%s'", + ogs_error("No sgw.gtpc in '%s'", context_self()->config.path); - return CORE_ERROR; + return OGS_ERROR; } - if (list_first(&self.gtpu_list) == NULL && - list_first(&self.gtpu_list6) == NULL) + if (ogs_list_empty(&self.gtpu_list) && + ogs_list_empty(&self.gtpu_list6)) { - d_error("No sgw.gtpu in '%s'", + ogs_error("No sgw.gtpu in '%s'", context_self()->config.path); - return CORE_EAGAIN; + return OGS_RETRY; } - return CORE_OK; + return OGS_OK; } -status_t sgw_context_parse_config() +int sgw_context_parse_config() { - status_t rv; + int rv; config_t *config = &context_self()->config; yaml_document_t *document = NULL; - yaml_iter_t root_iter; + ogs_yaml_iter_t root_iter; - d_assert(config, return CORE_ERROR,); + ogs_assert(config); document = config->document; - d_assert(document, return CORE_ERROR,); + ogs_assert(document); rv = sgw_context_prepare(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - yaml_iter_init(&root_iter, document); - while(yaml_iter_next(&root_iter)) + ogs_yaml_iter_init(&root_iter, document); + while(ogs_yaml_iter_next(&root_iter)) { - const char *root_key = yaml_iter_key(&root_iter); - d_assert(root_key, return CORE_ERROR,); + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); if (!strcmp(root_key, "sgw")) { - yaml_iter_t sgw_iter; - yaml_iter_recurse(&root_iter, &sgw_iter); - while(yaml_iter_next(&sgw_iter)) + ogs_yaml_iter_t sgw_iter; + ogs_yaml_iter_recurse(&root_iter, &sgw_iter); + while(ogs_yaml_iter_next(&sgw_iter)) { - const char *sgw_key = yaml_iter_key(&sgw_iter); - d_assert(sgw_key, return CORE_ERROR,); + const char *sgw_key = ogs_yaml_iter_key(&sgw_iter); + ogs_assert(sgw_key); if (!strcmp(sgw_key, "gtpc")) { - yaml_iter_t gtpc_array, gtpc_iter; - yaml_iter_recurse(&sgw_iter, >pc_array); + ogs_yaml_iter_t gtpc_array, gtpc_iter; + ogs_yaml_iter_recurse(&sgw_iter, >pc_array); do { int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.gtpc_port; + uint16_t port = self.gtpc_port; const char *dev = NULL; - c_sockaddr_t *list = NULL; - sock_node_t *node = NULL; + ogs_sockaddr_t *list = NULL; + ogs_socknode_t *node = NULL; - if (yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(>pc_array) == YAML_MAPPING_NODE) { memcpy(>pc_iter, >pc_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(>pc_array)) + if (!ogs_yaml_iter_next(>pc_array)) break; - yaml_iter_recurse(>pc_array, >pc_iter); + ogs_yaml_iter_recurse(>pc_array, >pc_iter); } - else if (yaml_iter_type(>pc_array) == + else if (ogs_yaml_iter_type(>pc_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(>pc_iter)) + while(ogs_yaml_iter_next(>pc_iter)) { const char *gtpc_key = - yaml_iter_key(>pc_iter); - d_assert(gtpc_key, - return CORE_ERROR,); + ogs_yaml_iter_key(>pc_iter); + ogs_assert(gtpc_key); if (!strcmp(gtpc_key, "family")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -203,31 +196,30 @@ status_t sgw_context_parse_config() else if (!strcmp(gtpc_key, "addr") || !strcmp(gtpc_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(>pc_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(>pc_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gtpc_key, "port")) { - const char *v = yaml_iter_value(>pc_iter); + const char *v = ogs_yaml_iter_value(>pc_iter); if (v) { port = atoi(v); @@ -236,112 +228,111 @@ status_t sgw_context_parse_config() } else if (!strcmp(gtpc_key, "dev")) { - dev = yaml_iter_value(>pc_iter); + dev = ogs_yaml_iter_value(>pc_iter); } else - d_warn("unknown key `%s`", gtpc_key); + ogs_warn("unknown key `%s`", gtpc_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (list) { - if (context_self()->parameter.no_ipv4 == 0) + if (context_self()->config.parameter.no_ipv4 == 0) { - rv = sock_add_node(&self.gtpc_list, + rv = ogs_sock_add_node(&self.gtpc_list, &node, list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - if (context_self()->parameter.no_ipv6 == 0) + if (context_self()->config.parameter.no_ipv6 == 0) { - rv = sock_add_node(&self.gtpc_list6, + rv = ogs_sock_add_node(&self.gtpc_list6, &node, list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); } if (dev) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpc_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpc_list6, dev, self.gtpc_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - } while(yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pc_array) == YAML_SEQUENCE_NODE); - if (list_first(&self.gtpc_list) == NULL && - list_first(&self.gtpc_list6) == NULL) + if (ogs_list_empty(&self.gtpc_list) && + ogs_list_empty(&self.gtpc_list6)) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpc_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpc_list6, NULL, self.gtpc_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } } else if (!strcmp(sgw_key, "gtpu")) { - yaml_iter_t gtpu_array, gtpu_iter; - yaml_iter_recurse(&sgw_iter, >pu_array); + ogs_yaml_iter_t gtpu_array, gtpu_iter; + ogs_yaml_iter_recurse(&sgw_iter, >pu_array); do { int family = AF_UNSPEC; int i, num = 0; const char *hostname[MAX_NUM_OF_HOSTNAME]; - c_uint16_t port = self.gtpu_port; + uint16_t port = self.gtpu_port; const char *dev = NULL; - c_sockaddr_t *list = NULL; - sock_node_t *node = NULL; + ogs_sockaddr_t *list = NULL; + ogs_socknode_t *node = NULL; - if (yaml_iter_type(>pu_array) == YAML_MAPPING_NODE) + if (ogs_yaml_iter_type(>pu_array) == YAML_MAPPING_NODE) { memcpy(>pu_iter, >pu_array, - sizeof(yaml_iter_t)); + sizeof(ogs_yaml_iter_t)); } - else if (yaml_iter_type(>pu_array) == + else if (ogs_yaml_iter_type(>pu_array) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(>pu_array)) + if (!ogs_yaml_iter_next(>pu_array)) break; - yaml_iter_recurse(>pu_array, >pu_iter); + ogs_yaml_iter_recurse(>pu_array, >pu_iter); } - else if (yaml_iter_type(>pu_array) == + else if (ogs_yaml_iter_type(>pu_array) == YAML_SCALAR_NODE) { break; } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); - while(yaml_iter_next(>pu_iter)) + while(ogs_yaml_iter_next(>pu_iter)) { const char *gtpu_key = - yaml_iter_key(>pu_iter); - d_assert(gtpu_key, - return CORE_ERROR,); + ogs_yaml_iter_key(>pu_iter); + ogs_assert(gtpu_key); if (!strcmp(gtpu_key, "family")) { - const char *v = yaml_iter_value(>pu_iter); + const char *v = ogs_yaml_iter_value(>pu_iter); if (v) family = atoi(v); if (family != AF_UNSPEC && family != AF_INET && family != AF_INET6) { - d_warn("Ignore family(%d) : AF_UNSPEC(%d), " + ogs_warn("Ignore family(%d) : AF_UNSPEC(%d), " "AF_INET(%d), AF_INET6(%d) ", family, AF_UNSPEC, AF_INET, AF_INET6); family = AF_UNSPEC; @@ -350,31 +341,30 @@ status_t sgw_context_parse_config() else if (!strcmp(gtpu_key, "addr") || !strcmp(gtpu_key, "name")) { - yaml_iter_t hostname_iter; - yaml_iter_recurse(>pu_iter, &hostname_iter); - d_assert(yaml_iter_type(&hostname_iter) != - YAML_MAPPING_NODE, return CORE_ERROR,); + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(>pu_iter, &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); do { - if (yaml_iter_type(&hostname_iter) == + if (ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE) { - if (!yaml_iter_next(&hostname_iter)) + if (!ogs_yaml_iter_next(&hostname_iter)) break; } - d_assert(num <= MAX_NUM_OF_HOSTNAME, - return CORE_ERROR,); + ogs_assert(num <= MAX_NUM_OF_HOSTNAME); hostname[num++] = - yaml_iter_value(&hostname_iter); + ogs_yaml_iter_value(&hostname_iter); } while( - yaml_iter_type(&hostname_iter) == + ogs_yaml_iter_type(&hostname_iter) == YAML_SEQUENCE_NODE); } else if (!strcmp(gtpu_key, "port")) { - const char *v = yaml_iter_value(>pu_iter); + const char *v = ogs_yaml_iter_value(>pu_iter); if (v) { port = atoi(v); @@ -383,146 +373,104 @@ status_t sgw_context_parse_config() } else if (!strcmp(gtpu_key, "dev")) { - dev = yaml_iter_value(>pu_iter); + dev = ogs_yaml_iter_value(>pu_iter); } else - d_warn("unknown key `%s`", gtpu_key); + ogs_warn("unknown key `%s`", gtpu_key); } list = NULL; for (i = 0; i < num; i++) { - rv = core_addaddrinfo(&list, + rv = ogs_addaddrinfo(&list, family, hostname[i], port, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } if (list) { - if (context_self()->parameter.no_ipv4 == 0) + if (context_self()->config.parameter.no_ipv4 == 0) { - rv = sock_add_node(&self.gtpu_list, - &node, list, AF_INET); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_sock_add_node(&self.gtpu_list, + &node, (ogs_sockaddr_t*)list, AF_INET); + ogs_assert(rv == OGS_OK); } - if (context_self()->parameter.no_ipv6 == 0) + if (context_self()->config.parameter.no_ipv6 == 0) { - rv = sock_add_node(&self.gtpu_list6, - &node, list, AF_INET6); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_sock_add_node(&self.gtpu_list6, + &node, (ogs_sockaddr_t*)list, AF_INET6); + ogs_assert(rv == OGS_OK); } - core_freeaddrinfo(list); + ogs_freeaddrinfo(list); } if (dev) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpu_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpu_list6, dev, self.gtpu_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } - } while(yaml_iter_type(>pu_array) == YAML_SEQUENCE_NODE); + } while(ogs_yaml_iter_type(>pu_array) == YAML_SEQUENCE_NODE); - if (list_first(&self.gtpu_list) == NULL && - list_first(&self.gtpu_list6) == NULL) + if (ogs_list_empty(&self.gtpu_list) && + ogs_list_empty(&self.gtpu_list6)) { - rv = sock_probe_node( - context_self()->parameter.no_ipv4 ? + rv = ogs_sock_probe_node( + context_self()->config.parameter.no_ipv4 ? NULL : &self.gtpu_list, - context_self()->parameter.no_ipv6 ? + context_self()->config.parameter.no_ipv6 ? NULL : &self.gtpu_list6, NULL, self.gtpu_port); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); } } else - d_warn("unknown key `%s`", sgw_key); + ogs_warn("unknown key `%s`", sgw_key); } } } rv = sgw_context_validation(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK; -} - -status_t sgw_context_setup_trace_module() -{ - int app = context_self()->logger.trace.app; - int gtpv2 = context_self()->logger.trace.gtpv2; - int gtp = context_self()->logger.trace.gtp; - - if (app) - { - extern int _sgw_context; - d_trace_level(&_sgw_context, app); - } - - if (gtpv2) - { - extern int _sgw_sm; - d_trace_level(&_sgw_sm, gtpv2); - extern int _sgw_s11_handler; - d_trace_level(&_sgw_s11_handler, gtpv2); - extern int _sgw_s5c_handler; - d_trace_level(&_sgw_s5c_handler, gtpv2); - - extern int _gtp_node; - d_trace_level(&_gtp_node, gtpv2); - extern int _gtp_message; - d_trace_level(&_gtp_message, gtpv2); - extern int _gtp_path; - d_trace_level(&_gtp_path, gtpv2); - extern int _gtp_xact; - d_trace_level(&_gtp_xact, gtpv2); - - extern int _tlv_msg; - d_trace_level(&_tlv_msg, gtpv2); - } - - if (gtp) - { - extern int _sgw_gtp_path; - d_trace_level(&_sgw_gtp_path, gtp); - } - - return CORE_OK; + return OGS_OK; } gtp_node_t *sgw_mme_add_by_message(gtp_message_t *message) { - status_t rv; + int rv; gtp_node_t *mme = NULL; gtp_f_teid_t *mme_s11_teid = NULL; gtp_create_session_request_t *req = &message->create_session_request; if (req->sender_f_teid_for_control_plane.presence == 0) { - d_error("No Sender F-TEID"); + ogs_error("No Sender F-TEID"); return NULL; } mme_s11_teid = req->sender_f_teid_for_control_plane.data; - d_assert(mme_s11_teid, return NULL,); + ogs_assert(mme_s11_teid); mme = gtp_find_node(&sgw_self()->mme_s11_list, mme_s11_teid); if (!mme) { mme = gtp_add_node(&sgw_self()->mme_s11_list, mme_s11_teid, sgw_self()->gtpc_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(mme, return NULL,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(mme); - rv = gtp_client(mme); - d_assert(rv == CORE_OK, return NULL,); + rv = gtp_connect( + sgw_self()->gtpc_sock, sgw_self()->gtpc_sock6, mme); + ogs_assert(rv == OGS_OK); } return mme; @@ -535,65 +483,67 @@ sgw_ue_t *sgw_ue_add_by_message(gtp_message_t *message) if (req->imsi.presence == 0) { - d_error("No IMSI"); + ogs_error("No IMSI"); return NULL; } - d_trace(9, "sgw_ue_add_by_message() - IMSI "); - d_trace_hex(9, req->imsi.data, req->imsi.len); + ogs_trace("sgw_ue_add_by_message() - IMSI "); + ogs_log_hexdump(OGS_LOG_TRACE, req->imsi.data, req->imsi.len); sgw_ue = sgw_ue_find_by_imsi(req->imsi.data, req->imsi.len); if (!sgw_ue) { sgw_ue = sgw_ue_add(req->imsi.data, req->imsi.len); - d_assert(sgw_ue, return NULL,); + ogs_assert(sgw_ue); } return sgw_ue; } -sgw_ue_t *sgw_ue_add(c_uint8_t *imsi, int imsi_len) +sgw_ue_t *sgw_ue_add(uint8_t *imsi, int imsi_len) { sgw_ue_t *sgw_ue = NULL; - d_assert(imsi, return NULL, "Null param"); - d_assert(imsi_len, return NULL, "Null param"); + ogs_assert(imsi); + ogs_assert(imsi_len); - index_alloc(&sgw_ue_pool, &sgw_ue); - d_assert(sgw_ue, return NULL, "Null param"); + ogs_pool_alloc(&sgw_ue_pool, &sgw_ue); + ogs_assert(sgw_ue); - sgw_ue->sgw_s11_teid = sgw_ue->index; + sgw_ue->sgw_s11_teid = ogs_pool_index(&sgw_ue_pool, sgw_ue); + ogs_assert(sgw_ue->sgw_s11_teid > 0 && + sgw_ue->sgw_s11_teid <= MAX_POOL_OF_UE); /* Set IMSI */ sgw_ue->imsi_len = imsi_len; memcpy(sgw_ue->imsi, imsi, sgw_ue->imsi_len); - core_buffer_to_bcd(sgw_ue->imsi, sgw_ue->imsi_len, sgw_ue->imsi_bcd); + ogs_buffer_to_bcd(sgw_ue->imsi, sgw_ue->imsi_len, sgw_ue->imsi_bcd); - list_init(&sgw_ue->sess_list); + ogs_list_init(&sgw_ue->sess_list); - hash_set(self.imsi_ue_hash, sgw_ue->imsi, sgw_ue->imsi_len, sgw_ue); + ogs_hash_set(self.imsi_ue_hash, sgw_ue->imsi, sgw_ue->imsi_len, sgw_ue); return sgw_ue; } -status_t sgw_ue_remove(sgw_ue_t *sgw_ue) +int sgw_ue_remove(sgw_ue_t *sgw_ue) { - d_assert(sgw_ue, return CORE_ERROR, "Null param"); + ogs_assert(sgw_ue); /* Clear hash table */ if (sgw_ue->imsi_len != 0) - hash_set(self.imsi_ue_hash, sgw_ue->imsi, sgw_ue->imsi_len, NULL); + ogs_hash_set(self.imsi_ue_hash, sgw_ue->imsi, sgw_ue->imsi_len, NULL); sgw_sess_remove_all(sgw_ue); - index_free(&sgw_ue_pool, sgw_ue); + ogs_pool_free(&sgw_ue_pool, sgw_ue); - return CORE_OK; + return OGS_OK; } -status_t sgw_ue_remove_all() +void sgw_ue_remove_all() { - hash_index_t *hi = NULL; + ogs_hash_index_t *hi = NULL; sgw_ue_t *sgw_ue = NULL; for (hi = sgw_ue_first(); hi; hi = sgw_ue_next(hi)) @@ -601,132 +551,108 @@ status_t sgw_ue_remove_all() sgw_ue = sgw_ue_this(hi); sgw_ue_remove(sgw_ue); } - - return CORE_OK; } -static sgw_ue_t* sgw_ue_find(index_t index) +sgw_ue_t* sgw_ue_find_by_imsi_bcd(char *imsi_bcd) { - d_assert(index, return NULL, "Invalid index = 0x%x", index); - return index_find(&sgw_ue_pool, index); -} - -sgw_ue_t* sgw_ue_find_by_imsi_bcd(c_int8_t *imsi_bcd) -{ - c_uint8_t imsi[MAX_IMSI_LEN]; + uint8_t imsi[MAX_IMSI_LEN]; int imsi_len = 0; - d_assert(imsi_bcd, return NULL,"Invalid param"); + ogs_assert(imsi_bcd); - core_bcd_to_buffer(imsi_bcd, imsi, &imsi_len); + ogs_bcd_to_buffer(imsi_bcd, imsi, &imsi_len); return sgw_ue_find_by_imsi(imsi, imsi_len); } -sgw_ue_t* sgw_ue_find_by_imsi(c_uint8_t *imsi, int imsi_len) +sgw_ue_t* sgw_ue_find_by_imsi(uint8_t *imsi, int imsi_len) { - d_assert(imsi && imsi_len, return NULL,"Invalid param"); + ogs_assert(imsi && imsi_len); - return (sgw_ue_t *)hash_get(self.imsi_ue_hash, imsi, imsi_len); + return (sgw_ue_t *)ogs_hash_get(self.imsi_ue_hash, imsi, imsi_len); } -sgw_ue_t* sgw_ue_find_by_teid(c_uint32_t teid) +sgw_ue_t* sgw_ue_find_by_teid(uint32_t teid) { - return sgw_ue_find(teid); + return ogs_pool_find(&sgw_ue_pool, teid); } -hash_index_t *sgw_ue_first() +ogs_hash_index_t *sgw_ue_first() { - d_assert(self.imsi_ue_hash, return NULL, "Null param"); - return hash_first(self.imsi_ue_hash); + ogs_assert(self.imsi_ue_hash); + return ogs_hash_first(self.imsi_ue_hash); } -hash_index_t *sgw_ue_next(hash_index_t *hi) +ogs_hash_index_t *sgw_ue_next(ogs_hash_index_t *hi) { - return hash_next(hi); + return ogs_hash_next(hi); } -sgw_ue_t *sgw_ue_this(hash_index_t *hi) +sgw_ue_t *sgw_ue_this(ogs_hash_index_t *hi) { - d_assert(hi, return NULL, "Null param"); - return hash_this_val(hi); + ogs_assert(hi); + return ogs_hash_this_val(hi); } -sgw_sess_t *sgw_sess_add( - sgw_ue_t *sgw_ue, c_int8_t *apn, c_uint8_t ebi) +sgw_sess_t *sgw_sess_add(sgw_ue_t *sgw_ue, char *apn, uint8_t ebi) { sgw_sess_t *sess = NULL; sgw_bearer_t *bearer = NULL; - d_assert(sgw_ue, return NULL, "Null param"); - d_assert(ebi, return NULL, "Invalid EBI(%d)", ebi); + ogs_assert(sgw_ue); + ogs_assert(ebi); - index_alloc(&sgw_sess_pool, &sess); - d_assert(sess, return NULL, "Null param"); + ogs_pool_alloc(&sgw_sess_pool, &sess); + ogs_assert(sess); - sess->sgw_s5c_teid = SGW_S5C_INDEX_TO_TEID(sess->index); + sess->sgw_s5c_teid = + SGW_S5C_INDEX_TO_TEID(ogs_pool_index(&sgw_sess_pool, sess)); /* Set APN */ - core_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1); + ogs_cpystrn(sess->pdn.apn, apn, MAX_APN_LEN+1); sess->sgw_ue = sgw_ue; sess->gnode = NULL; - list_init(&sess->bearer_list); + ogs_list_init(&sess->bearer_list); bearer = sgw_bearer_add(sess); - d_assert(bearer, sgw_sess_remove(sess); return NULL, - "Can't add default bearer context"); + ogs_assert(bearer); bearer->ebi = ebi; - list_append(&sgw_ue->sess_list, sess); + ogs_list_add(&sgw_ue->sess_list, sess); return sess; } -status_t sgw_sess_remove(sgw_sess_t *sess) +int sgw_sess_remove(sgw_sess_t *sess) { - d_assert(sess, return CORE_ERROR, "Null param"); - d_assert(sess->sgw_ue, return CORE_ERROR, "Null param"); + ogs_assert(sess); + ogs_assert(sess->sgw_ue); - list_remove(&sess->sgw_ue->sess_list, sess); + ogs_list_remove(&sess->sgw_ue->sess_list, sess); sgw_bearer_remove_all(sess); - index_free(&sgw_sess_pool, sess); + ogs_pool_free(&sgw_sess_pool, sess); - return CORE_OK; + return OGS_OK; } -status_t sgw_sess_remove_all(sgw_ue_t *sgw_ue) +void sgw_sess_remove_all(sgw_ue_t *sgw_ue) { sgw_sess_t *sess = NULL, *next_sess = NULL; - sess = sgw_sess_first(sgw_ue); - while (sess) - { - next_sess = sgw_sess_next(sess); - + ogs_list_for_each_safe(&sgw_ue->sess_list, next_sess, sess) sgw_sess_remove(sess); - - sess = next_sess; - } - - return CORE_OK; } -static sgw_sess_t* sgw_sess_find(index_t index) +sgw_sess_t* sgw_sess_find_by_teid(uint32_t teid) { - d_assert(index, return NULL, "Invalid Index"); - return index_find(&sgw_sess_pool, index); + return ogs_pool_find(&sgw_sess_pool, SGW_S5C_TEID_TO_INDEX(teid)); } -sgw_sess_t* sgw_sess_find_by_teid(c_uint32_t teid) -{ - return sgw_sess_find(SGW_S5C_TEID_TO_INDEX(teid)); -} - -sgw_sess_t* sgw_sess_find_by_apn(sgw_ue_t *sgw_ue, c_int8_t *apn) +sgw_sess_t* sgw_sess_find_by_apn(sgw_ue_t *sgw_ue, char *apn) { sgw_sess_t *sess = NULL; @@ -742,7 +668,7 @@ sgw_sess_t* sgw_sess_find_by_apn(sgw_ue_t *sgw_ue, c_int8_t *apn) return NULL; } -sgw_sess_t* sgw_sess_find_by_ebi(sgw_ue_t *sgw_ue, c_uint8_t ebi) +sgw_sess_t* sgw_sess_find_by_ebi(sgw_ue_t *sgw_ue, uint8_t ebi) { sgw_bearer_t *bearer = NULL; @@ -755,12 +681,12 @@ sgw_sess_t* sgw_sess_find_by_ebi(sgw_ue_t *sgw_ue, c_uint8_t ebi) sgw_sess_t* sgw_sess_first(sgw_ue_t *sgw_ue) { - return list_first(&sgw_ue->sess_list); + return ogs_list_first(&sgw_ue->sess_list); } sgw_sess_t* sgw_sess_next(sgw_sess_t *sess) { - return list_next(sess); + return ogs_list_next(sess); } sgw_bearer_t* sgw_bearer_add(sgw_sess_t *sess) @@ -769,82 +695,64 @@ sgw_bearer_t* sgw_bearer_add(sgw_sess_t *sess) sgw_tunnel_t *tunnel = NULL; sgw_ue_t *sgw_ue = NULL; - d_assert(sess, return NULL, "Null param"); + ogs_assert(sess); sgw_ue = sess->sgw_ue; - d_assert(sgw_ue, return NULL, "Null param"); + ogs_assert(sgw_ue); - index_alloc(&sgw_bearer_pool, &bearer); - d_assert(bearer, return NULL, "Bearer context allocation failed"); + ogs_pool_alloc(&sgw_bearer_pool, &bearer); + ogs_assert(bearer); bearer->sgw_ue = sgw_ue; bearer->sess = sess; - list_init(&bearer->tunnel_list); + ogs_list_init(&bearer->tunnel_list); tunnel = sgw_tunnel_add(bearer, GTP_F_TEID_S1_U_SGW_GTP_U); - d_assert(tunnel, return NULL, "Tunnel context allocation failed"); + ogs_assert(tunnel); tunnel = sgw_tunnel_add(bearer, GTP_F_TEID_S5_S8_SGW_GTP_U); - d_assert(tunnel, return NULL, "Tunnel context allocation failed"); + ogs_assert(tunnel); - list_append(&sess->bearer_list, bearer); + ogs_list_add(&sess->bearer_list, bearer); return bearer; } -status_t sgw_bearer_remove(sgw_bearer_t *bearer) +int sgw_bearer_remove(sgw_bearer_t *bearer) { int i; - d_assert(bearer, return CORE_ERROR, "Null param"); - d_assert(bearer->sess, return CORE_ERROR, "Null param"); + ogs_assert(bearer); + ogs_assert(bearer->sess); - list_remove(&bearer->sess->bearer_list, bearer); + ogs_list_remove(&bearer->sess->bearer_list, bearer); sgw_tunnel_remove_all(bearer); /* Free the buffered packets */ for (i = 0; i < bearer->num_buffered_pkt; i++) - pkbuf_free(bearer->buffered_pkts[i]); + ogs_pkbuf_free(bearer->buffered_pkts[i]); - index_free(&sgw_bearer_pool, bearer); + ogs_pool_free(&sgw_bearer_pool, bearer); - return CORE_OK; + return OGS_OK; } -status_t sgw_bearer_remove_all(sgw_sess_t *sess) +void sgw_bearer_remove_all(sgw_sess_t *sess) { sgw_bearer_t *bearer = NULL, *next_bearer = NULL; - d_assert(sess, return CORE_ERROR, "Null param"); - - bearer = list_first(&sess->bearer_list); - while (bearer) - { - next_bearer = list_next(bearer); - + ogs_assert(sess); + ogs_list_for_each_safe(&sess->bearer_list, next_bearer, bearer) sgw_bearer_remove(bearer); - - bearer = next_bearer; - } - - return CORE_OK; } -sgw_bearer_t* sgw_bearer_find(index_t index) +sgw_bearer_t* sgw_bearer_find_by_sgw_s5u_teid(uint32_t sgw_s5u_teid) { - d_assert(index && index < MAX_POOL_OF_BEARER, return NULL, - "Invalid Index(%d)",index); - - return index_find(&sgw_bearer_pool, index); + return ogs_pool_find(&sgw_bearer_pool, sgw_s5u_teid); } -sgw_bearer_t* sgw_bearer_find_by_sgw_s5u_teid(c_uint32_t sgw_s5u_teid) -{ - return sgw_bearer_find(sgw_s5u_teid); -} - -sgw_bearer_t* sgw_bearer_find_by_sess_ebi(sgw_sess_t *sess, c_uint8_t ebi) +sgw_bearer_t* sgw_bearer_find_by_sess_ebi(sgw_sess_t *sess, uint8_t ebi) { sgw_bearer_t *bearer = NULL; @@ -860,7 +768,7 @@ sgw_bearer_t* sgw_bearer_find_by_sess_ebi(sgw_sess_t *sess, c_uint8_t ebi) return NULL; } -sgw_bearer_t* sgw_bearer_find_by_ue_ebi(sgw_ue_t *sgw_ue, c_uint8_t ebi) +sgw_bearer_t* sgw_bearer_find_by_ue_ebi(sgw_ue_t *sgw_ue, uint8_t ebi) { sgw_sess_t *sess = NULL; sgw_bearer_t *bearer = NULL; @@ -887,84 +795,68 @@ sgw_bearer_t* sgw_default_bearer_in_sess(sgw_sess_t *sess) sgw_bearer_t* sgw_bearer_first(sgw_sess_t *sess) { - d_assert(sess, return NULL, "Null param"); - return list_first(&sess->bearer_list); + ogs_assert(sess); + return ogs_list_first(&sess->bearer_list); } sgw_bearer_t* sgw_bearer_next(sgw_bearer_t *bearer) { - return list_next(bearer); + return ogs_list_next(bearer); } -sgw_tunnel_t* sgw_tunnel_add(sgw_bearer_t *bearer, c_uint8_t interface_type) +sgw_tunnel_t* sgw_tunnel_add(sgw_bearer_t *bearer, uint8_t interface_type) { sgw_tunnel_t *tunnel = NULL; - d_assert(bearer, return NULL, "Null param"); + ogs_assert(bearer); - index_alloc(&sgw_tunnel_pool, &tunnel); - d_assert(tunnel, return NULL, "Tunnel context allocation failed"); + ogs_pool_alloc(&sgw_tunnel_pool, &tunnel); + ogs_assert(tunnel); tunnel->interface_type = interface_type; - tunnel->local_teid = tunnel->index; + tunnel->local_teid = ogs_pool_index(&sgw_tunnel_pool, tunnel); + ogs_assert(tunnel->local_teid > 0 && + tunnel->local_teid <= MAX_POOL_OF_TUNNEL); tunnel->bearer = bearer; tunnel->gnode = NULL; - list_append(&bearer->tunnel_list, tunnel); + ogs_list_add(&bearer->tunnel_list, tunnel); return tunnel; } -status_t sgw_tunnel_remove(sgw_tunnel_t *tunnel) +int sgw_tunnel_remove(sgw_tunnel_t *tunnel) { - d_assert(tunnel, return CORE_ERROR, "Null param"); - d_assert(tunnel->bearer, return CORE_ERROR, "Null param"); + ogs_assert(tunnel); + ogs_assert(tunnel->bearer); - list_remove(&tunnel->bearer->tunnel_list, tunnel); - index_free(&sgw_tunnel_pool, tunnel); + ogs_list_remove(&tunnel->bearer->tunnel_list, tunnel); + ogs_pool_free(&sgw_tunnel_pool, tunnel); - return CORE_OK; + return OGS_OK; } -status_t sgw_tunnel_remove_all(sgw_bearer_t *bearer) +void sgw_tunnel_remove_all(sgw_bearer_t *bearer) { sgw_tunnel_t *tunnel = NULL, *next_tunnel = NULL; - d_assert(bearer, return CORE_ERROR, "Null param"); - - tunnel = sgw_tunnel_first(bearer); - while (tunnel) - { - next_tunnel = sgw_tunnel_next(tunnel); - + ogs_assert(bearer); + ogs_list_for_each_safe(&bearer->tunnel_list, next_tunnel, tunnel) sgw_tunnel_remove(tunnel); - - tunnel = next_tunnel; - } - - return CORE_OK; } -sgw_tunnel_t* sgw_tunnel_find(index_t index) +sgw_tunnel_t* sgw_tunnel_find_by_teid(uint32_t teid) { - d_assert(index && index < MAX_POOL_OF_TUNNEL, return NULL, - "Invalid Index(%d)",index); - - return index_find(&sgw_tunnel_pool, index); -} - -sgw_tunnel_t* sgw_tunnel_find_by_teid(c_uint32_t teid) -{ - return sgw_tunnel_find(teid); + return ogs_pool_find(&sgw_tunnel_pool, teid); } sgw_tunnel_t* sgw_tunnel_find_by_interface_type( - sgw_bearer_t *bearer, c_uint8_t interface_type) + sgw_bearer_t *bearer, uint8_t interface_type) { sgw_tunnel_t *tunnel = NULL; - d_assert(bearer, return NULL,); + ogs_assert(bearer); tunnel = sgw_tunnel_first(bearer); while(tunnel) @@ -993,11 +885,11 @@ sgw_tunnel_t* sgw_s5u_tunnel_in_bearer(sgw_bearer_t *bearer) sgw_tunnel_t* sgw_tunnel_first(sgw_bearer_t *bearer) { - d_assert(bearer, return NULL, "Null param"); - return list_first(&bearer->tunnel_list); + ogs_assert(bearer); + return ogs_list_first(&bearer->tunnel_list); } sgw_tunnel_t* sgw_tunnel_next(sgw_tunnel_t *tunnel) { - return list_next(tunnel); + return ogs_list_next(tunnel); } diff --git a/src/sgw/sgw_context.h b/src/sgw/sgw_context.h index fb78dd7e4..fbbb8dd99 100644 --- a/src/sgw/sgw_context.h +++ b/src/sgw/sgw_context.h @@ -1,14 +1,9 @@ #ifndef __SGW_CONTEXT_H__ #define __SGW_CONTEXT_H__ -#include "core_list.h" -#include "core_index.h" -#include "core_errno.h" -#include "core_event.h" -#include "core_hash.h" -#include "core_network.h" +#include "ogs-core.h" -#include "3gpp_types.h" +#include "base/types.h" #include "gtp/gtp_types.h" #include "gtp/gtp_message.h" @@ -16,48 +11,52 @@ extern "C" { #endif /* __cplusplus */ +extern int __sgw_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __sgw_log_domain + typedef struct _sgw_tunnel_t sgw_tunnel_t; typedef struct _gtp_node_t gtp_node_t; typedef struct _sgw_context_t { - c_uint32_t gtpc_port; /* Default GTPC port */ - c_uint32_t gtpu_port; /* Default GTPU port */ + uint32_t gtpc_port; /* Default GTPC port */ + uint32_t gtpu_port; /* Default GTPU port */ - list_t gtpc_list; /* SGW GTPC IPv4 Server List */ - list_t gtpc_list6; /* SGW GTPC IPv6 Server List */ - sock_id gtpc_sock; /* SGW GTPC IPv4 Socket */ - sock_id gtpc_sock6; /* SGW GTPC IPv6 Socket */ - c_sockaddr_t *gtpc_addr; /* SGW GTPC IPv4 Address */ - c_sockaddr_t *gtpc_addr6; /* SGW GTPC IPv6 Address */ + ogs_list_t gtpc_list; /* SGW GTPC IPv4 Server List */ + ogs_list_t gtpc_list6; /* SGW GTPC IPv6 Server List */ + ogs_sock_t *gtpc_sock; /* SGW GTPC IPv4 Socket */ + ogs_sock_t *gtpc_sock6; /* SGW GTPC IPv6 Socket */ + ogs_sockaddr_t *gtpc_addr; /* SGW GTPC IPv4 Address */ + ogs_sockaddr_t *gtpc_addr6; /* SGW GTPC IPv6 Address */ - list_t gtpu_list; /* SGW GTPU IPv4 Server List */ - list_t gtpu_list6; /* SGW GTPU IPv6 Server List */ - sock_id gtpu_sock; /* SGW GTPU IPv4 Socket */ - sock_id gtpu_sock6; /* SGW GTPU IPv6 Socket */ - c_sockaddr_t *gtpu_addr; /* SGW GTPU IPv4 Address */ - c_sockaddr_t *gtpu_addr6; /* SGW GTPU IPv6 Address */ + ogs_list_t gtpu_list; /* SGW GTPU IPv4 Server List */ + ogs_list_t gtpu_list6; /* SGW GTPU IPv6 Server List */ + ogs_sock_t *gtpu_sock; /* SGW GTPU IPv4 Socket */ + ogs_sock_t *gtpu_sock6; /* SGW GTPU IPv6 Socket */ + ogs_sockaddr_t *gtpu_addr; /* SGW GTPU IPv4 Address */ + ogs_sockaddr_t *gtpu_addr6; /* SGW GTPU IPv6 Address */ - msgq_id queue_id; /* Queue for processing SGW control plane */ - tm_service_t tm_service;/* Timer Service */ + ogs_queue_t *queue; /* Queue for processing SGW control */ + ogs_timer_mgr_t *timer_mgr; /* Timer Manager */ + ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */ - list_t mme_s11_list; /* MME GTPC Node List */ - list_t pgw_s5c_list; /* PGW GTPC Node List */ - list_t enb_s1u_list; /* eNB GTPU Node List */ - list_t pgw_s5u_list; /* PGW GTPU Node List */ + ogs_list_t mme_s11_list; /* MME GTPC Node List */ + ogs_list_t pgw_s5c_list; /* PGW GTPC Node List */ + ogs_list_t enb_s1u_list; /* eNB GTPU Node List */ + ogs_list_t pgw_s5u_list; /* PGW GTPU Node List */ - hash_t *imsi_ue_hash; /* hash table (IMSI : SGW_UE) */ + ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : SGW_UE) */ } sgw_context_t; typedef struct _sgw_ue_t { - index_t index; /* An index of this node */ - - c_uint32_t sgw_s11_teid; /* SGW-S11-TEID is derived from INDEX */ - c_uint32_t mme_s11_teid; /* MME-S11-TEID is received from MME */ + uint32_t sgw_s11_teid; /* SGW-S11-TEID is derived from INDEX */ + uint32_t mme_s11_teid; /* MME-S11-TEID is received from MME */ /* UE identity */ - c_uint8_t imsi[MAX_IMSI_LEN]; + uint8_t imsi[MAX_IMSI_LEN]; int imsi_len; - c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1]; + char imsi_bcd[MAX_IMSI_BCD_LEN+1]; #define SGW_S1U_INACTIVE 0x0001 #define SGW_DL_NOTI_SENT 0x0002 @@ -66,16 +65,15 @@ typedef struct _sgw_ue_t { #define SGW_SET_UE_STATE(__uE,__sTATE) ((__uE)->state |= (__sTATE)) #define SGW_RESET_UE_STATE(__uE, __sTATE) ((__uE)->state &= ~(__sTATE)) - c_uint32_t state; + uint32_t state; - list_t sess_list; + ogs_list_t sess_list; - gtp_node_t *gnode; + gtp_node_t *gnode; } sgw_ue_t; typedef struct _sgw_sess_t { - lnode_t node; /* A node of list_t */ - index_t index; /* An index of this node */ + ogs_lnode_t node; /* A node of list_t */ /* * SGW-S5C-TEID = INDEX | 0x80000000 @@ -84,13 +82,13 @@ typedef struct _sgw_sess_t { #define SGW_S5C_TEID(__tEID) (__tEID & 0x80000000) #define SGW_S5C_TEID_TO_INDEX(__iNDEX) (__iNDEX & ~0x80000000) #define SGW_S5C_INDEX_TO_TEID(__iNDEX) (__iNDEX | 0x80000000) - c_uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is derived from INDEX */ - c_uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is received from PGW */ + uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is derived from INDEX */ + uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is received from PGW */ /* APN Configuration */ pdn_t pdn; - list_t bearer_list; + ogs_list_t bearer_list; /* Related Context */ gtp_node_t *gnode; @@ -98,102 +96,95 @@ typedef struct _sgw_sess_t { } sgw_sess_t; typedef struct _sgw_bearer_t { - lnode_t node; /**< A node of list_t */ - index_t index; + ogs_lnode_t node; /**< A node of list_t */ - c_uint8_t ebi; + uint8_t ebi; /* User-Lication-Info */ tai_t tai; e_cgi_t e_cgi; /* Pkts which will be buffered in case of UE-IDLE */ - c_uint32_t num_buffered_pkt; + uint32_t num_buffered_pkt; /* FIXME: The value should be depdendant on the clbuf number. */ -#define MAX_NUM_BUFFER_PKT 10 - pkbuf_t* buffered_pkts[MAX_NUM_BUFFER_PKT]; +#define MAX_NUM_BUFFER_PKT 512 + ogs_pkbuf_t* buffered_pkts[MAX_NUM_BUFFER_PKT]; - list_t tunnel_list; + ogs_list_t tunnel_list; sgw_sess_t *sess; sgw_ue_t *sgw_ue; } sgw_bearer_t; typedef struct _sgw_tunnel_t { - lnode_t node; /**< A node of list_t */ - index_t index; + ogs_lnode_t node; /**< A node of list_t */ - c_uint8_t interface_type; + uint8_t interface_type; - c_uint32_t local_teid; - c_uint32_t remote_teid; + uint32_t local_teid; + uint32_t remote_teid; /* Related Context */ sgw_bearer_t *bearer; gtp_node_t *gnode; } sgw_tunnel_t; -CORE_DECLARE(status_t) sgw_context_init(void); -CORE_DECLARE(status_t) sgw_context_final(void); -CORE_DECLARE(sgw_context_t*) sgw_self(void); +int sgw_context_init(void); +int sgw_context_final(void); +sgw_context_t* sgw_self(void); -CORE_DECLARE(status_t) sgw_context_parse_config(void); -CORE_DECLARE(status_t) sgw_context_setup_trace_module(void); +int sgw_context_parse_config(void); -CORE_DECLARE(gtp_node_t *) sgw_mme_add_by_message(gtp_message_t *message); -CORE_DECLARE(sgw_ue_t *) sgw_ue_add_by_message(gtp_message_t *message); +gtp_node_t *sgw_mme_add_by_message(gtp_message_t *message); +sgw_ue_t *sgw_ue_add_by_message(gtp_message_t *message); -CORE_DECLARE(sgw_ue_t*) sgw_ue_add(c_uint8_t *imsi, int imsi_len); -CORE_DECLARE(status_t) sgw_ue_remove(sgw_ue_t *sgw_ue); -CORE_DECLARE(status_t) sgw_ue_remove_all(); +sgw_ue_t* sgw_ue_add(uint8_t *imsi, int imsi_len); +int sgw_ue_remove(sgw_ue_t *sgw_ue); +void sgw_ue_remove_all(); -CORE_DECLARE(sgw_ue_t*) sgw_ue_find_by_imsi(c_uint8_t *imsi, int imsi_len); -CORE_DECLARE(sgw_ue_t*) sgw_ue_find_by_imsi_bcd(c_int8_t *imsi_bcd); -CORE_DECLARE(sgw_ue_t*) sgw_ue_find_by_teid(c_uint32_t teid); +sgw_ue_t* sgw_ue_find_by_imsi(uint8_t *imsi, int imsi_len); +sgw_ue_t* sgw_ue_find_by_imsi_bcd(char *imsi_bcd); +sgw_ue_t* sgw_ue_find_by_teid(uint32_t teid); -CORE_DECLARE(hash_index_t *) sgw_ue_first(); -CORE_DECLARE(hash_index_t *) sgw_ue_next(hash_index_t *hi); -CORE_DECLARE(sgw_ue_t *) sgw_ue_this(hash_index_t *hi); +ogs_hash_index_t *sgw_ue_first(); +ogs_hash_index_t *sgw_ue_next(ogs_hash_index_t *hi); +sgw_ue_t *sgw_ue_this(ogs_hash_index_t *hi); -CORE_DECLARE(sgw_sess_t*) sgw_sess_add(sgw_ue_t *sgw_ue, - c_int8_t *apn, c_uint8_t ebi); -CORE_DECLARE(status_t ) sgw_sess_remove(sgw_sess_t *sess); -CORE_DECLARE(status_t ) sgw_sess_remove_all(sgw_ue_t *sgw_ue); -CORE_DECLARE(sgw_sess_t*) sgw_sess_find_by_apn( - sgw_ue_t *sgw_ue, c_int8_t *apn); -CORE_DECLARE(sgw_sess_t*) sgw_sess_find_by_ebi( - sgw_ue_t *sgw_ue, c_uint8_t ebi); -CORE_DECLARE(sgw_sess_t*) sgw_sess_find_by_teid(c_uint32_t teid); -CORE_DECLARE(sgw_sess_t*) sgw_sess_first(sgw_ue_t *sgw_ue); -CORE_DECLARE(sgw_sess_t*) sgw_sess_next(sgw_sess_t *sess); +sgw_sess_t *sgw_sess_add(sgw_ue_t *sgw_ue, char *apn, uint8_t ebi); +int sgw_sess_remove(sgw_sess_t *sess); +void sgw_sess_remove_all(sgw_ue_t *sgw_ue); +sgw_sess_t *sgw_sess_find_by_apn( + sgw_ue_t *sgw_ue, char *apn); +sgw_sess_t *sgw_sess_find_by_ebi( + sgw_ue_t *sgw_ue, uint8_t ebi); +sgw_sess_t *sgw_sess_find_by_teid(uint32_t teid); +sgw_sess_t *sgw_sess_first(sgw_ue_t *sgw_ue); +sgw_sess_t *sgw_sess_next(sgw_sess_t *sess); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_add(sgw_sess_t *sess); -CORE_DECLARE(status_t) sgw_bearer_remove(sgw_bearer_t *bearer); -CORE_DECLARE(status_t) sgw_bearer_remove_all(sgw_sess_t *sess); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find(index_t index); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find_by_sgw_s5u_teid( - c_uint32_t sgw_s5u_teid); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find_by_sess_ebi( - sgw_sess_t *sess, c_uint8_t ebi); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find_by_ue_ebi( - sgw_ue_t *sgw_ue, c_uint8_t ebi); -CORE_DECLARE(sgw_bearer_t*) sgw_default_bearer_in_sess(sgw_sess_t *sess); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_first(sgw_sess_t *sess); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_next(sgw_bearer_t *bearer); -CORE_DECLARE(sgw_bearer_t*) sgw_bearer_find(index_t index); +sgw_bearer_t *sgw_bearer_add(sgw_sess_t *sess); +int sgw_bearer_remove(sgw_bearer_t *bearer); +void sgw_bearer_remove_all(sgw_sess_t *sess); +sgw_bearer_t *sgw_bearer_find_by_sgw_s5u_teid( + uint32_t sgw_s5u_teid); +sgw_bearer_t *sgw_bearer_find_by_sess_ebi( + sgw_sess_t *sess, uint8_t ebi); +sgw_bearer_t *sgw_bearer_find_by_ue_ebi( + sgw_ue_t *sgw_ue, uint8_t ebi); +sgw_bearer_t *sgw_default_bearer_in_sess(sgw_sess_t *sess); +sgw_bearer_t *sgw_bearer_first(sgw_sess_t *sess); +sgw_bearer_t *sgw_bearer_next(sgw_bearer_t *bearer); -CORE_DECLARE(sgw_tunnel_t*) sgw_tunnel_add( - sgw_bearer_t *bearer, c_uint8_t interface_type); -CORE_DECLARE(status_t) sgw_tunnel_remove(sgw_tunnel_t *tunnel); -CORE_DECLARE(status_t) sgw_tunnel_remove_all(sgw_bearer_t *bearer); -CORE_DECLARE(sgw_tunnel_t*) sgw_tunnel_find(index_t index); -CORE_DECLARE(sgw_tunnel_t*) sgw_tunnel_find_by_teid(c_uint32_t teid); -CORE_DECLARE(sgw_tunnel_t*) sgw_tunnel_find_by_interface_type( - sgw_bearer_t *bearer, c_uint8_t interface_type); -CORE_DECLARE(sgw_tunnel_t*) sgw_s1u_tunnel_in_bearer(sgw_bearer_t *bearer); -CORE_DECLARE(sgw_tunnel_t*) sgw_s5u_tunnel_in_bearer(sgw_bearer_t *bearer); -CORE_DECLARE(sgw_tunnel_t*) sgw_tunnel_first(sgw_bearer_t *bearer); -CORE_DECLARE(sgw_tunnel_t*) sgw_tunnel_next(sgw_tunnel_t *tunnel); +sgw_tunnel_t *sgw_tunnel_add( + sgw_bearer_t *bearer, uint8_t interface_type); +int sgw_tunnel_remove(sgw_tunnel_t *tunnel); +void sgw_tunnel_remove_all(sgw_bearer_t *bearer); +sgw_tunnel_t *sgw_tunnel_find_by_teid(uint32_t teid); +sgw_tunnel_t *sgw_tunnel_find_by_interface_type( + sgw_bearer_t *bearer, uint8_t interface_type); +sgw_tunnel_t *sgw_s1u_tunnel_in_bearer(sgw_bearer_t *bearer); +sgw_tunnel_t *sgw_s5u_tunnel_in_bearer(sgw_bearer_t *bearer); +sgw_tunnel_t *sgw_tunnel_first(sgw_bearer_t *bearer); +sgw_tunnel_t *sgw_tunnel_next(sgw_tunnel_t *tunnel); #ifdef __cplusplus } diff --git a/src/sgw/sgw_event.c b/src/sgw/sgw_event.c index e441d93e8..85fef912f 100644 --- a/src/sgw/sgw_event.c +++ b/src/sgw/sgw_event.c @@ -1,33 +1,76 @@ -#define TRACE_MODULE _sgw_event - #include "sgw_event.h" #include "sgw_context.h" -char* sgw_event_get_name(event_t *e) +static OGS_POOL(pool, sgw_event_t); + +#define EVENT_POOL 32 /* FIXME : 32 */ +void sgw_event_init(void) +{ + ogs_pool_init(&pool, EVENT_POOL); + + sgw_self()->queue = ogs_queue_create(EVENT_POOL); + ogs_assert(sgw_self()->queue); + sgw_self()->timer_mgr = ogs_timer_mgr_create(); + ogs_assert(sgw_self()->timer_mgr); + sgw_self()->pollset = ogs_pollset_create(); + ogs_assert(sgw_self()->pollset); +} + +void sgw_event_term(void) +{ + ogs_queue_term(sgw_self()->queue); + ogs_pollset_notify(sgw_self()->pollset); +} + +void sgw_event_final(void) +{ + if (sgw_self()->pollset) + ogs_pollset_destroy(sgw_self()->pollset); + if (sgw_self()->timer_mgr) + ogs_timer_mgr_destroy(sgw_self()->timer_mgr); + if (sgw_self()->queue) + ogs_queue_destroy(sgw_self()->queue); + + ogs_pool_final(&pool); +} + +sgw_event_t *sgw_event_new(sgw_event_e id) +{ + sgw_event_t *e = NULL; + + ogs_pool_alloc(&pool, &e); + ogs_assert(e); + e->id = id; + + return e; +} + +void sgw_event_free(sgw_event_t *e) +{ + ogs_assert(e); + ogs_pool_free(&pool, e); +} + +const char *sgw_event_get_name(sgw_event_t *e) { if (e == NULL) - return FSM_NAME_INIT_SIG; + return OGS_FSM_NAME_INIT_SIG; - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: - return FSM_NAME_ENTRY_SIG; - case FSM_EXIT_SIG: - return FSM_NAME_EXIT_SIG; + case OGS_FSM_ENTRY_SIG: + return OGS_FSM_NAME_ENTRY_SIG; + case OGS_FSM_EXIT_SIG: + return OGS_FSM_NAME_EXIT_SIG; case SGW_EVT_S11_MESSAGE: return "SGW_EVT_S11_MESSAGE"; case SGW_EVT_S5C_MESSAGE: return "SGW_EVT_S5C_MESSAGE"; - case SGW_EVT_T3_RESPONSE: - return "SGW_EVT_T3_RESPONSE"; - case SGW_EVT_T3_HOLDING: - return "SGW_EVT_T3_HOLDING"; - default: break; } - return EVT_NAME_UNKNOWN; + return "UNKNOWN_EVENT"; } diff --git a/src/sgw/sgw_event.h b/src/sgw/sgw_event.h index 42a0fa7ca..8200801ff 100644 --- a/src/sgw/sgw_event.h +++ b/src/sgw/sgw_event.h @@ -1,31 +1,41 @@ #ifndef __SGW_EVENT_H__ #define __SGW_EVENT_H__ -#include "core_event.h" -#include "core_fsm.h" +#include "ogs-core.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef enum { - SGW_EVT_BASE = FSM_USER_SIG, + SGW_EVT_BASE = OGS_FSM_USER_SIG, SGW_EVT_S11_MESSAGE, SGW_EVT_S5C_MESSAGE, - SGW_EVT_T3_RESPONSE, - SGW_EVT_T3_HOLDING, - SGW_EVT_LO_DLDATA_NOTI, SGW_EVT_TOP, -} event_e; +} sgw_event_e; -#define sgw_event_send(__ptr_e) event_send(sgw_self()->queue_id, (__ptr_e)) +typedef struct sgw_event_s { + int id; + void *pkbuf; + void *bearer; +} sgw_event_t; -CORE_DECLARE(char*) sgw_event_get_name(event_t *e); +void sgw_event_init(void); +void sgw_event_term(void); +void sgw_event_final(void); + +sgw_event_t *sgw_event_new(sgw_event_e id); +void sgw_event_free(sgw_event_t *e); + +#define sgw_event_send(__ptr_e) \ + ogs_assert(ogs_queue_push(sgw_self()->queue, ((__ptr_e))) == OGS_OK) + +const char *sgw_event_get_name(sgw_event_t *e); #ifdef __cplusplus } diff --git a/src/sgw/sgw_gtp_path.c b/src/sgw/sgw_gtp_path.c index aad6a9890..1425d4a08 100644 --- a/src/sgw/sgw_gtp_path.c +++ b/src/sgw/sgw_gtp_path.c @@ -1,8 +1,3 @@ -#define TRACE_MODULE _sgw_gtp_path -#include "core_debug.h" -#include "core_pkbuf.h" - -#include "3gpp_types.h" #include "gtp/gtp_types.h" #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" @@ -11,100 +6,86 @@ #include "sgw_event.h" #include "sgw_gtp_path.h" -static int _gtpv2_c_recv_cb(sock_id sock, void *data) +static void _gtpv2_c_recv_cb(short when, ogs_socket_t fd, void *data) { - event_t e; - status_t rv; + sgw_event_t *e = NULL; + int rv; gtp_header_t *gtp_h = NULL; - c_uint32_t teid = 0; - pkbuf_t *pkbuf = NULL; + uint32_t teid = 0; + ogs_pkbuf_t *pkbuf = NULL; - d_assert(sock, return -1, "Null param"); + ogs_assert(fd != INVALID_SOCKET); - rv = gtp_recv(sock, &pkbuf); - if (rv != CORE_OK) + rv = gtp_recv(fd, &pkbuf); + if (rv != OGS_OK) { - if (errno == EAGAIN) - return 0; - - return -1; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, "gtp_recv() failed"); + return; } - gtp_h = (gtp_header_t *)pkbuf->payload; - d_assert(gtp_h, return -1, "Null param"); - d_assert(gtp_h->teid_presence, return -1,); + gtp_h = (gtp_header_t *)pkbuf->data; + ogs_assert(gtp_h); + ogs_assert(gtp_h->teid_presence); teid = ntohl(gtp_h->teid); if (SGW_S5C_TEID(teid)) { - event_set(&e, SGW_EVT_S5C_MESSAGE); + e = sgw_event_new(SGW_EVT_S5C_MESSAGE); } else { - event_set(&e, SGW_EVT_S11_MESSAGE); + e = sgw_event_new(SGW_EVT_S11_MESSAGE); } - event_set_param1(&e, (c_uintptr_t)pkbuf); + ogs_assert(e); + e->pkbuf = pkbuf; - rv = sgw_event_send(&e); - if (rv != CORE_OK) - { - d_error("sgw_event_send error"); - pkbuf_free(pkbuf); - return -1; - } - - return 0; + sgw_event_send(e); } -static int _gtpv1_u_recv_cb(sock_id sock, void *data) +static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data) { - char buf[CORE_ADDRSTRLEN]; - status_t rv; - pkbuf_t *pkbuf = NULL; - c_sockaddr_t from; + char buf[OGS_ADDRSTRLEN]; + int rv; + ogs_pkbuf_t *pkbuf = NULL; + ogs_sockaddr_t from; gtp_header_t *gtp_h = NULL; sgw_bearer_t *bearer = NULL; sgw_tunnel_t *tunnel = NULL; - c_uint32_t teid; + uint32_t teid; int i; - d_assert(sock, return -1, "Null param"); + ogs_assert(fd != INVALID_SOCKET); - rv = gtp_recvfrom(sock, &pkbuf, &from); - if (rv != CORE_OK) + rv = gtp_recvfrom(fd, &pkbuf, &from); + if (rv != OGS_OK) { - if (errno == EAGAIN) - return 0; - - return -1; + ogs_log_message(OGS_LOG_WARN, ogs_socket_errno, "gtp_recv() failed"); + return; } - d_trace(50, "[SGW] RECV : "); - d_trace_hex(50, pkbuf->payload, pkbuf->len); - - gtp_h = (gtp_header_t *)pkbuf->payload; + gtp_h = (gtp_header_t *)pkbuf->data; if (gtp_h->type == GTPU_MSGTYPE_ECHO_REQ) { - pkbuf_t *echo_rsp; + ogs_pkbuf_t *echo_rsp; - d_trace(3, "[SGW] RECV Echo Request from [%s]\n", - CORE_ADDR(&from, buf)); + ogs_debug("[SGW] RECV Echo Request from [%s]", + OGS_ADDR(&from, buf)); echo_rsp = gtp_handle_echo_req(pkbuf); if (echo_rsp) { ssize_t sent; /* Echo reply */ - d_trace(3, "[SGW] SEND Echo Response to [%s]\n", - CORE_ADDR(&from, buf)); + ogs_debug("[SGW] SEND Echo Response to [%s]", + OGS_ADDR(&from, buf)); - sent = core_sendto(sock, - echo_rsp->payload, echo_rsp->len, 0, &from); + sent = ogs_sendto(fd, echo_rsp->data, echo_rsp->len, 0, &from); if (sent < 0 || sent != echo_rsp->len) { - d_error("core_sendto failed(%d:%s)", errno, strerror(errno)); + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "ogs_sendto() failed"); } - pkbuf_free(echo_rsp); + ogs_pkbuf_free(echo_rsp); } } else if (gtp_h->type == GTPU_MSGTYPE_GPDU || @@ -112,26 +93,26 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) { teid = ntohl(gtp_h->teid); if (gtp_h->type == GTPU_MSGTYPE_GPDU) - d_trace(3, "[SGW] RECV GPU-U from [%s] : TEID[0x%x]\n", - CORE_ADDR(&from, buf), teid); + ogs_debug("[SGW] RECV GPU-U from [%s] : TEID[0x%x]", + OGS_ADDR(&from, buf), teid); else if (gtp_h->type == GTPU_MSGTYPE_END_MARKER) - d_trace(3, "[SGW] RECV End Marker from [%s] : TEID[0x%x]\n", - CORE_ADDR(&from, buf), teid); + ogs_debug("[SGW] RECV End Marker from [%s] : TEID[0x%x]", + OGS_ADDR(&from, buf), teid); tunnel = sgw_tunnel_find_by_teid(teid); if (!tunnel) { if (gtp_h->type == GTPU_MSGTYPE_GPDU) - d_warn("[SGW] RECV GPU-U from [%s] : No TEID[0x%x]", - CORE_ADDR(&from, buf), teid); + ogs_warn("[SGW] RECV GPU-U from [%s] : No TEID[0x%x]", + OGS_ADDR(&from, buf), teid); else if (gtp_h->type == GTPU_MSGTYPE_END_MARKER) - d_warn("[SGW] RECV End Marker from [%s] : No TEID[0x%x]", - CORE_ADDR(&from, buf), teid); - pkbuf_free(pkbuf); - return 0; + ogs_warn("[SGW] RECV End Marker from [%s] : No TEID[0x%x]", + OGS_ADDR(&from, buf), teid); + ogs_pkbuf_free(pkbuf); + return; } bearer = tunnel->bearer; - d_assert(bearer, pkbuf_free(pkbuf); return 0, "Null param"); + ogs_assert(bearer); /* Convert TEID */ if (tunnel->interface_type == GTP_F_TEID_S1_U_SGW_GTP_U) @@ -139,15 +120,15 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) sgw_tunnel_t *s5u_tunnel = NULL; s5u_tunnel = sgw_s5u_tunnel_in_bearer(bearer); - d_assert(s5u_tunnel, pkbuf_free(pkbuf); return 0,); - d_assert(s5u_tunnel->gnode, pkbuf_free(pkbuf); return 0,); - d_assert(s5u_tunnel->gnode->sock, pkbuf_free(pkbuf); return 0,); - d_trace(3, "[SGW] SEND GPU-U to PGW[%s]: TEID[0x%x]\n", - CORE_ADDR(sock_remote_addr(s5u_tunnel->gnode->sock), buf), + ogs_assert(s5u_tunnel); + ogs_assert(s5u_tunnel->gnode); + ogs_assert(s5u_tunnel->gnode->sock); + ogs_debug("[SGW] SEND GPU-U to PGW[%s]: TEID[0x%x]", + OGS_ADDR(&s5u_tunnel->gnode->conn, buf), s5u_tunnel->remote_teid); gtp_h->teid = htonl(s5u_tunnel->remote_teid); - gtp_send(s5u_tunnel->gnode, pkbuf); + gtp_sendto(s5u_tunnel->gnode, pkbuf); } else if (tunnel->interface_type == GTP_F_TEID_SGW_GTP_U_FOR_DL_DATA_FORWARDING || @@ -158,29 +139,29 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) indirect_tunnel = sgw_tunnel_find_by_interface_type(bearer, tunnel->interface_type); - d_assert(indirect_tunnel, pkbuf_free(pkbuf); return 0,); - d_assert(indirect_tunnel->gnode, pkbuf_free(pkbuf); return 0,); - d_assert(indirect_tunnel->gnode->sock, pkbuf_free(pkbuf); return 0,); - d_trace(3, "[SGW] SEND GPU-U to Indirect Tunnel[%s]: TEID[0x%x]\n", - CORE_ADDR(sock_remote_addr(indirect_tunnel->gnode->sock), buf), + ogs_assert(indirect_tunnel); + ogs_assert(indirect_tunnel->gnode); + ogs_assert(indirect_tunnel->gnode->sock); + ogs_debug("[SGW] SEND GPU-U to Indirect Tunnel[%s]: TEID[0x%x]", + OGS_ADDR(&indirect_tunnel->gnode->conn, buf), indirect_tunnel->remote_teid); gtp_h->teid = htonl(indirect_tunnel->remote_teid); - gtp_send(indirect_tunnel->gnode, pkbuf); + gtp_sendto(indirect_tunnel->gnode, pkbuf); } else if (tunnel->interface_type == GTP_F_TEID_S5_S8_SGW_GTP_U) { sgw_tunnel_t *s1u_tunnel = NULL; s1u_tunnel = sgw_s1u_tunnel_in_bearer(bearer); - d_assert(s1u_tunnel, pkbuf_free(pkbuf); return 0, "Null param"); + ogs_assert(s1u_tunnel); if (s1u_tunnel->remote_teid) { - d_assert(s1u_tunnel->gnode, pkbuf_free(pkbuf); return 0,); - d_assert(s1u_tunnel->gnode->sock, pkbuf_free(pkbuf); return 0,); - d_trace(3, "[SGW] SEND GPU-U to ENB[%s]: TEID[0x%x]\n", - CORE_ADDR(sock_remote_addr(s1u_tunnel->gnode->sock), buf), + ogs_assert(s1u_tunnel->gnode); + ogs_assert(s1u_tunnel->gnode->sock); + ogs_debug("[SGW] SEND GPU-U to ENB[%s]: TEID[0x%x]", + OGS_ADDR(&s1u_tunnel->gnode->conn, buf), s1u_tunnel->remote_teid); /* If there is buffered packet, send it first */ @@ -188,16 +169,16 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) { gtp_header_t *gtp_h = NULL; - gtp_h = (gtp_header_t *)bearer->buffered_pkts[i]->payload; - gtp_h->teid = htonl(s1u_tunnel->remote_teid); + gtp_h = (gtp_header_t *)bearer->buffered_pkts[i]->data; + gtp_h->teid = htonl(s1u_tunnel->remote_teid); - gtp_send(s1u_tunnel->gnode, bearer->buffered_pkts[i]); - pkbuf_free(bearer->buffered_pkts[i]); + gtp_sendto(s1u_tunnel->gnode, bearer->buffered_pkts[i]); + ogs_pkbuf_free(bearer->buffered_pkts[i]); } bearer->num_buffered_pkt = 0; gtp_h->teid = htonl(s1u_tunnel->remote_teid); - gtp_send(s1u_tunnel->gnode, pkbuf); + gtp_sendto(s1u_tunnel->gnode, pkbuf); } else { @@ -207,33 +188,25 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) */ sgw_ue_t *sgw_ue = NULL; - d_assert(bearer->sess, pkbuf_free(pkbuf); return 0, - "Session is NULL"); - d_assert(bearer->sess->sgw_ue, pkbuf_free(pkbuf); return 0, - "SGW_UE is NULL"); + ogs_assert(bearer->sess); + ogs_assert(bearer->sess->sgw_ue); sgw_ue = bearer->sess->sgw_ue; - d_trace(3, "[SGW] S1U PATH deactivated : STATE[0x%x]\n", + ogs_debug("[SGW] S1U PATH deactivated : STATE[0x%x]", SGW_GET_UE_STATE(sgw_ue)); if ((SGW_GET_UE_STATE(sgw_ue) & SGW_S1U_INACTIVE)) { - d_trace(5, " SGW-S1U Inactive\n"); + ogs_debug(" SGW-S1U Inactive"); if (!(SGW_GET_UE_STATE(sgw_ue) & SGW_DL_NOTI_SENT)) { - event_t e; - status_t rv; + sgw_event_t *e; - d_trace(5, " EVENT DL Data Notification\n"); - event_set(&e, SGW_EVT_LO_DLDATA_NOTI); - event_set_param1(&e, (c_uintptr_t)bearer->index); - rv = sgw_event_send(&e); - if (rv != CORE_OK) - { - d_error("sgw_event_send error"); - pkbuf_free(pkbuf); - return 0; - } + ogs_debug(" EVENT DL Data Notification"); + e = sgw_event_new(SGW_EVT_LO_DLDATA_NOTI); + ogs_assert(e); + e->bearer = bearer; + sgw_event_send(e); SGW_SET_UE_STATE(sgw_ue, SGW_DL_NOTI_SENT); } @@ -243,13 +216,13 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) { bearer->buffered_pkts[bearer->num_buffered_pkt++] = pkbuf; - return 0; + return; } } else { /* UE is S1U_ACTIVE state but there is no s1u teid */ - d_trace(5, "[SGW] UE is ACITVE but there is no matched " + ogs_debug("[SGW] UE is ACITVE but there is no matched " "ENB_S1U_TEID[%d]", teid); /* Just drop it */ @@ -258,72 +231,131 @@ static int _gtpv1_u_recv_cb(sock_id sock, void *data) } } - pkbuf_free(pkbuf); - return 0; + ogs_pkbuf_free(pkbuf); + return; } -status_t sgw_gtp_open() +int sgw_gtp_open() { - status_t rv; + int rv; + ogs_socknode_t *snode = NULL; + ogs_sock_t *sock = NULL; - rv = gtp_server_list(&sgw_self()->gtpc_list, _gtpv2_c_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = gtp_server_list(&sgw_self()->gtpc_list6, _gtpv2_c_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_list_for_each(&sgw_self()->gtpc_list, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(sgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, NULL); + ogs_assert(snode->poll); + } + ogs_list_for_each(&sgw_self()->gtpc_list6, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(sgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, NULL); + ogs_assert(snode->poll); + } sgw_self()->gtpc_sock = gtp_local_sock_first(&sgw_self()->gtpc_list); sgw_self()->gtpc_sock6 = gtp_local_sock_first(&sgw_self()->gtpc_list6); sgw_self()->gtpc_addr = gtp_local_addr_first(&sgw_self()->gtpc_list); sgw_self()->gtpc_addr6 = gtp_local_addr_first(&sgw_self()->gtpc_list6); - d_assert(sgw_self()->gtpc_addr || sgw_self()->gtpc_addr6, - return CORE_ERROR, "No GTP Server"); + ogs_assert(sgw_self()->gtpc_addr || sgw_self()->gtpc_addr6); - rv = gtp_server_list(&sgw_self()->gtpu_list, _gtpv1_u_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = gtp_server_list(&sgw_self()->gtpu_list6, _gtpv1_u_recv_cb); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_list_for_each(&sgw_self()->gtpu_list, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(sgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, NULL); + ogs_assert(snode->poll); + } + ogs_list_for_each(&sgw_self()->gtpu_list6, snode) + { + rv = gtp_server(snode); + ogs_assert(rv == OGS_OK); + + sock = snode->sock; + ogs_assert(sock); + + snode->poll = ogs_pollset_add(sgw_self()->pollset, + OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, NULL); + ogs_assert(snode->poll); + } sgw_self()->gtpu_sock = gtp_local_sock_first(&sgw_self()->gtpu_list); sgw_self()->gtpu_sock6 = gtp_local_sock_first(&sgw_self()->gtpu_list6); sgw_self()->gtpu_addr = gtp_local_addr_first(&sgw_self()->gtpu_list); sgw_self()->gtpu_addr6 = gtp_local_addr_first(&sgw_self()->gtpu_list6); - d_assert(sgw_self()->gtpu_addr || sgw_self()->gtpu_addr6, - return CORE_ERROR, "No GTP Server"); + ogs_assert(sgw_self()->gtpu_addr || sgw_self()->gtpu_addr6); - return CORE_OK; + return OGS_OK; } -status_t sgw_gtp_close() +int sgw_gtp_close() { - sock_delete_list(&sgw_self()->gtpc_list); - sock_delete_list(&sgw_self()->gtpc_list6); + ogs_socknode_t *snode = NULL; - sock_delete_list(&sgw_self()->gtpu_list); - sock_delete_list(&sgw_self()->gtpu_list6); + ogs_list_for_each(&sgw_self()->gtpc_list, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + ogs_list_for_each(&sgw_self()->gtpc_list6, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } - return CORE_OK; + ogs_list_for_each(&sgw_self()->gtpu_list, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + ogs_list_for_each(&sgw_self()->gtpu_list6, snode) + { + ogs_pollset_remove(snode->poll); + ogs_sock_destroy(snode->sock); + } + + return OGS_OK; } -status_t sgw_gtp_send_end_marker(sgw_tunnel_t *s1u_tunnel) +int sgw_gtp_send_end_marker(sgw_tunnel_t *s1u_tunnel) { - char buf[CORE_ADDRSTRLEN]; - status_t rv; - pkbuf_t *pkbuf = NULL; + char buf[OGS_ADDRSTRLEN]; + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_header_t *h = NULL; - d_assert(s1u_tunnel, return CORE_ERROR,); - d_assert(s1u_tunnel->gnode, return CORE_ERROR,); - d_assert(s1u_tunnel->gnode->sock, return CORE_ERROR,); + ogs_assert(s1u_tunnel); + ogs_assert(s1u_tunnel->gnode); + ogs_assert(s1u_tunnel->gnode->sock); - d_trace(3, "[SGW] SEND End Marker to ENB[%s]: TEID[0x%x]\n", - CORE_ADDR(sock_remote_addr(s1u_tunnel->gnode->sock), buf), + ogs_debug("[SGW] SEND End Marker to ENB[%s]: TEID[0x%x]", + OGS_ADDR(&s1u_tunnel->gnode->conn, buf), s1u_tunnel->remote_teid); - pkbuf = pkbuf_alloc(0, 100 /* enough for END_MARKER; use smaller buffer */); - d_assert(pkbuf, return CORE_ERROR,); - h = (gtp_header_t *)pkbuf->payload; + pkbuf = ogs_pkbuf_alloc(NULL, + 100 /* enough for END_MARKER; use smaller buffer */); + ogs_pkbuf_put(pkbuf, 100); + h = (gtp_header_t *)pkbuf->data; memset(h, 0, GTPV1U_HEADER_LEN); @@ -336,9 +368,9 @@ status_t sgw_gtp_send_end_marker(sgw_tunnel_t *s1u_tunnel) h->type = GTPU_MSGTYPE_END_MARKER; h->teid = htonl(s1u_tunnel->remote_teid); - rv = gtp_send(s1u_tunnel->gnode, pkbuf); - d_assert(rv == CORE_OK,, "gtp send failed"); - pkbuf_free(pkbuf); + rv = gtp_sendto(s1u_tunnel->gnode, pkbuf); + ogs_assert(rv == OGS_OK); + ogs_pkbuf_free(pkbuf); return rv; } diff --git a/src/sgw/sgw_gtp_path.h b/src/sgw/sgw_gtp_path.h index 90b219f44..7f4137859 100644 --- a/src/sgw/sgw_gtp_path.h +++ b/src/sgw/sgw_gtp_path.h @@ -7,10 +7,10 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) sgw_gtp_open(); -CORE_DECLARE(status_t) sgw_gtp_close(); +int sgw_gtp_open(); +int sgw_gtp_close(); -CORE_DECLARE(status_t) sgw_gtp_send_end_marker(sgw_tunnel_t *s1u_tunnel); +int sgw_gtp_send_end_marker(sgw_tunnel_t *s1u_tunnel); #ifdef __cplusplus } diff --git a/src/sgw/sgw_init.c b/src/sgw/sgw_init.c index 442fb9fb7..6ef7e7426 100644 --- a/src/sgw/sgw_init.c +++ b/src/sgw/sgw_init.c @@ -1,107 +1,89 @@ -#define TRACE_MODULE _sgw_init - -#include "core_debug.h" -#include "core_thread.h" - #include "gtp/gtp_xact.h" +#include "app/context.h" #include "sgw_context.h" #include "sgw_sm.h" #include "sgw_event.h" -static thread_id sgw_thread; -static void *THREAD_FUNC sgw_main(thread_id id, void *data); +static ogs_thread_t *thread; +static void sgw_main(void *data); static int initialized = 0; -status_t sgw_initialize() +int sgw_initialize() { - status_t rv; + int rv; rv = sgw_context_init(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; rv = sgw_context_parse_config(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - rv = sgw_context_setup_trace_module(); - if (rv != CORE_OK) return rv; + rv = context_setup_log_module(); + if (rv != OGS_OK) return rv; - rv = thread_create(&sgw_thread, NULL, sgw_main, NULL); - if (rv != CORE_OK) return rv; + thread = ogs_thread_create(sgw_main, NULL); + if (!thread) return OGS_ERROR; initialized = 1; - return CORE_OK; + return OGS_OK; } void sgw_terminate(void) { if (!initialized) return; - thread_delete(sgw_thread); + sgw_event_term(); + + ogs_thread_destroy(thread); sgw_context_final(); gtp_xact_final(); + + sgw_event_final(); } -static void *THREAD_FUNC sgw_main(thread_id id, void *data) +static void sgw_main(void *data) { - event_t event; - fsm_t sgw_sm; - c_time_t prev_tm, now_tm; - status_t rv; + ogs_fsm_t sgw_sm; + int rv; - memset(&event, 0, sizeof(event_t)); + sgw_event_init(); + gtp_xact_init(sgw_self()->timer_mgr); - sgw_self()->queue_id = event_create(MSGQ_O_NONBLOCK); - d_assert(sgw_self()->queue_id, return NULL, - "SGW event queue creation failed"); - tm_service_init(&sgw_self()->tm_service); - gtp_xact_init(&sgw_self()->tm_service, - SGW_EVT_T3_RESPONSE, SGW_EVT_T3_HOLDING); + ogs_fsm_create(&sgw_sm, sgw_state_initial, sgw_state_final); + ogs_fsm_init(&sgw_sm, 0); - fsm_create(&sgw_sm, sgw_state_initial, sgw_state_final); - fsm_init(&sgw_sm, 0); - - prev_tm = time_now(); - -#define EVENT_LOOP_TIMEOUT 10 /* 10ms */ - while ((!thread_should_stop())) + for ( ;; ) { - sock_select_loop(EVENT_LOOP_TIMEOUT); - do + ogs_pollset_poll(sgw_self()->pollset, + ogs_timer_mgr_next(sgw_self()->timer_mgr)); + + ogs_timer_mgr_expire(sgw_self()->timer_mgr); + + for ( ;; ) { - rv = event_recv(sgw_self()->queue_id, &event); + sgw_event_t *e = NULL; - d_assert(rv != CORE_ERROR, continue, - "While receiving a event message, error occurs"); + rv = ogs_queue_trypop(sgw_self()->queue, (void**)&e); + ogs_assert(rv != OGS_ERROR); - now_tm = time_now(); + if (rv == OGS_DONE) + goto done; - /* if the gap is over event_loop timeout, execute preriodic jobs */ - if (now_tm - prev_tm > (EVENT_LOOP_TIMEOUT * 1000)) - { - tm_execute_tm_service( - &sgw_self()->tm_service, sgw_self()->queue_id); + if (rv == OGS_RETRY) + break; - prev_tm = now_tm; - } - - if (rv == CORE_EAGAIN) - { - continue; - } - - fsm_dispatch(&sgw_sm, (fsm_event_t*)&event); - } while(rv == CORE_OK); + ogs_assert(e); + ogs_fsm_dispatch(&sgw_sm, e); + sgw_event_free(e); + } } +done: - fsm_final(&sgw_sm, 0); - fsm_clear(&sgw_sm); - - event_delete(sgw_self()->queue_id); - - return NULL; + ogs_fsm_fini(&sgw_sm, 0); + ogs_fsm_delete(&sgw_sm); } diff --git a/src/sgw/sgw_s11_handler.c b/src/sgw/sgw_s11_handler.c index 69f87c702..57a4d7743 100644 --- a/src/sgw/sgw_s11_handler.c +++ b/src/sgw/sgw_s11_handler.c @@ -1,14 +1,9 @@ -#define TRACE_MODULE _sgw_s11_handler - -#include "core_debug.h" -#include "core_lib.h" - #include "gtp/gtp_types.h" #include "gtp/gtp_conv.h" #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" -#include "common/context.h" +#include "app/context.h" #include "sgw_event.h" #include "sgw_context.h" #include "sgw_gtp_path.h" @@ -17,10 +12,10 @@ void sgw_s11_handle_create_session_request( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message) { - status_t rv; - c_uint16_t decoded; + int rv; + uint16_t decoded; gtp_create_session_request_t *req = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_f_teid_t *mme_s11_teid = NULL; gtp_f_teid_t *pgw_s5c_teid = NULL; int len = 0; @@ -33,67 +28,67 @@ void sgw_s11_handle_create_session_request( sgw_bearer_t *bearer = NULL; sgw_tunnel_t *s5u_tunnel = NULL; - d_assert(s11_xact, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(gtp_message); req = >p_message->create_session_request; - d_trace(3, "[SGW] Create Session Request\n"); + ogs_debug("[SGW] Create Session Request"); if (req->bearer_contexts_to_be_created.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts_to_be_created.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } - d_assert(sgw_ue, return, "Null param"); + ogs_assert(sgw_ue); sess = sgw_sess_find_by_ebi(sgw_ue, req->bearer_contexts_to_be_created.eps_bearer_id.u8); if (!sess) { - c_int8_t apn[MAX_APN_LEN]; + char apn[MAX_APN_LEN]; if (req->access_point_name.presence == 0) { - d_error("No APN"); + ogs_error("No APN"); return; } apn_parse(apn, req->access_point_name.data, req->access_point_name.len); sess = sgw_sess_add(sgw_ue, apn, req->bearer_contexts_to_be_created.eps_bearer_id.u8); - d_assert(sess, return, "Null param"); + ogs_assert(sess); } if (req->sender_f_teid_for_control_plane.presence == 0) { - d_error("No Sender F-TEID"); + ogs_error("No Sender F-TEID"); return; } if (req->pgw_s5_s8_address_for_control_plane_or_pmip.presence == 0) { - d_error("No PGW IP"); + ogs_error("No PGW IP"); return; } if (req->user_location_information.presence == 0) { - d_error("No User Location Inforamtion"); + ogs_error("No User Location Inforamtion"); return; } - d_assert(sess, return, "Null param"); + ogs_assert(sess); bearer = sgw_default_bearer_in_sess(sess); - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); s5u_tunnel = sgw_s5u_tunnel_in_bearer(bearer); - d_assert(s5u_tunnel, return, "Null param"); + ogs_assert(s5u_tunnel); /* Receive Control Plane(DL) : MME-S11 */ mme_s11_teid = req->sender_f_teid_for_control_plane.data; - d_assert(mme_s11_teid, return, "Null param"); + ogs_assert(mme_s11_teid); sgw_ue->mme_s11_teid = ntohl(mme_s11_teid->teid); /* Send Control Plane(DL) : SGW-S5C */ @@ -102,33 +97,33 @@ void sgw_s11_handle_create_session_request( sgw_s5c_teid.teid = htonl(sess->sgw_s5c_teid); rv = gtp_sockaddr_to_f_teid( sgw_self()->gtpc_addr, sgw_self()->gtpc_addr6, &sgw_s5c_teid, &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); req->sender_f_teid_for_control_plane.presence = 1; req->sender_f_teid_for_control_plane.data = &sgw_s5c_teid; req->sender_f_teid_for_control_plane.len = len; - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]\n", + ogs_debug(" SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]", s5u_tunnel->local_teid, s5u_tunnel->remote_teid); pgw_s5c_teid = req->pgw_s5_s8_address_for_control_plane_or_pmip.data; - d_assert(pgw_s5c_teid, return, "Null param"); + ogs_assert(pgw_s5c_teid); pgw = gtp_find_node(&sgw_self()->pgw_s5c_list, pgw_s5c_teid); if (!pgw) { pgw = gtp_add_node(&sgw_self()->pgw_s5c_list, pgw_s5c_teid, sgw_self()->gtpc_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(pgw, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(pgw); - rv = gtp_client(pgw); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect(sgw_self()->gtpc_sock, sgw_self()->gtpc_sock6, pgw); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(sess, pgw); @@ -142,14 +137,14 @@ void sgw_s11_handle_create_session_request( sgw_s5u_teid.interface_type = GTP_F_TEID_S5_S8_SGW_GTP_U; rv = gtp_sockaddr_to_f_teid( sgw_self()->gtpu_addr, sgw_self()->gtpu_addr6, &sgw_s5u_teid, &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.presence = 1; req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.data = &sgw_s5u_teid; req->bearer_contexts_to_be_created.s5_s8_u_sgw_f_teid.len = len; /* Set User Location Information */ decoded = gtp_parse_uli(&uli, &req->user_location_information); - d_assert(req->user_location_information.len == decoded, return,); + ogs_assert(req->user_location_information.len == decoded); memcpy(&bearer->tai.plmn_id, &uli.tai.plmn_id, sizeof(uli.tai.plmn_id)); bearer->tai.tac = uli.tai.tac; memcpy(&bearer->e_cgi.plmn_id, &uli.e_cgi.plmn_id, sizeof(uli.e_cgi.plmn_id)); @@ -159,69 +154,69 @@ void sgw_s11_handle_create_session_request( gtp_message->h.teid = sess->pgw_s5c_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); s5c_xact = gtp_xact_local_create(sess->gnode, >p_message->h, pkbuf); - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); gtp_xact_associate(s11_xact, s5c_xact); rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } -CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, +void sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_modify_bearer_request_t *req) { - status_t rv; - char buf[CORE_ADDRSTRLEN]; + int rv; + char buf[OGS_ADDRSTRLEN]; - c_uint16_t decoded; + uint16_t decoded; gtp_node_t *enb = NULL; sgw_bearer_t *bearer = NULL; sgw_tunnel_t *s1u_tunnel = NULL; gtp_modify_bearer_response_t *rsp = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_message_t gtp_message; gtp_cause_t cause; gtp_f_teid_t *enb_s1u_teid = NULL; gtp_uli_t uli; - d_assert(s11_xact, return, "Null param"); - d_assert(sgw_ue, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(sgw_ue); + ogs_assert(req); - d_trace(3, "[SGW] Modify Bearer Reqeust\n"); + ogs_debug("[SGW] Modify Bearer Reqeust"); if (req->bearer_contexts_to_be_modified.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts_to_be_modified.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } if (req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.presence == 0) { - d_error("No eNB TEID"); + ogs_error("No eNB TEID"); return; } bearer = sgw_bearer_find_by_ue_ebi(sgw_ue, req->bearer_contexts_to_be_modified.eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context"); + ogs_assert(bearer); s1u_tunnel = sgw_s1u_tunnel_in_bearer(bearer); - d_assert(s1u_tunnel, return, "No S1U Tunnel Context"); + ogs_assert(s1u_tunnel); /* Data Plane(DL) : eNB-S1U */ enb_s1u_teid = req->bearer_contexts_to_be_modified.s1_u_enodeb_f_teid.data; s1u_tunnel->remote_teid = ntohl(enb_s1u_teid->teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]\n", + ogs_debug(" ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]", s1u_tunnel->remote_teid, s1u_tunnel->local_teid); enb = gtp_find_node(&sgw_self()->enb_s1u_list, enb_s1u_teid); @@ -229,17 +224,13 @@ CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, { enb = gtp_add_node(&sgw_self()->enb_s1u_list, enb_s1u_teid, sgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(enb, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(enb); -#if UNBOUNDED_UDP_SOCKET rv = gtp_connect(sgw_self()->gtpu_sock, sgw_self()->gtpu_sock6, enb); -#else - rv = gtp_client(enb); -#endif - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); } #if ULI_END_MARKER @@ -248,21 +239,21 @@ CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, { /* Set User Location Information */ decoded = gtp_parse_uli(&uli, &req->user_location_information); - d_assert(req->user_location_information.len == decoded, return,); + ogs_assert(req->user_location_information.len == decoded); memcpy(&bearer->tai.plmn_id, &uli.tai.plmn_id, sizeof(uli.tai.plmn_id)); bearer->tai.tac = uli.tai.tac; memcpy(&bearer->e_cgi.plmn_id, &uli.e_cgi.plmn_id, sizeof(uli.e_cgi.plmn_id)); - d_trace(5, " ULI Presence: CellID[OLD:0x%x, NEW:0x%x]\n", + ogs_debug(" ULI Presence: CellID[OLD:0x%x, NEW:0x%x]", bearer->e_cgi.cell_id, uli.e_cgi.cell_id); if (bearer->e_cgi.cell_id != uli.e_cgi.cell_id) { - d_trace(3, "[SGW] SEND End Marker to ENB[%s]: TEID[0x%x]\n", - CORE_ADDR(sock_remote_addr(s1u_tunnel->gnode->sock), buf), + ogs_debug("[SGW] SEND End Marker to ENB[%s]: TEID[0x%x]", + OGS_ADDR(&s1u_tunnel->gnode->conn, buf), s1u_tunnel->remote_teid); rv = sgw_gtp_send_end_marker(s1u_tunnel); - if (rv != CORE_OK) - d_error("gtp send end marker failed"); + if (rv != OGS_OK) + ogs_error("gtp send end marker failed"); bearer->e_cgi.cell_id = uli.e_cgi.cell_id; } @@ -273,28 +264,30 @@ CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, { /* Set User Location Information */ decoded = gtp_parse_uli(&uli, &req->user_location_information); - d_assert(req->user_location_information.len == decoded, return,); + ogs_assert(req->user_location_information.len == decoded); memcpy(&bearer->tai.plmn_id, &uli.tai.plmn_id, sizeof(uli.tai.plmn_id)); bearer->tai.tac = uli.tai.tac; memcpy(&bearer->e_cgi.plmn_id, &uli.e_cgi.plmn_id, sizeof(uli.e_cgi.plmn_id)); bearer->e_cgi.cell_id = uli.e_cgi.cell_id; - d_trace(5, " TAI[PLMN_ID:0x%x,TAC:%d]\n", - bearer->tai.plmn_id, bearer->tai.tac); - d_trace(5, " E_CGI[PLMN_ID:0x%x,CELL_ID:%d]\n", - bearer->e_cgi.plmn_id, bearer->e_cgi.cell_id); + ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", + plmn_id_hexdump(&bearer->tai.plmn_id), + bearer->tai.tac); + ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", + plmn_id_hexdump(&bearer->e_cgi.plmn_id), + bearer->e_cgi.cell_id); } if (s1u_tunnel->gnode && s1u_tunnel->gnode != enb) { - d_assert(s1u_tunnel->gnode->sock, return,); + ogs_assert(s1u_tunnel->gnode->sock); - d_trace(3, "[SGW] SEND End Marker to ENB[%s]: TEID[0x%x]", - CORE_ADDR(sock_remote_addr(s1u_tunnel->gnode->sock), buf), + ogs_debug("[SGW] SEND End Marker to ENB[%s]: TEID[0x%x]", + OGS_ADDR(&s1u_tunnel->gnode->conn, buf), s1u_tunnel->remote_teid); rv = sgw_gtp_send_end_marker(s1u_tunnel); - if (rv != CORE_OK) - d_error("gtp send end marker failed"); + if (rv != OGS_OK) + ogs_error("gtp send end marker failed"); } #endif @@ -318,66 +311,66 @@ CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, gtp_message.h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, >p_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s11_xact, >p_message.h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_delete_session_request(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message) { - status_t rv; - pkbuf_t *pkbuf = NULL; + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *s5c_xact = NULL; sgw_sess_t *sess = NULL; gtp_delete_session_request_t *req = NULL; - d_assert(s11_xact, return, "Null param"); - d_assert(sgw_ue, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(sgw_ue); + ogs_assert(gtp_message); req = >p_message->delete_session_request; - d_assert(req, return, "Null param"); + ogs_assert(req); - d_trace(3, "[SGW] Delete Session Reqeust\n"); + ogs_debug("[SGW] Delete Session Reqeust"); if (req->linked_eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } sess = sgw_sess_find_by_ebi(sgw_ue, req->linked_eps_bearer_id.u8); - d_assert(sess, return, "Null param"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_assert(sess); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); gtp_message->h.type = GTP_DELETE_SESSION_REQUEST_TYPE; gtp_message->h.teid = sess->pgw_s5c_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); s5c_xact = gtp_xact_local_create(sess->gnode, >p_message->h, pkbuf); - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); gtp_xact_associate(s11_xact, s5c_xact); rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message) { - status_t rv; - c_uint16_t decoded; - pkbuf_t *pkbuf = NULL; + int rv; + uint16_t decoded; + ogs_pkbuf_t *pkbuf = NULL; gtp_node_t *enb = NULL; gtp_xact_t *s5c_xact = NULL; sgw_sess_t *sess = NULL; @@ -390,56 +383,56 @@ void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, int len; gtp_uli_t uli; - d_assert(s11_xact, return, "Null param"); - d_assert(sgw_ue, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(sgw_ue); + ogs_assert(gtp_message); s5c_xact = s11_xact->assoc_xact; - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); - d_trace(3, "[SGW] Cerate Bearer Reqeust\n"); + ogs_debug("[SGW] Cerate Bearer Reqeust"); req = >p_message->create_bearer_response; - d_assert(req, return, "Null param"); + ogs_assert(req); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } if (req->bearer_contexts.s1_u_enodeb_f_teid.presence == 0) { - d_error("No eNB TEID"); + ogs_error("No eNB TEID"); return; } if (req->bearer_contexts.s4_u_sgsn_f_teid.presence == 0) { - d_error("No SGW TEID"); + ogs_error("No SGW TEID"); return; } if (req->user_location_information.presence == 0) { - d_error("No User Location Inforamtion"); + ogs_error("No User Location Inforamtion"); return; } /* Correlate with SGW-S1U-TEID */ sgw_s1u_teid = req->bearer_contexts.s4_u_sgsn_f_teid.data; - d_assert(sgw_s1u_teid, return, "Null param"); + ogs_assert(sgw_s1u_teid); req->bearer_contexts.s4_u_sgsn_f_teid.presence = 0; /* Find the Tunnel by SGW-S1U-TEID */ s1u_tunnel = sgw_tunnel_find_by_teid(ntohl(sgw_s1u_teid->teid)); - d_assert(s1u_tunnel, return, "Null param"); + ogs_assert(s1u_tunnel); bearer = s1u_tunnel->bearer; - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); s5u_tunnel = sgw_s5u_tunnel_in_bearer(bearer); - d_assert(s5u_tunnel, return, "Null param"); + ogs_assert(s5u_tunnel); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); /* Set EBI */ bearer->ebi = req->bearer_contexts.eps_bearer_id.u8; @@ -448,13 +441,13 @@ void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, enb_s1u_teid = req->bearer_contexts.s1_u_enodeb_f_teid.data; s1u_tunnel->remote_teid = ntohl(enb_s1u_teid->teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]\n", + ogs_debug(" ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]", s1u_tunnel->remote_teid, s1u_tunnel->local_teid); - d_trace(5, " SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]\n", + ogs_debug(" SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]", s5u_tunnel->local_teid, s5u_tunnel->remote_teid); enb = gtp_find_node(&sgw_self()->enb_s1u_list, enb_s1u_teid); @@ -462,13 +455,13 @@ void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, { enb = gtp_add_node(&sgw_self()->enb_s1u_list, enb_s1u_teid, sgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(enb, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(enb); - rv = gtp_client(enb); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect(sgw_self()->gtpu_sock, sgw_self()->gtpu_sock6, enb); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(s1u_tunnel, enb); @@ -477,7 +470,7 @@ void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, req->bearer_contexts.s1_u_enodeb_f_teid.presence = 0; decoded = gtp_parse_uli(&uli, &req->user_location_information); - d_assert(req->user_location_information.len == decoded, return,); + ogs_assert(req->user_location_information.len == decoded); memcpy(&bearer->tai.plmn_id, &uli.tai.plmn_id, sizeof(uli.tai.plmn_id)); bearer->tai.tac = uli.tai.tac; memcpy(&bearer->e_cgi.plmn_id, &uli.e_cgi.plmn_id, sizeof(uli.e_cgi.plmn_id)); @@ -492,13 +485,13 @@ void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, sgw_s5u_teid.teid = htonl(s5u_tunnel->local_teid); rv = gtp_sockaddr_to_f_teid( sgw_self()->gtpu_addr, sgw_self()->gtpu_addr6, &sgw_s5u_teid, &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); req->bearer_contexts.s5_s8_u_sgw_f_teid.presence = 1; req->bearer_contexts.s5_s8_u_sgw_f_teid.data = &sgw_s5u_teid; req->bearer_contexts.s5_s8_u_sgw_f_teid.len = len; /* Data Plane(DL) : PGW-S5U */ - d_assert(s5u_tunnel->gnode, return,); + ogs_assert(s5u_tunnel->gnode); pgw_s5u_teid.interface_type = GTP_F_TEID_S5_S8_PGW_GTP_U; pgw_s5u_teid.teid = htonl(s5u_tunnel->remote_teid); rv = gtp_ip_to_f_teid(&s5u_tunnel->gnode->ip, &pgw_s5u_teid, &len); @@ -510,125 +503,123 @@ void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, gtp_message->h.teid = sess->pgw_s5c_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s5c_xact, >p_message->h, pkbuf); - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_update_bearer_response(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message) { - status_t rv; - pkbuf_t *pkbuf = NULL; + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *s5c_xact = NULL; sgw_sess_t *sess = NULL; sgw_bearer_t *bearer = NULL; gtp_update_bearer_response_t *req = NULL; - d_assert(s11_xact, return, "Null param"); - d_assert(sgw_ue, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(sgw_ue); + ogs_assert(gtp_message); s5c_xact = s11_xact->assoc_xact; - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); req = >p_message->update_bearer_response; - d_assert(req, return, "Null param"); + ogs_assert(req); - d_trace(3, "[SGW] Update Bearer Reqeust\n"); + ogs_debug("[SGW] Update Bearer Reqeust"); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } bearer = sgw_bearer_find_by_ue_ebi( sgw_ue, req->bearer_contexts.eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context[EBI:%d]", - req->bearer_contexts.eps_bearer_id); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); gtp_message->h.type = GTP_UPDATE_BEARER_RESPONSE_TYPE; gtp_message->h.teid = sess->pgw_s5c_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s5c_xact, >p_message->h, pkbuf); - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_delete_bearer_response(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message) { - status_t rv; - pkbuf_t *pkbuf = NULL; + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *s5c_xact = NULL; sgw_sess_t *sess = NULL; sgw_bearer_t *bearer = NULL; gtp_delete_bearer_response_t *req = NULL; - d_assert(s11_xact, return, "Null param"); - d_assert(sgw_ue, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(sgw_ue); + ogs_assert(gtp_message); s5c_xact = s11_xact->assoc_xact; - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); req = >p_message->delete_bearer_response; - d_assert(req, return, "Null param"); + ogs_assert(req); - d_trace(3, "[SGW] Delete Bearer Response\n"); + ogs_debug("[SGW] Delete Bearer Response"); if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } bearer = sgw_bearer_find_by_ue_ebi( sgw_ue, req->bearer_contexts.eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context[EBI:%d]", - req->bearer_contexts.eps_bearer_id); + ogs_assert(bearer); sess = bearer->sess; - d_assert(sess, return, "Null param"); + ogs_assert(sess); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); gtp_message->h.type = GTP_DELETE_BEARER_RESPONSE_TYPE; gtp_message->h.teid = sess->pgw_s5c_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s5c_xact, >p_message->h, pkbuf); - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); sgw_bearer_remove(bearer); } @@ -636,9 +627,9 @@ void sgw_s11_handle_delete_bearer_response(gtp_xact_t *s11_xact, void sgw_s11_handle_release_access_bearers_request(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_release_access_bearers_request_t *req) { - status_t rv; + int rv; gtp_release_access_bearers_response_t *rsp = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_message_t gtp_message; sgw_bearer_t *bearer = NULL, *next_bearer = NULL; sgw_tunnel_t *s1u_tunnel = NULL; @@ -646,12 +637,12 @@ void sgw_s11_handle_release_access_bearers_request(gtp_xact_t *s11_xact, gtp_cause_t cause; - d_assert(sgw_ue, return, "Null param"); - d_assert(s11_xact, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s11_xact); + ogs_assert(req); - d_trace(3, "[SGW] Release Access Bearers Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Release Access Bearers Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); /* Set UE state to S1UE_INACTIVE */ SGW_SET_UE_STATE(sgw_ue, SGW_S1U_INACTIVE); @@ -662,13 +653,13 @@ void sgw_s11_handle_release_access_bearers_request(gtp_xact_t *s11_xact, sess = sgw_sess_first(sgw_ue); while (sess) { - bearer = list_first(&sess->bearer_list); + bearer = ogs_list_first(&sess->bearer_list); while (bearer) { - next_bearer = list_next(bearer); + next_bearer = ogs_list_next(bearer); s1u_tunnel = sgw_s1u_tunnel_in_bearer(bearer); - d_assert(s1u_tunnel, return, "Null param"); + ogs_assert(s1u_tunnel); s1u_tunnel->remote_teid = 0; @@ -692,33 +683,33 @@ void sgw_s11_handle_release_access_bearers_request(gtp_xact_t *s11_xact, gtp_message.h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, >p_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s11_xact, >p_message.h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_lo_dldata_notification(sgw_bearer_t *bearer) { - status_t rv; + int rv; gtp_downlink_data_notification_t *noti = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_message_t gtp_message; sgw_ue_t *sgw_ue = NULL; gtp_xact_t *xact = NULL; /* FIXME : ARP should be retrieved from ? */ - c_uint8_t arp = 0x61; + uint8_t arp = 0x61; - d_assert(bearer, return, "Null param"); + ogs_assert(bearer); sgw_ue = bearer->sgw_ue; - d_assert(sgw_ue, return, "Null param"); + ogs_assert(sgw_ue); - d_trace(3, "[SGW] Downlink Data Notification\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Downlink Data Notification"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); /* Build downlink notification message */ @@ -737,38 +728,38 @@ void sgw_s11_handle_lo_dldata_notification(sgw_bearer_t *bearer) gtp_message.h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, >p_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); xact = gtp_xact_local_create(sgw_ue->gnode, >p_message.h, pkbuf); - d_assert(xact, return, "Null param"); + ogs_assert(xact); rv = gtp_xact_commit(xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_downlink_data_notification_ack( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_downlink_data_notification_acknowledge_t *ack) { - status_t rv; - d_assert(sgw_ue, return, "Null param"); - d_assert(s11_xact, return, "Null param"); + int rv; + ogs_assert(sgw_ue); + ogs_assert(s11_xact); - d_trace(3, "[SGW] Downlink Data Notification Acknowledge\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Downlink Data Notification Acknowledge"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_create_indirect_data_forwarding_tunnel_request_t *req) { - status_t rv; + int rv; gtp_create_indirect_data_forwarding_tunnel_response_t *rsp = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_message_t gtp_message; int i; @@ -784,12 +775,12 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( gtp_f_teid_t rsp_ul_teid[GTP_MAX_NUM_OF_INDIRECT_TUNNEL]; int len; - d_assert(sgw_ue, return, "Null param"); - d_assert(s11_xact, return, "Null param"); - d_assert(req, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s11_xact); + ogs_assert(req); - d_trace(3, "[SGW] Create Indirect Data Forwarding Tunnel Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Create Indirect Data Forwarding Tunnel Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); rsp = >p_message.create_indirect_data_forwarding_tunnel_response; @@ -809,22 +800,22 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( { if (req_bearers[i]->eps_bearer_id.presence == 0) { - d_error("No EBI"); + ogs_error("No EBI"); return; } bearer = sgw_bearer_find_by_ue_ebi(sgw_ue, req_bearers[i]->eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context"); + ogs_assert(bearer); if (req_bearers[i]->s1_u_enodeb_f_teid.presence) { req_teid = req_bearers[i]->s1_u_enodeb_f_teid.data; - d_assert(req_teid, return,); + ogs_assert(req_teid); tunnel = sgw_tunnel_add(bearer, GTP_F_TEID_SGW_GTP_U_FOR_DL_DATA_FORWARDING); - d_assert(tunnel, return, "No Tunnel Context"); + ogs_assert(tunnel); tunnel->remote_teid = ntohl(req_teid->teid); enb = gtp_find_node(&sgw_self()->enb_s1u_list, req_teid); @@ -832,13 +823,14 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( { enb = gtp_add_node(&sgw_self()->enb_s1u_list, req_teid, sgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(enb, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(enb); - rv = gtp_client(enb); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect( + sgw_self()->gtpu_sock, sgw_self()->gtpu_sock6, enb); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(tunnel, enb); @@ -848,23 +840,23 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( rsp_dl_teid[i].teid = htonl(tunnel->local_teid); rv = gtp_sockaddr_to_f_teid(sgw_self()->gtpu_addr, sgw_self()->gtpu_addr6, &rsp_dl_teid[i], &len); - d_assert(len > 0, return,); + ogs_assert(len > 0); rsp_bearers[i]->s4_u_sgsn_f_teid.presence = 1; rsp_bearers[i]->s4_u_sgsn_f_teid.data = &rsp_dl_teid[i]; rsp_bearers[i]->s4_u_sgsn_f_teid.len = len; - d_trace(5, " SGW_DL_TEID[%d] ENB_DL_TEID[%d]\n", + ogs_debug(" SGW_DL_TEID[%d] ENB_DL_TEID[%d]", tunnel->local_teid, tunnel->remote_teid); } if (req_bearers[i]->s12_rnc_f_teid.presence) { req_teid = req_bearers[i]->s12_rnc_f_teid.data; - d_assert(req_teid, return,); + ogs_assert(req_teid); tunnel = sgw_tunnel_add(bearer, GTP_F_TEID_SGW_GTP_U_FOR_UL_DATA_FORWARDING); - d_assert(tunnel, return, "No Tunnel Context"); + ogs_assert(tunnel); tunnel->remote_teid = ntohl(req_teid->teid); enb = gtp_find_node(&sgw_self()->enb_s1u_list, req_teid); @@ -872,13 +864,14 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( { enb = gtp_add_node(&sgw_self()->enb_s1u_list, req_teid, sgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(enb, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(enb); - rv = gtp_client(enb); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect( + sgw_self()->gtpu_sock, sgw_self()->gtpu_sock6, enb); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(tunnel, enb); @@ -888,11 +881,11 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( rsp_ul_teid[i].interface_type = tunnel->interface_type; rv = gtp_sockaddr_to_f_teid(sgw_self()->gtpu_addr, sgw_self()->gtpu_addr6, &rsp_ul_teid[i], &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); rsp_bearers[i]->s2b_u_epdg_f_teid_5.presence = 1; rsp_bearers[i]->s2b_u_epdg_f_teid_5.data = &rsp_ul_teid[i]; rsp_bearers[i]->s2b_u_epdg_f_teid_5.len = len; - d_trace(5, " SGW_UL_TEID[%d] ENB_UL_TEID[%d]\n", + ogs_debug(" SGW_UL_TEID[%d] ENB_UL_TEID[%d]", tunnel->local_teid, tunnel->remote_teid); } @@ -910,21 +903,21 @@ void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( gtp_message.h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, >p_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s11_xact, >p_message.h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue) { - status_t rv; + int rv; gtp_delete_indirect_data_forwarding_tunnel_response_t *rsp = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; gtp_message_t gtp_message; sgw_sess_t *sess = NULL; @@ -933,11 +926,11 @@ void sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request( gtp_cause_t cause; - d_assert(sgw_ue, return, "Null param"); - d_assert(s11_xact, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s11_xact); - d_trace(3, "[SGW] Delete Indirect Data Forwarding Tunnel Request\n"); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Delete Indirect Data Forwarding Tunnel Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); /* Delete Indirect Tunnel */ @@ -983,11 +976,11 @@ void sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request( gtp_message.h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, >p_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s11_xact, >p_message.h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } diff --git a/src/sgw/sgw_s11_handler.h b/src/sgw/sgw_s11_handler.h index 57c70e081..d5c93eee0 100644 --- a/src/sgw/sgw_s11_handler.h +++ b/src/sgw/sgw_s11_handler.h @@ -9,31 +9,31 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact, +void sgw_s11_handle_create_session_request(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, +void sgw_s11_handle_modify_bearer_request(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_modify_bearer_request_t *req); -CORE_DECLARE(void) sgw_s11_handle_delete_session_request(gtp_xact_t *s11_xact, +void sgw_s11_handle_delete_session_request(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, +void sgw_s11_handle_create_bearer_response(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s11_handle_update_bearer_response(gtp_xact_t *s11_xact, +void sgw_s11_handle_update_bearer_response(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s11_handle_delete_bearer_response(gtp_xact_t *s11_xact, +void sgw_s11_handle_delete_bearer_response(gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s11_handle_release_access_bearers_request( +void sgw_s11_handle_release_access_bearers_request( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_release_access_bearers_request_t *req); -CORE_DECLARE(void) sgw_s11_handle_lo_dldata_notification(sgw_bearer_t *bearer); -CORE_DECLARE(void) sgw_s11_handle_downlink_data_notification_ack( +void sgw_s11_handle_lo_dldata_notification(sgw_bearer_t *bearer); +void sgw_s11_handle_downlink_data_notification_ack( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_downlink_data_notification_acknowledge_t *ack); -CORE_DECLARE(void) sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( +void sgw_s11_handle_create_indirect_data_forwarding_tunnel_request( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue, gtp_create_indirect_data_forwarding_tunnel_request_t *req); -CORE_DECLARE(void) sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request( +void sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request( gtp_xact_t *s11_xact, sgw_ue_t *sgw_ue); #ifdef __cplusplus } diff --git a/src/sgw/sgw_s5c_handler.c b/src/sgw/sgw_s5c_handler.c index 3954b3586..c074ec257 100644 --- a/src/sgw/sgw_s5c_handler.c +++ b/src/sgw/sgw_s5c_handler.c @@ -1,14 +1,9 @@ -#define TRACE_MODULE _sgw_s5c_handler - -#include "core_debug.h" -#include "core_lib.h" - #include "gtp/gtp_conv.h" #include "gtp/gtp_types.h" #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" -#include "common/context.h" +#include "app/context.h" #include "sgw_event.h" #include "sgw_context.h" #include "sgw_gtp_path.h" @@ -17,13 +12,13 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message) { - status_t rv; + int rv; gtp_node_t *pgw = NULL; gtp_xact_t *s11_xact = NULL; sgw_bearer_t *bearer = NULL; sgw_tunnel_t *s1u_tunnel = NULL, *s5u_tunnel = NULL; gtp_create_session_response_t *rsp = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; sgw_ue_t *sgw_ue = NULL; gtp_f_teid_t *pgw_s5c_teid = NULL; @@ -32,67 +27,67 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, gtp_f_teid_t sgw_s1u_teid; int len; - d_assert(sess, return, "Null param"); + ogs_assert(sess); sgw_ue = sess->sgw_ue; - d_assert(sgw_ue, return, "Null param"); - d_assert(s5c_xact, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s5c_xact); s11_xact = s5c_xact->assoc_xact; - d_assert(s11_xact, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(gtp_message); - d_trace(3, "[SGW] Create Session Response\n"); + ogs_debug("[SGW] Create Session Response"); rsp = >p_message->create_session_response; if (rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface. presence == 0) { - d_error("No GTP TEID"); + ogs_error("No GTP TEID"); return; } if (rsp->bearer_contexts_created.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (rsp->bearer_contexts_created.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } if (rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.presence == 0) { - d_error("No GTP TEID"); + ogs_error("No GTP TEID"); return; } bearer = sgw_bearer_find_by_sess_ebi(sess, rsp->bearer_contexts_created.eps_bearer_id.u8); - d_assert(bearer, return, "No Bearer Context"); + ogs_assert(bearer); s1u_tunnel = sgw_s1u_tunnel_in_bearer(bearer); - d_assert(s1u_tunnel, return, "No Tunnel Context"); + ogs_assert(s1u_tunnel); s5u_tunnel = sgw_s5u_tunnel_in_bearer(bearer); - d_assert(s5u_tunnel, return, "No Tunnel Context"); + ogs_assert(s5u_tunnel); /* Receive Control Plane(UL) : PGW-S5C */ pgw_s5c_teid = rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface. data; - d_assert(pgw_s5c_teid, return, "Null param"); + ogs_assert(pgw_s5c_teid); sess->pgw_s5c_teid = ntohl(pgw_s5c_teid->teid); rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface. presence = 0; /* Receive Data Plane(UL) : PGW-S5U */ pgw_s5u_teid = rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.data; - d_assert(pgw_s5u_teid, return, "Null param"); + ogs_assert(pgw_s5u_teid); s5u_tunnel->remote_teid = ntohl(pgw_s5u_teid->teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]\n", + ogs_debug(" ENB_S1U_TEID[%d] SGW_S1U_TEID[%d]", s1u_tunnel->remote_teid, s1u_tunnel->local_teid); - d_trace(5, " SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]\n", + ogs_debug(" SGW_S5U_TEID[%d] PGW_S5U_TEID[%d]", s5u_tunnel->local_teid, s5u_tunnel->remote_teid); pgw = gtp_find_node(&sgw_self()->pgw_s5u_list, pgw_s5u_teid); @@ -100,13 +95,14 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, { pgw = gtp_add_node(&sgw_self()->pgw_s5u_list, pgw_s5u_teid, sgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(pgw, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(pgw); - rv = gtp_client(pgw); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect( + sgw_self()->gtpu_sock, sgw_self()->gtpu_sock6, pgw); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(s5u_tunnel, pgw); @@ -120,7 +116,7 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, sgw_s11_teid.teid = htonl(sgw_ue->sgw_s11_teid); rv = gtp_sockaddr_to_f_teid( sgw_self()->gtpc_addr, sgw_self()->gtpc_addr6, &sgw_s11_teid, &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); rsp->sender_f_teid_for_control_plane.presence = 1; rsp->sender_f_teid_for_control_plane.data = &sgw_s11_teid; rsp->sender_f_teid_for_control_plane.len = len; @@ -131,170 +127,171 @@ void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, sgw_s1u_teid.teid = htonl(s1u_tunnel->local_teid); rv = gtp_sockaddr_to_f_teid( sgw_self()->gtpu_addr, sgw_self()->gtpu_addr6, &sgw_s1u_teid, &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); rsp->bearer_contexts_created.s1_u_enodeb_f_teid.presence = 1; rsp->bearer_contexts_created.s1_u_enodeb_f_teid.data = &sgw_s1u_teid; rsp->bearer_contexts_created.s1_u_enodeb_f_teid.len = len; rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); gtp_message->h.type = GTP_CREATE_SESSION_RESPONSE_TYPE; gtp_message->h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s11_xact, >p_message->h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s5c_handle_delete_session_response(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message) { - status_t rv; + int rv; gtp_xact_t *s11_xact = NULL; gtp_delete_session_response_t *rsp = NULL; - pkbuf_t *pkbuf = NULL; - c_uint32_t mme_s11_teid; + ogs_pkbuf_t *pkbuf = NULL; + uint32_t mme_s11_teid; gtp_cause_t *cause = NULL; sgw_ue_t *sgw_ue = NULL; - d_assert(sess, return, "Null param"); + ogs_assert(sess); sgw_ue = sess->sgw_ue; - d_assert(s5c_xact, return, "Null param"); + ogs_assert(s5c_xact); s11_xact = s5c_xact->assoc_xact; - d_assert(s11_xact, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(s11_xact); + ogs_assert(gtp_message); rsp = >p_message->delete_session_response; if (rsp->cause.presence == 0) { - d_error("No Cause"); + ogs_error("No Cause"); return; } cause = rsp->cause.data; - d_assert(cause, return, "Null param"); + ogs_assert(cause); /* Remove a pgw session */ if (sess) { - d_trace(3, "[SGW] Delete Session Response\n", - sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Delete Session Response"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); /* backup sgw_s5c_teid in session context */ mme_s11_teid = sgw_ue->mme_s11_teid; - if (sgw_sess_remove(sess) != CORE_OK) + if (sgw_sess_remove(sess) != OGS_OK) { - d_error("Error on PGW session %d removal", sess->index); + ogs_error("Error on PGW session removal"); cause->value = GTP_CAUSE_CONTEXT_NOT_FOUND; } } else { cause->value = GTP_CAUSE_INVALID_PEER; + ogs_error("Cannot find session"); + return; } rv = gtp_xact_commit(s5c_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); gtp_message->h.type = GTP_DELETE_SESSION_RESPONSE_TYPE; gtp_message->h.teid = mme_s11_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_update_tx(s11_xact, >p_message->h, pkbuf); - d_assert(rv == CORE_OK, return, "gtp_xact_update_tx error"); + ogs_assert(rv == OGS_OK); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s5c_handle_create_bearer_request(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message) { - status_t rv; + int rv; gtp_node_t *pgw = NULL; gtp_xact_t *s11_xact = NULL; sgw_bearer_t *bearer = NULL; sgw_tunnel_t *s1u_tunnel = NULL, *s5u_tunnel = NULL; gtp_create_bearer_request_t *req = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; sgw_ue_t *sgw_ue = NULL; gtp_f_teid_t *pgw_s5u_teid = NULL; gtp_f_teid_t sgw_s1u_teid; int len; - d_assert(sess, return, "Null param"); + ogs_assert(sess); sgw_ue = sess->sgw_ue; - d_assert(sgw_ue, return, "Null param"); - d_assert(s5c_xact, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s5c_xact); + ogs_assert(gtp_message); req = >p_message->create_bearer_request; - d_trace(3, "[SGW] Create Bearer Request\n", - sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Create Bearer Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); if (req->linked_eps_bearer_id.presence == 0) { - d_error("No Linked EBI"); + ogs_error("No Linked EBI"); return; } if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } if (req->bearer_contexts.s5_s8_u_sgw_f_teid.presence == 0) { - d_error("No GTP TEID"); + ogs_error("No GTP TEID"); return; } bearer = sgw_bearer_add(sess); - d_assert(bearer, return, "No Bearer Context"); + ogs_assert(bearer); s1u_tunnel = sgw_s1u_tunnel_in_bearer(bearer); - d_assert(s1u_tunnel, return, "No Tunnel Context"); + ogs_assert(s1u_tunnel); s5u_tunnel = sgw_s5u_tunnel_in_bearer(bearer); - d_assert(s5u_tunnel, return, "No Tunnel Context"); + ogs_assert(s5u_tunnel); /* Receive Data Plane(UL) : PGW-S5U */ pgw_s5u_teid = req->bearer_contexts.s5_s8_u_sgw_f_teid.data; - d_assert(pgw_s5u_teid, return, "Null param"); + ogs_assert(pgw_s5u_teid); s5u_tunnel->remote_teid = ntohl(pgw_s5u_teid->teid); pgw = gtp_find_node(&sgw_self()->pgw_s5u_list, pgw_s5u_teid); if (!pgw) { pgw = gtp_add_node(&sgw_self()->pgw_s5u_list, pgw_s5u_teid, sgw_self()->gtpu_port, - context_self()->parameter.no_ipv4, - context_self()->parameter.no_ipv6, - context_self()->parameter.prefer_ipv4); - d_assert(pgw, return,); + context_self()->config.parameter.no_ipv4, + context_self()->config.parameter.no_ipv6, + context_self()->config.parameter.prefer_ipv4); + ogs_assert(pgw); - rv = gtp_client(pgw); - d_assert(rv == CORE_OK, return,); + rv = gtp_connect( + sgw_self()->gtpu_sock, sgw_self()->gtpu_sock6, pgw); + ogs_assert(rv == OGS_OK); } /* Setup GTP Node */ SETUP_GTP_NODE(s5u_tunnel, pgw); @@ -308,7 +305,7 @@ void sgw_s5c_handle_create_bearer_request(gtp_xact_t *s5c_xact, sgw_s1u_teid.teid = htonl(s1u_tunnel->local_teid); rv = gtp_sockaddr_to_f_teid( sgw_self()->gtpu_addr, sgw_self()->gtpu_addr6, &sgw_s1u_teid, &len); - d_assert(rv == CORE_OK, return,); + ogs_assert(rv == OGS_OK); req->bearer_contexts.s1_u_enodeb_f_teid.presence = 1; req->bearer_contexts.s1_u_enodeb_f_teid.data = &sgw_s1u_teid; req->bearer_contexts.s1_u_enodeb_f_teid.len = len; @@ -317,49 +314,48 @@ void sgw_s5c_handle_create_bearer_request(gtp_xact_t *s5c_xact, gtp_message->h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); s11_xact = gtp_xact_local_create(sgw_ue->gnode, >p_message->h, pkbuf); - d_assert(s11_xact, return, "Null param"); + ogs_assert(s11_xact); gtp_xact_associate(s5c_xact, s11_xact); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } void sgw_s5c_handle_update_bearer_request(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message) { - status_t rv; + int rv; gtp_xact_t *s11_xact = NULL; gtp_update_bearer_request_t *req = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; sgw_ue_t *sgw_ue = NULL; - d_assert(sess, return, "Null param"); + ogs_assert(sess); sgw_ue = sess->sgw_ue; - d_assert(sgw_ue, return, "Null param"); - d_assert(s5c_xact, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s5c_xact); + ogs_assert(gtp_message); - d_trace(3, "[SGW] Update Bearer Request\n", - sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Update Bearer Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); req = >p_message->update_bearer_request; if (req->bearer_contexts.presence == 0) { - d_error("No Bearer"); + ogs_error("No Bearer"); return; } if (req->bearer_contexts.eps_bearer_id.presence == 0) { - d_error("No EPS Bearer ID"); + ogs_error("No EPS Bearer ID"); return; } @@ -367,46 +363,45 @@ void sgw_s5c_handle_update_bearer_request(gtp_xact_t *s5c_xact, gtp_message->h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); s11_xact = gtp_xact_local_create(sgw_ue->gnode, >p_message->h, pkbuf); - d_assert(s11_xact, return, "Null param"); + ogs_assert(s11_xact); gtp_xact_associate(s5c_xact, s11_xact); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); - d_trace(3, "[SGW] Update Bearer Request : SGW <-- PGW\n"); + ogs_debug("[SGW] Update Bearer Request : SGW <-- PGW"); } void sgw_s5c_handle_delete_bearer_request(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message) { - status_t rv; + int rv; gtp_xact_t *s11_xact = NULL; gtp_delete_bearer_request_t *req = NULL; - pkbuf_t *pkbuf = NULL; + ogs_pkbuf_t *pkbuf = NULL; sgw_ue_t *sgw_ue = NULL; - d_assert(sess, return, "Null param"); + ogs_assert(sess); sgw_ue = sess->sgw_ue; - d_assert(sgw_ue, return, "Null param"); - d_assert(s5c_xact, return, "Null param"); - d_assert(gtp_message, return, "Null param"); + ogs_assert(sgw_ue); + ogs_assert(s5c_xact); + ogs_assert(gtp_message); req = >p_message->delete_bearer_request; - d_trace(3, "[SGW] Delete Bearer Request\n", - sess->sgw_s5c_teid, sess->pgw_s5c_teid); - d_trace(5, " MME_S11_TEID[%d] SGW_S11_TEID[%d]\n", + ogs_debug("[SGW] Delete Bearer Request"); + ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]", sgw_ue->mme_s11_teid, sgw_ue->sgw_s11_teid); - d_trace(5, " SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]\n", + ogs_debug(" SGW_S5C_TEID[0x%x] PGW_S5C_TEID[0x%x]", sess->sgw_s5c_teid, sess->pgw_s5c_teid); if (req->linked_eps_bearer_id.presence == 0 && req->eps_bearer_ids.presence == 0) { - d_error("No Linked EBI or EPS Bearer ID"); + ogs_error("No Linked EBI or EPS Bearer ID"); return; } @@ -414,14 +409,14 @@ void sgw_s5c_handle_delete_bearer_request(gtp_xact_t *s5c_xact, gtp_message->h.teid = sgw_ue->mme_s11_teid; rv = gtp_build_msg(&pkbuf, gtp_message); - d_assert(rv == CORE_OK, return, "gtp build failed"); + ogs_assert(rv == OGS_OK); s11_xact = gtp_xact_local_create(sgw_ue->gnode, >p_message->h, pkbuf); - d_assert(s11_xact, return, "Null param"); + ogs_assert(s11_xact); gtp_xact_associate(s5c_xact, s11_xact); rv = gtp_xact_commit(s11_xact); - d_assert(rv == CORE_OK, return, "xact_commit error"); + ogs_assert(rv == OGS_OK); } diff --git a/src/sgw/sgw_s5c_handler.h b/src/sgw/sgw_s5c_handler.h index 27af94ecd..4fbc28466 100644 --- a/src/sgw/sgw_s5c_handler.h +++ b/src/sgw/sgw_s5c_handler.h @@ -9,16 +9,16 @@ extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(void) sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, +void sgw_s5c_handle_create_session_response(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s5c_handle_delete_session_response(gtp_xact_t *s5c_xact, +void sgw_s5c_handle_delete_session_response(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s5c_handle_create_bearer_request(gtp_xact_t *s5c_xact, +void sgw_s5c_handle_create_bearer_request(gtp_xact_t *s5c_xact, + sgw_sess_t *sess, gtp_message_t *gtp_message); +void sgw_s5c_handle_update_bearer_request(gtp_xact_t *s5c_xact, + sgw_sess_t *sess, gtp_message_t *gtp_message); +void sgw_s5c_handle_delete_bearer_request(gtp_xact_t *s5c_xact, sgw_sess_t *sess, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s5c_handle_update_bearer_request(gtp_xact_t *s5c_xact, - sgw_sess_t *sess, gtp_message_t *gtp_message); -CORE_DECLARE(void) sgw_s5c_handle_delete_bearer_request(gtp_xact_t *s5c_xact, - sgw_sess_t *sess, gtp_message_t *gtp_message); #ifdef __cplusplus } diff --git a/src/sgw/sgw_sm.c b/src/sgw/sgw_sm.c index cb701fc6d..ddea4c0d1 100644 --- a/src/sgw/sgw_sm.c +++ b/src/sgw/sgw_sm.c @@ -1,6 +1,3 @@ -#define TRACE_MODULE _sgw_sm -#include "core_debug.h" - #include "gtp/gtp_node.h" #include "sgw_context.h" @@ -10,68 +7,70 @@ #include "sgw_s11_handler.h" #include "sgw_s5c_handler.h" -void sgw_state_initial(fsm_t *s, event_t *e) +void sgw_state_initial(ogs_fsm_t *s, sgw_event_t *e) { - sgw_sm_trace(3, e); + sgw_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); - FSM_TRAN(s, &sgw_state_operational); + OGS_FSM_TRAN(s, &sgw_state_operational); } -void sgw_state_final(fsm_t *s, event_t *e) +void sgw_state_final(ogs_fsm_t *s, sgw_event_t *e) { - sgw_sm_trace(3, e); + sgw_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); } -void sgw_state_operational(fsm_t *s, event_t *e) +void sgw_state_operational(ogs_fsm_t *s, sgw_event_t *e) { - status_t rv; + int rv; - sgw_sm_trace(3, e); + sgw_sm_debug(e); - d_assert(s, return, "Null param"); + ogs_assert(s); - switch (event_get(e)) + switch (e->id) { - case FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: { rv = sgw_gtp_open(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't establish SGW path"); + ogs_error("Can't establish SGW path"); break; } break; } - case FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: { rv = sgw_gtp_close(); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("Can't close SGW path"); + ogs_error("Can't close SGW path"); break; } break; } case SGW_EVT_S11_MESSAGE: { - status_t rv; - pkbuf_t *pkbuf = (pkbuf_t *)event_get_param1(e); + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; gtp_message_t message; sgw_ue_t *sgw_ue = NULL; - d_assert(pkbuf, break,); + ogs_assert(e); + pkbuf = e->pkbuf; + ogs_assert(pkbuf); rv = gtp_parse_msg(&message, pkbuf); - d_assert(rv == CORE_OK, pkbuf_free(pkbuf); break,); + ogs_assert(rv == OGS_OK); if (message.h.teid == 0) { gtp_node_t *mme = sgw_mme_add_by_message(&message); - d_assert(mme, pkbuf_free(pkbuf); break,); + ogs_assert(mme); sgw_ue = sgw_ue_add_by_message(&message); SETUP_GTP_NODE(sgw_ue, mme); } @@ -79,12 +78,12 @@ void sgw_state_operational(fsm_t *s, event_t *e) { sgw_ue = sgw_ue_find_by_teid(message.h.teid); } - d_assert(sgw_ue, pkbuf_free(pkbuf); break,); + ogs_assert(sgw_ue); rv = gtp_xact_receive(sgw_ue->gnode, &message.h, &xact); - if (rv != CORE_OK) + if (rv != OGS_OK) { - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); break; } @@ -133,31 +132,34 @@ void sgw_state_operational(fsm_t *s, event_t *e) xact, sgw_ue); break; default: - d_warn("Not implmeneted(type:%d)", message.h.type); + ogs_warn("Not implmeneted(type:%d)", message.h.type); break; } - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); break; } case SGW_EVT_S5C_MESSAGE: { - status_t rv; - pkbuf_t *pkbuf = (pkbuf_t *)event_get_param1(e); + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_xact_t *xact = NULL; gtp_message_t message; sgw_sess_t *sess = NULL; - d_assert(pkbuf, break, "Null param"); + ogs_assert(e); + pkbuf = e->pkbuf; + + ogs_assert(pkbuf); rv = gtp_parse_msg(&message, pkbuf); - d_assert(rv == CORE_OK, pkbuf_free(pkbuf); break,); + ogs_assert(rv == OGS_OK); sess = sgw_sess_find_by_teid(message.h.teid); - d_assert(sess, pkbuf_free(pkbuf); break,); + ogs_assert(sess); rv = gtp_xact_receive(sess->gnode, &message.h, &xact); - if (rv != CORE_OK) + if (rv != OGS_OK) { - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); break; } @@ -184,28 +186,19 @@ void sgw_state_operational(fsm_t *s, event_t *e) &message); break; default: - d_warn("Not implmeneted(type:%d)", message.h.type); + ogs_warn("Not implmeneted(type:%d)", message.h.type); break; } - pkbuf_free(pkbuf); - break; - } - case SGW_EVT_T3_RESPONSE: - case SGW_EVT_T3_HOLDING: - { - gtp_xact_timeout(event_get_param1(e), event_get(e)); + ogs_pkbuf_free(pkbuf); break; } case SGW_EVT_LO_DLDATA_NOTI: { - index_t index = (index_t)event_get_param1(e); - sgw_bearer_t* bearer = sgw_bearer_find(index); + sgw_bearer_t* bearer = NULL; + ogs_assert(e); - if (!bearer) - { - d_error("Can not find bearer with index(%d)",index); - break; - } + bearer = e->bearer; + ogs_assert(bearer); sgw_s11_handle_lo_dldata_notification(bearer); @@ -213,7 +206,7 @@ void sgw_state_operational(fsm_t *s, event_t *e) } default: { - d_error("No handler for event %s", sgw_event_get_name(e)); + ogs_error("No handler for event %s", sgw_event_get_name(e)); break; } } diff --git a/src/sgw/sgw_sm.h b/src/sgw/sgw_sm.h index 006f3646d..5233b2151 100644 --- a/src/sgw/sgw_sm.h +++ b/src/sgw/sgw_sm.h @@ -1,24 +1,19 @@ #ifndef __SGW_SM_H__ #define __SGW_SM_H__ -#include "core_param.h" -#include "core_fsm.h" -#include "core_event.h" +#include "sgw_event.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -void sgw_state_initial(fsm_t *s, event_t *e); -void sgw_state_final(fsm_t *s, event_t *e); -void sgw_state_operational(fsm_t *s, event_t *e); -void sgw_state_exception(fsm_t *s, event_t *e); +void sgw_state_initial(ogs_fsm_t *s, sgw_event_t *e); +void sgw_state_final(ogs_fsm_t *s, sgw_event_t *e); +void sgw_state_operational(ogs_fsm_t *s, sgw_event_t *e); +void sgw_state_exception(ogs_fsm_t *s, sgw_event_t *e); -#define sgw_sm_print(__pe) \ - d_print("%s(): %s\n", __func__, sgw_event_get_name(__pe)) - -#define sgw_sm_trace(__l, __pe) \ - d_trace(__l, "%s(): %s\n", __func__, sgw_event_get_name(__pe)) +#define sgw_sm_debug(__pe) \ + ogs_debug("%s(): %s\n", __func__, sgw_event_get_name(__pe)) #ifdef __cplusplus } diff --git a/support/Makefile.am b/support/Makefile.am index 05fec572e..09fcb7352 100644 --- a/support/Makefile.am +++ b/support/Makefile.am @@ -1,6 +1,3 @@ ## Process this file with automake to produce Makefile.in SUBDIRS = config freeDiameter systemd logrotate newsyslog - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/support/config/Makefile.am b/support/config/Makefile.am index da3456e89..ac76e78c9 100644 --- a/support/config/Makefile.am +++ b/support/config/Makefile.am @@ -10,6 +10,3 @@ configfiles = \ configdir = ${sysconfdir}/nextepc config_DATA = ${configfiles} - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/support/config/hss.conf.in b/support/config/hss.conf.in index 6fa7df1fd..6e94bf700 100644 --- a/support/config/hss.conf.in +++ b/support/config/hss.conf.in @@ -4,9 +4,6 @@ db_uri: mongodb://localhost/nextepc logger: file: @LOCALSTATE_DIR@/log/nextepc/hss.log - trace: - app: 1 - diameter: 1 parameter: diff --git a/support/config/mme.conf.in b/support/config/mme.conf.in index 682085cb1..b2b094ce5 100644 --- a/support/config/mme.conf.in +++ b/support/config/mme.conf.in @@ -2,12 +2,6 @@ logger: file: @LOCALSTATE_DIR@/log/nextepc/mme.log - trace: - app: 1 - s1ap: 1 - nas: 1 - diameter: 1 - gtpv2: 1 parameter: diff --git a/support/config/nextepc.conf.in b/support/config/nextepc.conf.in index e4745638f..f63e49105 100644 --- a/support/config/nextepc.conf.in +++ b/support/config/nextepc.conf.in @@ -2,13 +2,24 @@ db_uri: mongodb://localhost/nextepc logger: file: @LOCALSTATE_DIR@/log/nextepc/nextepc.log - trace: - app: 1 - s1ap: 1 - nas: 1 - diameter: 1 - gtpv2: 1 - gtp: 1 +# +# o Set OGS_LOG_INFO to all domain level +# - If `level` is omitted, the default level is OGS_LOG_INFO) +# - If `domain` is omitted, the all domain level is set from 'level' +# (Nothing is needed) +# +# o Set OGS_LOG_ERROR to all domain level +# - `level` can be set with none, fatal, error, warn, info, debug, trace +# level: error +# +# o Set OGS_LOG_DEBUG to mme/emm domain level +# level: debug +# domain: mme,emm +# +# o Set OGS_LOG_TRACE to all domain level +# level: trace +# domain: core,s1ap,nas,fd,gtp,mme,emm,esm,sgw,pgw,hss,pcrf,event,tlv,mem,sock +# # # parameter: diff --git a/support/config/pcrf.conf.in b/support/config/pcrf.conf.in index 876d91d7c..8cf9cb354 100644 --- a/support/config/pcrf.conf.in +++ b/support/config/pcrf.conf.in @@ -4,9 +4,6 @@ db_uri: mongodb://localhost/nextepc logger: file: @LOCALSTATE_DIR@/log/nextepc/pcrf.log - trace: - app: 1 - diameter: 1 parameter: diff --git a/support/config/pgw.conf.in b/support/config/pgw.conf.in index a6f56574f..980eb22b8 100644 --- a/support/config/pgw.conf.in +++ b/support/config/pgw.conf.in @@ -2,11 +2,6 @@ logger: file: @LOCALSTATE_DIR@/log/nextepc/pgw.log - trace: - app: 1 - diameter: 1 - gtpv2: 1 - gtp: 1 parameter: diff --git a/support/config/sgw.conf.in b/support/config/sgw.conf.in index e94861974..cd67ed278 100644 --- a/support/config/sgw.conf.in +++ b/support/config/sgw.conf.in @@ -2,10 +2,6 @@ logger: file: @LOCALSTATE_DIR@/log/nextepc/sgw.log - trace: - app: 1 - gtpv2: 1 - gtp: 1 parameter: no_ipv6: true diff --git a/support/freeDiameter/Makefile.am b/support/freeDiameter/Makefile.am index 6ac64f1c3..4aca9412d 100644 --- a/support/freeDiameter/Makefile.am +++ b/support/freeDiameter/Makefile.am @@ -1,3 +1,15 @@ +EXTRA_DIST = \ + cacert.pem \ + hss.key.pem \ + mme.key.pem \ + pcrf.key.pem \ + pgw.key.pem \ + hss.cert.pem \ + mme.cert.pem \ + pcrf.cert.pem \ + pgw.cert.pem \ + $(NULL) + configfiles = \ mme.conf \ hss.conf \ @@ -20,6 +32,3 @@ pemfiles = \ freeDiameterdir = ${sysconfdir}/nextepc/freeDiameter freeDiameter_DATA = ${configfiles} ${pemfiles} - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/support/logrotate/Makefile.am b/support/logrotate/Makefile.am index 1030be101..ec120d322 100644 --- a/support/logrotate/Makefile.am +++ b/support/logrotate/Makefile.am @@ -1,4 +1 @@ EXTRA_DIST = nextepc.in - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/support/newsyslog/Makefile.am b/support/newsyslog/Makefile.am index 35733477a..ce8450860 100644 --- a/support/newsyslog/Makefile.am +++ b/support/newsyslog/Makefile.am @@ -1,4 +1 @@ EXTRA_DIST = nextepc.conf.in - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/support/systemd/Makefile.am b/support/systemd/Makefile.am index 1800791ea..3a2c5f5e5 100644 --- a/support/systemd/Makefile.am +++ b/support/systemd/Makefile.am @@ -5,6 +5,3 @@ EXTRA_DIST = \ nextepc-pcrfd.service.in \ nextepc-sgwd.service.in \ $(NULL) - -MAINTAINERCLEANFILES = Makefile.in -MOSTLYCLEANFILES = *.stackdump diff --git a/test/Makefile.am b/test/Makefile.am index c3cdbdd50..b2f78a332 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,41 +1,55 @@ ## Process this file with automake to produce Makefile.in. -bin_PROGRAMS = testepc testvolte +bin_PROGRAMS = testunit testsimple testcomplex testvolte configdir = ${sysconfdir}/nextepc/test -config_DATA = sample.conf sample-volte.conf +config_DATA = sample.conf sample-simple.conf sample-volte.conf -testepc_SOURCES = \ - common/abts.h common/abts.c \ - common/testpacket.h common/testpacket.c common/testutil.h \ - basic/testutil.c basic/s1ap_message_test.c basic/nas_message_test.c \ - basic/gtp_message_test.c basic/security_test.c basic/s1setup_test.c \ - basic/attach_test.c basic/volte_test.c basic/handover_test.c \ +testunit_SOURCES = \ + common/testpacket.h common/testpacket.c \ + unit/abts-main.c \ + unit/s1ap_message_test.c unit/nas_message_test.c \ + unit/gtp_message_test.c unit/security_test.c \ $(NULL) +testunit_LDADD = $(top_srcdir)/src/libepc.la + +if !WITH_USRSCTP +testunit_SOURCES += unit/sctp-test.c +endif + +testsimple_SOURCES = \ + common/testpacket.h common/testpacket.c \ + simple/abts-main.c \ + simple/mnc3-test.c \ + $(NULL) +testsimple_LDADD = $(top_srcdir)/src/libepc.la + +testcomplex_SOURCES = \ + common/testpacket.h common/testpacket.c \ + complex/abts-main.c \ + complex/s1setup_test.c \ + complex/attach_test.c complex/volte_test.c complex/handover_test.c \ + $(NULL) +testcomplex_LDADD = $(top_srcdir)/src/libepc.la testvolte_SOURCES = \ - common/abts.h common/abts.c \ - common/testpacket.h common/testpacket.c common/testutil.h \ - volte/testutil.c volte/testapp.h volte/testapp.c volte/pcscf_fd_path.c \ + common/testpacket.h common/testpacket.c \ + volte/abts-main.c \ + volte/testapp.h volte/testapp.c \ + volte/pcscf_fd_path.h volte/pcscf_fd_path.c \ volte/volte_test.c \ $(NULL) - -LDADD = \ - $(top_srcdir)/src/libepc.la \ - $(NULL) - -DEPENDENCIES = \ - $(top_srcdir)/src/libepc.la \ - $(NULL) +testvolte_LDADD = $(top_srcdir)/src/libepc.la AM_CPPFLAGS = \ - -I$(top_srcdir)/lib/core/include \ + @OGSCORE_CFLAGS@ \ + @MONGOC_CFLAGS@ \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src \ - -I$(top_srcdir)/lib/s1ap/asn1c \ + -I$(top_srcdir)/lib/asn1c/common \ + -I$(top_srcdir)/lib/asn1c/s1ap \ -I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \ -I$(top_srcdir)/test/common \ - @MONGOC_CFLAGS@ \ $(NULL) AM_CFLAGS = \ @@ -62,7 +76,7 @@ clean-local: test ! -f '$(TESTSUITE)' || \ $(SHELL) '$(TESTSUITE)' --clean -AUTOM4TE = $(SHELL) $(top_srcdir)/build-aux/missing --run autom4te +AUTOM4TE = $(SHELL) $(top_srcdir)/build/missing --run autom4te AUTOTEST = $(AUTOM4TE) --language=autotest $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at diff --git a/test/basic/s1setup_test.c b/test/basic/s1setup_test.c deleted file mode 100644 index 966ca9aa1..000000000 --- a/test/basic/s1setup_test.c +++ /dev/null @@ -1,112 +0,0 @@ -#include "core_debug.h" -#include "core_pkbuf.h" - -#include "3gpp_types.h" - -#include "mme/s1ap_build.h" -#include "mme/s1ap_conv.h" - -#include "testutil.h" -#include "testpacket.h" - -#define NUM_OF_TEST_DUPLICATED_ENB 4 - -static void s1setup_test1(abts_case *tc, void *data) -{ - status_t rv; - sock_id sock[NUM_OF_TEST_DUPLICATED_ENB]; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - s1ap_message_t message; - int i; - - for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) - { - rv = tests1ap_enb_connect(&sock[i]); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - } - - for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) - { - rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = tests1ap_enb_send(sock[i], sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = tests1ap_enb_read(sock[i], recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - s1ap_free_pdu(&message); - } - - for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) - { - rv = tests1ap_enb_close(sock[i]); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - } - - pkbuf_free(recvbuf); - - core_sleep(time_from_msec(300)); -} - -#define NUM_OF_TEST_ENB 4 - -static void s1setup_test2(abts_case *tc, void *data) -{ - status_t rv; - sock_id sock[NUM_OF_TEST_ENB]; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - s1ap_message_t message; - int i; - - for (i = 0; i < NUM_OF_TEST_ENB; i++) - { - rv = tests1ap_enb_connect(&sock[i]); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - } - - for (i = 0; i < NUM_OF_TEST_ENB; i++) - { - rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, i); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = tests1ap_enb_send(sock[i], sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = tests1ap_enb_read(sock[i], recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - - s1ap_free_pdu(&message); - } - - for (i = 0; i < NUM_OF_TEST_ENB; i++) - { - rv = tests1ap_enb_close(sock[i]); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - } - - pkbuf_free(recvbuf); - - core_sleep(time_from_sec(1)); -} - -abts_suite *test_s1setup(abts_suite *suite) -{ - suite = ADD_SUITE(suite) - - abts_run_test(suite, s1setup_test1, NULL); - abts_run_test(suite, s1setup_test2, NULL); - - return suite; -} diff --git a/test/basic/testutil.c b/test/basic/testutil.c deleted file mode 100644 index bb0571796..000000000 --- a/test/basic/testutil.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core_general.h" -#include "core_debug.h" -#include "core_semaphore.h" -#include "fd/fd_lib.h" - -#include "common/application.h" -#include "common/context.h" - -#include "app_init.h" - -#include "testpacket.h" -#include "abts.h" -#include "testutil.h" - -abts_suite *test_s1ap_message(abts_suite *suite); -abts_suite *test_nas_message(abts_suite *suite); -abts_suite *test_gtp_message(abts_suite *suite); -abts_suite *test_security(abts_suite *suite); -abts_suite *test_s1setup(abts_suite *suite); -abts_suite *test_attach(abts_suite *suite); -abts_suite *test_volte(abts_suite *suite); -abts_suite *test_handover(abts_suite *suite); - -const struct testlist alltests[] = { - {test_s1ap_message}, - {test_nas_message}, - {test_gtp_message}, - {test_security}, - {test_s1setup}, - {test_attach}, - {test_volte}, - {test_handover}, - {NULL}, -}; - -static int connected_count = 0; -static void test_fd_logger_handler(enum fd_hook_type type, struct msg * msg, - struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, - void * regdata) -{ - if (type == HOOK_PEER_CONNECT_SUCCESS) - { - connected_count++; - } -} - -void test_terminate(void) -{ - testpacket_final(); - app_terminate(); - - d_trace_global_on(); - core_terminate(); -} - -status_t test_initialize(int argc, const char *const argv[], char *config_path) -{ - status_t rv; - - fd_logger_register(test_fd_logger_handler); - - atexit(test_terminate); - - core_initialize(); - rv = app_initialize(config_path, NULL, NULL); - if (rv != CORE_OK) - { - d_error("app_initialize() failed"); - return CORE_ERROR; - } - rv = testpacket_init(); - if (rv != CORE_OK) - { - d_error("testpacket() failed"); - return CORE_ERROR; - } - - while(1) - { - if (connected_count == 1) break; - core_sleep(time_from_msec(50)); - } - - return rv; -} - diff --git a/test/common/abts.c b/test/common/abts.c deleted file mode 100644 index ab1a2defc..000000000 --- a/test/common/abts.c +++ /dev/null @@ -1,501 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "abts.h" -#include "testutil.h" - -#include "core_debug.h" -#include "core_pkbuf.h" - -#define ABTS_STAT_SIZE 6 -static char status[ABTS_STAT_SIZE] = {'|', '/', '-', '|', '\\', '-'}; -static int curr_char; -static int verbose = 1; -static int exclude = 0; -static int quiet = 0; -static int list_tests = 0; -int test_only_control_plane = 0; - -const char **testlist = NULL; -extern const struct testlist alltests[]; - -static int find_test_name(const char *testname) { - int i; - for (i = 0; testlist[i] != NULL; i++) { - if (!strcmp(testlist[i], testname)) { - return 1; - } - } - return 0; -} - -/* Determine if the test should be run at all */ -static int should_test_run(const char *testname) { - int found = 0; - if (list_tests == 1) { - return 0; - } - if (testlist == NULL) { - return 1; - } - found = find_test_name(testname); - if ((found && !exclude) || (!found && exclude)) { - return 1; - } - return 0; -} - -static void reset_status(void) -{ - curr_char = 0; -} - -static void update_status(void) -{ - if (!quiet) { - curr_char = (curr_char + 1) % ABTS_STAT_SIZE; - fprintf(stdout, "\b%c", status[curr_char]); - fflush(stdout); - } -} - -static void end_suite(abts_suite *suite) -{ - if (suite != NULL) { - sub_suite *last = suite->tail; - if (!quiet) { - fprintf(stdout, "\b"); - fflush(stdout); - } - if (last->failed == 0) { - fprintf(stdout, "SUCCESS\n"); - fflush(stdout); - } - else { - fprintf(stdout, "FAILED %d of %d\n", last->failed, last->num_test); - fflush(stdout); - } - } -} - -abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full) -{ - sub_suite *subsuite; - char *p; - const char *suite_name; - curr_char = 0; - - /* Only end the suite if we actually ran it */ - if (suite && suite->tail &&!suite->tail->not_run) { - end_suite(suite); - } - - subsuite = core_malloc(sizeof(*subsuite)); - subsuite->num_test = 0; - subsuite->failed = 0; - subsuite->next = NULL; - /* suite_name_full may be an absolute path depending on __FILE__ - * expansion */ - suite_name = strrchr(suite_name_full, '/'); - if (suite_name) { - suite_name++; - } else { - suite_name = suite_name_full; - } - p = strrchr(suite_name, '.'); - if (p) { - subsuite->name = memcpy(core_calloc(p - suite_name + 1, 1), - suite_name, p - suite_name); - } - else { - subsuite->name = suite_name; - } - - if (list_tests) { - fprintf(stdout, "%s\n", subsuite->name); - } - - subsuite->not_run = 0; - - if (suite == NULL) { - suite = core_malloc(sizeof(*suite)); - suite->head = subsuite; - suite->tail = subsuite; - } - else { - suite->tail->next = subsuite; - suite->tail = subsuite; - } - - if (!should_test_run(subsuite->name)) { - subsuite->not_run = 1; - return suite; - } - - reset_status(); - fprintf(stdout, "%-20s: ", subsuite->name); - update_status(); - fflush(stdout); - - return suite; -} - -void abts_run_test(abts_suite *ts, test_func f, void *value) -{ - abts_case tc; - sub_suite *ss; - - if (!should_test_run(ts->tail->name)) { - return; - } - ss = ts->tail; - - tc.failed = 0; - tc.suite = ss; - - ss->num_test++; - update_status(); - - f(&tc, value); - - if (tc.failed) { - ss->failed++; - } -} - -static int report(abts_suite *suite) -{ - int count = 0; - sub_suite *dptr; - - if (suite && suite->tail &&!suite->tail->not_run) { - end_suite(suite); - } - - for (dptr = suite->head; dptr; dptr = dptr->next) { - count += dptr->failed; - } - - if (list_tests) { - return 0; - } - - if (count == 0) { - printf("All tests passed.\n"); - return 0; - } - - dptr = suite->head; - fprintf(stdout, "%-15s\t\tTotal\tFail\tFailed %%\n", "Failed Tests"); - fprintf(stdout, "===================================================\n"); - while (dptr != NULL) { - if (dptr->failed != 0) { - float percent = ((float)dptr->failed / (float)dptr->num_test); - fprintf(stdout, "%-15s\t\t%5d\t%4d\t%6.2f%%\n", dptr->name, - dptr->num_test, dptr->failed, percent * 100); - } - dptr = dptr->next; - } - return 1; -} - -static void abts_free(abts_suite *suite) -{ - sub_suite *ptr = NULL, *next_ptr = NULL; - - ptr = suite->head; - while (ptr != NULL) { - next_ptr = ptr->next; - - CORE_FREE((void*)ptr->name); - CORE_FREE(ptr); - ptr = next_ptr; - } - - CORE_FREE(suite); -} - -void abts_log_message(const char *fmt, ...) -{ - va_list args; - update_status(); - - if (verbose) { - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); - fflush(stderr); - } -} - -void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected != actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_size_equal(abts_case *tc, size_t expected, size_t actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - /* Note that the comparison is type-exact, reporting must be a best-fit */ - fprintf(stderr, "Line %d: expected %lu, but saw %lu\n", lineno, - (unsigned long)expected, (unsigned long)actual); - fflush(stderr); - } -} - -void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!expected && !actual) return; - if (expected && actual) - if (!strcmp(expected, actual)) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_str_nequal(abts_case *tc, const char *expected, const char *actual, - size_t n, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!strncmp(expected, actual, n)) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_ptr_null(abts_case *tc, const void *ptr, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (ptr == NULL) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Expected NULL, but saw <%p>\n", lineno, ptr); - fflush(stderr); - } -} - -void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (ptr != NULL) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Expected not NULL, but saw <%p>\n", lineno, ptr); - fflush(stderr); - } -} - -void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%p>, but saw <%p>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_fail(abts_case *tc, const char *message, int lineno) -{ - update_status(); - if (tc->failed) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -void abts_assert(abts_case *tc, const char *message, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -void abts_true(abts_case *tc, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Condition is false, but expected true\n", lineno); - fflush(stderr); - } -} - -void abts_false(abts_case *tc, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Condition is true, but expected false\n", lineno); - fflush(stderr); - } -} - -void abts_not_impl(abts_case *tc, const char *message, int lineno) -{ - update_status(); - - tc->suite->not_impl++; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -int main(int argc, const char *const argv[]) { - int i; - int rv; - int list_provided = 0; - abts_suite *suite = NULL; - const char *config_path = NULL; - - d_trace_global_off(); - d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_ERROR); - - quiet = !isatty(STDOUT_FILENO); - - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-v")) { - verbose = 1; - continue; - } - if (!strcmp(argv[i], "-x")) { - exclude = 1; - continue; - } - if (!strcmp(argv[i], "-l")) { - list_tests = 1; - continue; - } - if (!strcmp(argv[i], "-q")) { - quiet = 1; - continue; - } - if (!strcmp(argv[i], "-t")) { - d_trace_global_on(); - d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FULL); - continue; - } - if (!strcmp(argv[i], "-f")) { - config_path = argv[++i]; - continue; - } - if (!strcmp(argv[i], "-c")) { - test_only_control_plane = 1; - continue; - } - if (argv[i][0] == '-') { - fprintf(stderr, "Invalid option: `%s'\n", argv[i]); - exit(1); - } - list_provided = 1; - } - - rv = test_initialize(argc, argv, (char*)config_path); - if (rv != CORE_OK) - return EXIT_FAILURE; - - if (list_provided) { - /* Waste a little space here, because it is easier than counting the - * number of tests listed. Besides it is at most three char *. - */ - testlist = core_calloc(argc + 1, sizeof(char *)); - for (i = 1; i < argc; i++) { - testlist[i - 1] = argv[i]; - } - } - - for (i = 0; alltests[i].func; i++) { - suite = alltests[i].func(suite); - } - - rv = report(suite); - - abts_free(suite); - - CORE_FREE(testlist); - return rv; -} - diff --git a/test/common/abts.h b/test/common/abts.h deleted file mode 100644 index 9fb6b0db7..000000000 --- a/test/common/abts.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#ifdef WIN32 -#include -#else -#include -#endif - -#ifndef ABTS_H -#define ABTS_H - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -struct sub_suite { - const char *name; - int num_test; - int failed; - int not_run; - int not_impl; - struct sub_suite *next; -}; -typedef struct sub_suite sub_suite; - -struct abts_suite { - sub_suite *head; - sub_suite *tail; -}; -typedef struct abts_suite abts_suite; - -struct abts_case { - int failed; - sub_suite *suite; -}; -typedef struct abts_case abts_case; - -struct testlist { - abts_suite *(*func)(abts_suite *suite); -}; - -typedef void (*test_func)(abts_case *tc, void *data); - -#define ADD_SUITE(suite) abts_add_suite(suite, __FILE__); - -abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name); -void abts_run_test(abts_suite *ts, test_func f, void *value); -void abts_log_message(const char *fmt, ...); - -void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno); -void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno); -void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno); -void abts_str_nequal(abts_case *tc, const char *expected, const char *actual, - size_t n, int lineno); -void abts_ptr_null(abts_case *tc, const void *ptr, int lineno); -void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno); -void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno); -void abts_true(abts_case *tc, int condition, int lineno); -void abts_false(abts_case *tc, int condition, int lineno); -void abts_fail(abts_case *tc, const char *message, int lineno); -void abts_not_impl(abts_case *tc, const char *message, int lineno); -void abts_assert(abts_case *tc, const char *message, int condition, int lineno); -void abts_size_equal(abts_case *tc, size_t expected, size_t actual, int lineno); - -/* Convenience macros. Ryan hates these! */ -#define ABTS_INT_EQUAL(a, b, c) abts_int_equal(a, b, c, __LINE__) -#define ABTS_INT_NEQUAL(a, b, c) abts_int_nequal(a, b, c, __LINE__) -#define ABTS_STR_EQUAL(a, b, c) abts_str_equal(a, b, c, __LINE__) -#define ABTS_STR_NEQUAL(a, b, c, d) abts_str_nequal(a, b, c, d, __LINE__) -#define ABTS_PTR_NULL(a, b) abts_ptr_null(a, b, __LINE__) -#define ABTS_PTR_NOTNULL(a, b) abts_ptr_notnull(a, b, __LINE__) -#define ABTS_PTR_EQUAL(a, b, c) abts_ptr_equal(a, b, c, __LINE__) -#define ABTS_TRUE(a, b) abts_true(a, b, __LINE__); -#define ABTS_FALSE(a, b) abts_false(a, b, __LINE__); -#define ABTS_FAIL(a, b) abts_fail(a, b, __LINE__); -#define ABTS_NOT_IMPL(a, b) abts_not_impl(a, b, __LINE__); -#define ABTS_ASSERT(a, b, c) abts_assert(a, b, c, __LINE__); - -#define ABTS_SIZE_EQUAL(a, b, c) abts_size_equal(a, b, c, __LINE__) - - -abts_suite *run_tests(abts_suite *suite); -abts_suite *run_tests1(abts_suite *suite); - - -#endif - -#ifdef __cplusplus -} -#endif - diff --git a/test/common/testpacket.c b/test/common/testpacket.c index a3132009f..3b53ecc8b 100644 --- a/test/common/testpacket.c +++ b/test/common/testpacket.c @@ -1,8 +1,21 @@ -#define TRACE_MODULE _testpacket -#include "core_debug.h" -#include "core_lib.h" +#include "base/base.h" +#if HAVE_NETINET_IP_H +#include +#endif + +#if HAVE_NETINET_IP6_H +#include +#endif + +#if HAVE_NETINET_IP_ICMP_H +#include +#endif + +#if HAVE_NETINET_ICMP6_H +#include +#endif #include "mme/s1ap_build.h" #include "mme/s1ap_conv.h" #include "mme/s1ap_path.h" @@ -13,116 +26,168 @@ #include "gtp/gtp_node.h" #include "gtp/gtp_path.h" -#include "common/context.h" +#include "mme/ogs-sctp.h" +#include "app/context.h" -extern int test_only_control_plane; - -#define TEST_ENB1_ADDR "127.0.0.5" -#define TEST_ENB2_ADDR "127.0.0.4" -#if LINUX == 1 -#define TEST_ENB1_ADDR6 "fe80::1%lo" -#else -#define TEST_ENB1_ADDR6 "fe80::1%lo0" -#endif -static c_sockaddr_t *test_enb1_addr = NULL; -static c_sockaddr_t *test_enb1_addr6 = NULL; -static c_sockaddr_t *test_enb2_addr = NULL; -static c_sockaddr_t *test_enb2_addr6 = NULL; - -static list_t s1ap_list; -static list_t s1ap_list6; - -status_t testpacket_init() +int testpacket_init() { - status_t rv; - - rv = core_getaddrinfo(&test_enb1_addr, - AF_INET, TEST_ENB1_ADDR, GTPV1_U_UDP_PORT, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); - -/* There is no default link-local address, - * If you want to test it, you need set the IPv6 address in some interface */ -#if LINUX != 1 - rv = core_getaddrinfo(&test_enb1_addr6, - AF_INET6, TEST_ENB1_ADDR6, GTPV1_U_UDP_PORT, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); -#endif - - rv = core_getaddrinfo(&test_enb2_addr, - AF_INET, TEST_ENB2_ADDR, GTPV1_U_UDP_PORT, 0); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - list_init(&s1ap_list); - list_init(&s1ap_list6); - - rv = sock_probe_node(&s1ap_list, &s1ap_list6, NULL, 36412); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; + return OGS_OK; } -status_t testpacket_final() +int testpacket_final() { - if (test_enb1_addr) + return OGS_OK; +} + +ogs_sock_t *testenb_s1ap_client(const char *ipstr) +{ + int rv; + ogs_sockaddr_t *addr = NULL; + ogs_sock_t *sock = NULL; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, ipstr, S1AP_SCTP_PORT, 0); + ogs_assert(rv == OGS_OK); + + sock = ogs_sctp_client(SOCK_STREAM, addr); + ogs_assert(sock); + + ogs_freeaddrinfo(addr); + + return sock; +} + +ogs_pkbuf_t *testenb_s1ap_read(ogs_sock_t *sock) +{ + ogs_pkbuf_t *recvbuf = NULL; + recvbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(recvbuf, MAX_SDU_LEN); + ogs_assert(OGS_OK == s1ap_recv(sock, recvbuf)); + + return recvbuf; +} + +int testenb_s1ap_send(ogs_sock_t *sock, ogs_pkbuf_t *sendbuf) +{ + return s1ap_send(sock, sendbuf, NULL, 0); +} + +int testenb_s1ap_close(ogs_sock_t *sock) +{ + s1ap_closesocket(sock); + return OGS_OK; +} + +ogs_sock_t *testenb_gtpu_server(const char *ipstr) +{ + int rv; + ogs_sockaddr_t *addr = NULL; + ogs_sock_t *sock = NULL; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, ipstr, GTPV1_U_UDP_PORT, 0); + ogs_assert(rv == OGS_OK); + + sock = ogs_udp_server(addr); + ogs_assert(sock); + + ogs_freeaddrinfo(addr); + + return sock; +} + +ogs_pkbuf_t *testenb_gtpu_read(ogs_sock_t *sock) +{ + int rc = 0; + ogs_pkbuf_t *recvbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(recvbuf, MAX_SDU_LEN); + + while(1) { - core_freeaddrinfo(test_enb1_addr); - test_enb1_addr = NULL; + rc = ogs_recv(sock->fd, recvbuf->data, recvbuf->len, 0); + if (rc == -2) + { + continue; + } + else if (rc <= 0) + { + if (errno == EAGAIN) + { + continue; + } + break; + } + else + { + break; + } + } + recvbuf->len = rc; + + return recvbuf; +} + +int testenb_gtpu_send(ogs_sock_t *sock, ogs_pkbuf_t *sendbuf) +{ + int rv; + ogs_hash_index_t *hi = NULL; + mme_ue_t *mme_ue = NULL; + mme_sess_t *sess = NULL; + mme_bearer_t *bearer = NULL; + + ogs_sockaddr_t sgw; + ssize_t sent; + + ogs_assert(sock); + + hi = mme_ue_first(); + ogs_assert(hi); + mme_ue = mme_ue_this(hi); + ogs_assert(mme_ue); + sess = mme_sess_first(mme_ue); + ogs_assert(sess); + bearer = mme_bearer_first(sess); + ogs_assert(bearer); + + memset(&sgw, 0, sizeof(ogs_sockaddr_t)); + sgw.c_sa_port = htons(GTPV1_U_UDP_PORT); + if (bearer->sgw_s1u_ip.ipv6) + { + sgw.c_sa_family = AF_INET6; + if (bearer->sgw_s1u_ip.ipv4) + memcpy(sgw.sin6.sin6_addr.s6_addr, + bearer->sgw_s1u_ip.both.addr6, IPV6_LEN); + else + memcpy(sgw.sin6.sin6_addr.s6_addr, + bearer->sgw_s1u_ip.addr6, IPV6_LEN); + rv = ogs_sock_fill_scope_id_in_local(&sgw); + ogs_assert(rv == OGS_OK); + } + else + { + sgw.c_sa_family = AF_INET; + sgw.sin.sin_addr.s_addr = bearer->sgw_s1u_ip.addr; } - if (test_enb1_addr6) - { - core_freeaddrinfo(test_enb1_addr6); - test_enb1_addr6 = NULL; - } + sent = ogs_sendto(sock->fd, sendbuf->data, sendbuf->len, 0, &sgw); + ogs_pkbuf_free(sendbuf); + if (sent < 0 || sent != sendbuf->len) + return OGS_ERROR; - if (test_enb2_addr) - { - core_freeaddrinfo(test_enb2_addr); - test_enb2_addr = NULL; - } - - sock_remove_all_nodes(&s1ap_list); - sock_remove_all_nodes(&s1ap_list6); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_enb_connect(sock_id *new) +int testenb_gtpu_close(ogs_sock_t *sock) { - status_t rv; - sock_node_t *snode = NULL; - - snode = list_first(&s1ap_list); - if (!snode) snode = list_first(&s1ap_list6); - d_assert(snode, return CORE_ERROR,); - - rv = sctp_client(new, SOCK_STREAM, snode->list); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; + ogs_sock_destroy(sock); + return OGS_OK; } -status_t tests1ap_enb_close(sock_id id) -{ - return s1ap_delete(id); -} -status_t tests1ap_enb_read(sock_id id, pkbuf_t *recvbuf) +int tests1ap_build_setup_req( + ogs_pkbuf_t **pkbuf, S1AP_ENB_ID_PR present, uint32_t enb_id, + int tac, uint16_t mcc, uint16_t mnc, uint16_t mnc_len) { - return s1ap_recv(id, recvbuf); -} + int rv; -status_t tests1ap_enb_send(sock_id id, pkbuf_t *sendbuf) -{ - return s1ap_send(id, sendbuf, NULL, 0); -} - -status_t tests1ap_build_setup_req( - pkbuf_t **pkbuf, S1AP_ENB_ID_PR present, c_uint32_t enb_id) -{ - status_t rv; - - int tac = 12345; plmn_id_t plmn_id; S1AP_S1AP_PDU_t pdu; @@ -139,7 +204,7 @@ status_t tests1ap_build_setup_req( memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_S1Setup; @@ -149,7 +214,7 @@ status_t tests1ap_build_setup_req( S1SetupRequest = &initiatingMessage->value.choice.S1SetupRequest; - ie = core_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); ASN_SEQUENCE_ADD(&S1SetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID; @@ -158,7 +223,7 @@ status_t tests1ap_build_setup_req( Global_ENB_ID = &ie->value.choice.Global_ENB_ID; - ie = core_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); ASN_SEQUENCE_ADD(&S1SetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs; @@ -167,7 +232,7 @@ status_t tests1ap_build_setup_req( SupportedTAs = &ie->value.choice.SupportedTAs; - ie = core_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); ASN_SEQUENCE_ADD(&S1SetupRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX; @@ -176,17 +241,17 @@ status_t tests1ap_build_setup_req( PagingDRX = &ie->value.choice.PagingDRX; - plmn_id_build(&plmn_id, 1, 1, 2); + plmn_id_build(&plmn_id, mcc, mnc, mnc_len); s1ap_uint32_to_ENB_ID(present, enb_id, &Global_ENB_ID->eNB_ID); s1ap_buffer_to_OCTET_STRING( &plmn_id, PLMN_ID_LEN, &Global_ENB_ID->pLMNidentity); SupportedTAs_Item = (S1AP_SupportedTAs_Item_t *) - core_calloc(1, sizeof(S1AP_SupportedTAs_Item_t)); + ogs_calloc(1, sizeof(S1AP_SupportedTAs_Item_t)); s1ap_uint16_to_OCTET_STRING(tac, &SupportedTAs_Item->tAC); PLMNidentity = (S1AP_PLMNidentity_t *) - core_calloc(1, sizeof(S1AP_PLMNidentity_t)); + ogs_calloc(1, sizeof(S1AP_PLMNidentity_t)); s1ap_buffer_to_OCTET_STRING( &plmn_id, PLMN_ID_LEN, PLMNidentity); ASN_SEQUENCE_ADD(&SupportedTAs_Item->broadcastPLMNs.list, PLMNidentity); @@ -198,18 +263,18 @@ status_t tests1ap_build_setup_req( rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } #define TESTS1AP_MAX_MESSAGE 32 -status_t tests1ap_build_initial_ue_msg(pkbuf_t **pkbuf, int i) +int tests1ap_build_initial_ue_msg(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000c405800000500 0800020001001a00 302f177ca0b38802 0741020809101010" @@ -280,8 +345,15 @@ status_t tests1ap_build_initial_ue_msg(pkbuf_t **pkbuf, int i) "", "", + "000c" + "404c000005000800 020018001a002423 0741710839011094 7856044005e0e000" + "0000000e0201d011 d1270780000a0000 0d00c10043000600 1300410033006440" + "08001300418d01b7 800086400130", + "", + "", + }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 92, 160, 160, @@ -302,20 +374,21 @@ status_t tests1ap_build_initial_ue_msg(pkbuf_t **pkbuf, int i) 0, 0, + 80, + 0, + 0, + }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_identity_response(pkbuf_t **pkbuf, int i) +int tests1ap_build_identity_response(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "", @@ -339,7 +412,7 @@ status_t tests1ap_build_identity_response(pkbuf_t **pkbuf, int i) "5608091010103254 8651006440080000 f110001f20a00043 40060000f1103039", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 0, 0, 66, @@ -357,17 +430,14 @@ status_t tests1ap_build_identity_response(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_authentication_response(pkbuf_t **pkbuf, int i) +int tests1ap_build_authentication_response(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d403e00000500 000005c00100009d 000800020001001a 001211177c0bca9d" @@ -405,9 +475,15 @@ status_t tests1ap_build_authentication_response(pkbuf_t **pkbuf, int i) "b4c9006440080000 f1100787b8000043 40060000f1103039", "", "", + + "000d" + "4038000005000000 05c001a001020008 00020018001a000c 0b0753082a080419" + "d7becfdb00644008 001300418d01b780 0043400600130041 0033", + "", + "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 66, 0, 0, @@ -427,21 +503,22 @@ status_t tests1ap_build_authentication_response(pkbuf_t **pkbuf, int i) 58, 0, 0, + + 60, + 0, + 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_authentication_failure(pkbuf_t **pkbuf, int i) +int tests1ap_build_authentication_failure(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "", @@ -467,7 +544,7 @@ status_t tests1ap_build_authentication_failure(pkbuf_t **pkbuf, int i) }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 0, 0, 0, @@ -486,17 +563,14 @@ status_t tests1ap_build_authentication_failure(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_security_mode_complete(pkbuf_t **pkbuf, int i) +int tests1ap_build_security_mode_complete(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d403500000500 000005c00100009d 000800020001001a 000908476b8f5f64" @@ -533,8 +607,14 @@ status_t tests1ap_build_security_mode_complete(pkbuf_t **pkbuf, int i) "", "", + "000d" + "4035000005000000 05c001a001020008 00020018001a0009 084785cfd7fa0007" + "5e00644008001300 418d01b780004340 06001300410033", + "", + "", + }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 57, 0, 0, @@ -554,20 +634,21 @@ status_t tests1ap_build_security_mode_complete(pkbuf_t **pkbuf, int i) 55, 0, 0, + + 57, + 0, + 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_esm_information_response(pkbuf_t **pkbuf, int i) +int tests1ap_build_esm_information_response(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d40808d000005 00000005c0010000 9d00080002000100 1a006160275c0667" @@ -602,7 +683,6 @@ status_t tests1ap_build_esm_information_response(pkbuf_t **pkbuf, int i) "4041000005000000 05c0010001da0008 00020001001a0015 14279a2476c80102" "07da280908696e74 65726e6574006440 080000f110046153 80004340060000f1" "105ba0", - "000d" "4041000005000000 05c0020000c40008 0002000c001a0015 14274f280bff0102" "04da280908696e74 65726e6574006440 080000f110001f20 a0004340060000f1" @@ -616,8 +696,15 @@ status_t tests1ap_build_esm_information_response(pkbuf_t **pkbuf, int i) "", "", + "000d" + "4044000005000000 05c001a001020008 00020018001a0018 1727fe1c46890102" + "01da280c07737461 72656e7403636f6d 0064400800130041 8d01b78000434006" + "001300410033", + "", + "", + }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 146, 146, 0, @@ -638,20 +725,20 @@ status_t tests1ap_build_esm_information_response(pkbuf_t **pkbuf, int i) 0, 0, + 72, + 0, + 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_ue_capability_info_indication(pkbuf_t **pkbuf, int i) +int tests1ap_build_ue_capability_info_indication(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0016" @@ -672,18 +759,15 @@ status_t tests1ap_build_ue_capability_info_indication(pkbuf_t **pkbuf, int i) "403f000003000000 05c0020000c80008 00020002004a4029 28013001023cd980" "00bc000ff06ec4d0 0141b82c00000000 07d404000ef08020 00012a0300008800" "00", - "0016" "403f000003000000 05c0020000c70008 00020004004a4029 28013001023cd980" "00bc000ff06ec4d0 0141b82c00000000 07d404000ef08020 00012a0300008800" "00", "", - "0016" "4030000003000000 05c0010001da0008 00020001004a401a 1900b801014c5980" "809c000bf06ec4d0 0140302c00000000 0000", - "0016" "4030000003000000 05c0020000c40008 0002000c004a401a 1900b801014c5980" "0018000bf06ec4d0 0100302c00000000 0000", @@ -697,8 +781,15 @@ status_t tests1ap_build_ue_capability_info_indication(pkbuf_t **pkbuf, int i) "001100", "", "", + + "0016" + "403f000003000000 05c001a001020008 00020018004a4029 28013001023cd980" + "00bc000ff06ec4d0 0141b82c00000000 07d404000ef08020 00016a0300008800" + "00", + "", + "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 161, 0, 0, @@ -718,29 +809,31 @@ status_t tests1ap_build_ue_capability_info_indication(pkbuf_t **pkbuf, int i) 133, 0, 0, + + 67, + 0, + 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_initial_context_setup_response( - pkbuf_t **pkbuf, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - c_uint8_t ebi, c_uint32_t teid) +int tests1ap_build_initial_context_setup_response( + ogs_pkbuf_t **pkbuf, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + uint8_t ebi, uint32_t teid, const char *ipstr) { - status_t rv; + int rv; S1AP_S1AP_PDU_t pdu; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; S1AP_InitialContextSetupResponse_t *InitialContextSetupResponse = NULL; + ogs_sockaddr_t *addr = NULL; S1AP_InitialContextSetupResponseIEs_t *ie = NULL; S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL; @@ -757,7 +850,7 @@ status_t tests1ap_build_initial_context_setup_response( memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = @@ -769,7 +862,7 @@ status_t tests1ap_build_initial_context_setup_response( InitialContextSetupResponse = &successfulOutcome->value.choice.InitialContextSetupResponse; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -779,7 +872,7 @@ status_t tests1ap_build_initial_context_setup_response( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -789,7 +882,7 @@ status_t tests1ap_build_initial_context_setup_response( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); ASN_SEQUENCE_ADD(&InitialContextSetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABSetupListCtxtSURes; @@ -802,7 +895,7 @@ status_t tests1ap_build_initial_context_setup_response( *MME_UE_S1AP_ID = mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue_s1ap_id; - item = core_calloc(1, sizeof(S1AP_E_RABSetupItemCtxtSUResIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABSetupItemCtxtSUResIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupListCtxtSURes->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABSetupItemCtxtSURes; @@ -814,28 +907,32 @@ status_t tests1ap_build_initial_context_setup_response( e_rab->e_RAB_ID = ebi; - rv = gtp_sockaddr_to_f_teid(test_enb1_addr, test_enb1_addr6, &f_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + rv = ogs_getaddrinfo(&addr, AF_INET, ipstr, GTPV1_U_UDP_PORT, 0); + ogs_assert(rv == OGS_OK); + rv = gtp_sockaddr_to_f_teid(addr, NULL, &f_teid, &len); + ogs_assert(rv == OGS_OK); + ogs_freeaddrinfo(addr); + rv = gtp_f_teid_to_ip(&f_teid, &ip); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_ip_to_BIT_STRING(&ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(teid, &e_rab->gTP_TEID); rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_initial_context_setup_failure(pkbuf_t **pkbuf, int i) +int tests1ap_build_initial_context_setup_failure(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "4009 0015000003000040 0200020008400200 01000240020000", @@ -843,30 +940,26 @@ status_t tests1ap_build_initial_context_setup_failure(pkbuf_t **pkbuf, int i) "", "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 25, 0, 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i) +int tests1ap_build_attach_complete(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d" "403a000005000000 05c00100009d0008 00020001001a000e 0d27c183eb950207" "4300035200c20064 40080000f1101079 baf0004340060000 f1105ba0", - "000d" "403a000005000000 05c00100009e0008 00020002001a000e 0d27e8a2a3f10207" "4300035200c20064 40080000f1101079 baf0004340060000 f1105ba0", @@ -890,7 +983,6 @@ status_t tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i) "000d" "403a000005000000 05c0010001da0008 00020001001a000e 0d272e3456f70207" "4300035200c20064 40080000f1100461 5380004340060000 f1105ba0", - "000d" "403a000005000000 05c0020000c40008 0002000c001a000e 0d276a543e560207" "4300035200c20064 40080000f110001f 20a0004340060000 f1103039", @@ -902,8 +994,14 @@ status_t tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i) "", "", + "000d" + "403a000005000000 05c001a001020008 00020018001a000e 0d2735fbc1e30207" + "4300035200c20064 4008001300418d01 b780004340060013 00410033", + "", + "", + }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 62, 62, 0, @@ -923,20 +1021,21 @@ status_t tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i) 60, 0, 0, + + 62, + 0, + 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_emm_status(pkbuf_t **pkbuf, int i) +int tests1ap_build_emm_status(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "", @@ -952,7 +1051,7 @@ status_t tests1ap_build_emm_status(pkbuf_t **pkbuf, int i) "000d403300000500 0000020001000800 020001001a000a09 276941dec8020760" "65006440080000f1 10002343d0004340 060000f1103039", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 0, 0, 0, @@ -967,17 +1066,14 @@ status_t tests1ap_build_emm_status(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_detach_request(pkbuf_t **pkbuf, int i) +int tests1ap_build_detach_request(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000c404800000600 0800020002001a 001615172ba435db 040745090bf600f1" @@ -997,7 +1093,7 @@ status_t tests1ap_build_detach_request(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 76, 76, 0, @@ -1012,17 +1108,14 @@ status_t tests1ap_build_detach_request(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_ue_context_release_request(pkbuf_t **pkbuf, int i) +int tests1ap_build_ue_context_release_request(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0012" @@ -1041,7 +1134,7 @@ status_t tests1ap_build_ue_context_release_request(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 28, 0, 0, @@ -1056,17 +1149,14 @@ status_t tests1ap_build_ue_context_release_request(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_ue_context_release_complete(pkbuf_t **pkbuf, int i) +int tests1ap_build_ue_context_release_complete(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "2017001300000200 004005c00100009e 00084003400002", @@ -1096,7 +1186,7 @@ status_t tests1ap_build_ue_context_release_complete(pkbuf_t **pkbuf, int i) "0010000002000040 0200030008400340 072e", 0, }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 23, 23, 22, @@ -1119,19 +1209,16 @@ status_t tests1ap_build_ue_context_release_complete(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_service_request(pkbuf_t **pkbuf, - c_uint32_t enb_ue_s1ap_id, c_uint8_t seq, - c_uint16_t mac, c_uint32_t m_tmsi) +int tests1ap_build_service_request(ogs_pkbuf_t **pkbuf, + uint32_t enb_ue_s1ap_id, uint8_t seq, + uint16_t mac, uint32_t m_tmsi) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000c" @@ -1143,7 +1230,7 @@ status_t tests1ap_build_service_request(pkbuf_t **pkbuf, "6440080000f11007 87b8000086400140 0060000600400000 0001", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 59, 60, }; @@ -1152,27 +1239,24 @@ status_t tests1ap_build_service_request(pkbuf_t **pkbuf, if (enb_ue_s1ap_id & 0x400000) i = 1; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; - - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); enb_ue_s1ap_id = htonl(enb_ue_s1ap_id << 8); - memcpy((*pkbuf)->payload + 11, &enb_ue_s1ap_id, 2+i); + memcpy((*pkbuf)->data + 11, &enb_ue_s1ap_id, 2+i); mac = htons(mac); - memcpy((*pkbuf)->payload + 19+i, &seq, 1); - memcpy((*pkbuf)->payload + 20+i, &mac, 2); + memcpy((*pkbuf)->data + 19+i, &seq, 1); + memcpy((*pkbuf)->data + 20+i, &mac, 2); m_tmsi = htonl(m_tmsi); - memcpy((*pkbuf)->payload + 55+i, &m_tmsi, 4); + memcpy((*pkbuf)->data + 55+i, &m_tmsi, 4); - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_tau_request(pkbuf_t **pkbuf, int i, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, c_uint8_t active_flag, - c_uint32_t m_tmsi, c_uint8_t seq, c_uint32_t mac, c_uint8_t *knas_int) +int tests1ap_build_tau_request(ogs_pkbuf_t **pkbuf, int i, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, uint8_t active_flag, + uint32_t m_tmsi, uint8_t seq, uint32_t mac, uint8_t *knas_int) { char *payload[TESTS1AP_MAX_MESSAGE] = { /* Initial UE Message */ @@ -1190,61 +1274,58 @@ status_t tests1ap_build_tau_request(pkbuf_t **pkbuf, int i, "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 113, 103, 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; - - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); if (i == 0) { enb_ue_s1ap_id = htonl(enb_ue_s1ap_id << 8); - memcpy((*pkbuf)->payload + 11, &enb_ue_s1ap_id, 3); + memcpy((*pkbuf)->data + 11, &enb_ue_s1ap_id, 3); if (active_flag) { - char *active_buf = (*pkbuf)->payload + 26; + char *active_buf = (*pkbuf)->data + 26; *active_buf |= 0x08; } mac = htonl(mac); - memcpy((*pkbuf)->payload + 19, &mac, 4); - memcpy((*pkbuf)->payload + 23, &seq, 1); + memcpy((*pkbuf)->data + 19, &mac, 4); + memcpy((*pkbuf)->data + 23, &seq, 1); m_tmsi = htonl(m_tmsi); - memcpy((*pkbuf)->payload + 109, &m_tmsi, 4); + memcpy((*pkbuf)->data + 109, &m_tmsi, 4); } else if (i == 1) { - d_assert(knas_int, return CORE_ERROR,); + ogs_assert(knas_int); mme_ue_s1ap_id = htonl(mme_ue_s1ap_id << 8); - memcpy((*pkbuf)->payload + 11, &mme_ue_s1ap_id, 3); + memcpy((*pkbuf)->data + 11, &mme_ue_s1ap_id, 3); enb_ue_s1ap_id = htonl(enb_ue_s1ap_id << 8); - memcpy((*pkbuf)->payload + 17, &enb_ue_s1ap_id, 3); + memcpy((*pkbuf)->data + 17, &enb_ue_s1ap_id, 3); - memcpy((*pkbuf)->payload + 29, &seq, 1); + memcpy((*pkbuf)->data + 29, &seq, 1); m_tmsi = htonl(m_tmsi); - memcpy((*pkbuf)->payload + 41, &m_tmsi, 4); + memcpy((*pkbuf)->data + 41, &m_tmsi, 4); snow_3g_f9(knas_int, seq, (0 << 27), 0, - (*pkbuf)->payload + 29, (52 << 3), - (*pkbuf)->payload + 25); + (*pkbuf)->data + 29, (52 << 3), + (*pkbuf)->data + 25); } else - d_assert(0,,); + ogs_assert_if_reached(); - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_pdn_connectivity_request( - pkbuf_t **pkbuf, int i) +int tests1ap_build_pdn_connectivity_request( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d40640000" @@ -1268,7 +1349,7 @@ status_t tests1ap_build_pdn_connectivity_request( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 108, 108, 0, @@ -1283,18 +1364,15 @@ status_t tests1ap_build_pdn_connectivity_request( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_pdn_disconnectivity_request( - pkbuf_t **pkbuf, int i) +int tests1ap_build_pdn_disconnectivity_request( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d40370000" @@ -1314,7 +1392,7 @@ status_t tests1ap_build_pdn_disconnectivity_request( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 59, 59, 0, @@ -1329,22 +1407,20 @@ status_t tests1ap_build_pdn_disconnectivity_request( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_e_rab_setup_response( - pkbuf_t **pkbuf, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - c_uint8_t ebi, c_uint32_t teid) +int tests1ap_build_e_rab_setup_response( + ogs_pkbuf_t **pkbuf, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + uint8_t ebi, uint32_t teid, const char *ipstr) { - status_t rv; + int rv; + ogs_sockaddr_t *addr = NULL; S1AP_S1AP_PDU_t pdu; S1AP_SuccessfulOutcome_t *successfulOutcome = NULL; @@ -1365,7 +1441,7 @@ status_t tests1ap_build_e_rab_setup_response( memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = S1AP_ProcedureCode_id_E_RABSetup; @@ -1375,7 +1451,7 @@ status_t tests1ap_build_e_rab_setup_response( E_RABSetupResponse = &successfulOutcome->value.choice.E_RABSetupResponse; - ie = core_calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1384,7 +1460,7 @@ status_t tests1ap_build_e_rab_setup_response( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1393,7 +1469,7 @@ status_t tests1ap_build_e_rab_setup_response( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupResponse->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABSetupListBearerSURes; @@ -1406,7 +1482,7 @@ status_t tests1ap_build_e_rab_setup_response( *MME_UE_S1AP_ID = mme_ue_s1ap_id; *ENB_UE_S1AP_ID = enb_ue_s1ap_id; - item = core_calloc(1, sizeof(S1AP_E_RABSetupItemBearerSUResIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABSetupItemBearerSUResIEs_t)); ASN_SEQUENCE_ADD(&E_RABSetupListBearerSURes->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABSetupItemBearerSURes; @@ -1416,29 +1492,32 @@ status_t tests1ap_build_e_rab_setup_response( e_rab = &item->value.choice.E_RABSetupItemBearerSURes; e_rab->e_RAB_ID = ebi; - - rv = gtp_sockaddr_to_f_teid(test_enb1_addr, test_enb1_addr6, &f_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + + rv = ogs_getaddrinfo(&addr, AF_INET, ipstr, GTPV1_U_UDP_PORT, 0); + ogs_assert(rv == OGS_OK); + rv = gtp_sockaddr_to_f_teid(addr, NULL, &f_teid, &len); + ogs_assert(rv == OGS_OK); + ogs_freeaddrinfo(addr); rv = gtp_f_teid_to_ip(&f_teid, &ip); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_ip_to_BIT_STRING(&ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(teid, &e_rab->gTP_TEID); rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_e_rab_modify_response(pkbuf_t **pkbuf, int i) +int tests1ap_build_e_rab_modify_response(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "2006" @@ -1455,7 +1534,7 @@ status_t tests1ap_build_e_rab_modify_response(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 31, 0, 0, @@ -1470,17 +1549,14 @@ status_t tests1ap_build_e_rab_modify_response(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_e_rab_release_response(pkbuf_t **pkbuf, int i) +int tests1ap_build_e_rab_release_response(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "200700190000" @@ -1498,7 +1574,7 @@ status_t tests1ap_build_e_rab_release_response(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 29, 29, 0, @@ -1513,18 +1589,15 @@ status_t tests1ap_build_e_rab_release_response(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_activate_default_bearer_accept( - pkbuf_t **pkbuf, int i) +int tests1ap_build_activate_default_bearer_accept( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d40360000" @@ -1542,7 +1615,7 @@ status_t tests1ap_build_activate_default_bearer_accept( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 58, 0, 0, @@ -1557,18 +1630,15 @@ status_t tests1ap_build_activate_default_bearer_accept( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_activate_dedicated_bearer_accept( - pkbuf_t **pkbuf, int i) +int tests1ap_build_activate_dedicated_bearer_accept( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d403600000500" @@ -1595,7 +1665,7 @@ status_t tests1ap_build_activate_dedicated_bearer_accept( "4036000005000000 05c0020000c40008 0002000c001a000a 0927e3c77e000362" "00c6006440080000 f110001f20a00043 40060000f1103039", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 58, 58, 0, @@ -1613,18 +1683,15 @@ status_t tests1ap_build_activate_dedicated_bearer_accept( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_modify_bearer_accept( - pkbuf_t **pkbuf, int i) +int tests1ap_build_modify_bearer_accept( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d" @@ -1645,7 +1712,7 @@ status_t tests1ap_build_modify_bearer_accept( "", "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 57, 0, 0, @@ -1664,18 +1731,15 @@ status_t tests1ap_build_modify_bearer_accept( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_deactivate_bearer_accept( - pkbuf_t **pkbuf, int i) +int tests1ap_build_deactivate_bearer_accept( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000d40330000" @@ -1697,7 +1761,7 @@ status_t tests1ap_build_deactivate_bearer_accept( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 59, 59, 59, @@ -1712,22 +1776,20 @@ status_t tests1ap_build_deactivate_bearer_accept( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_path_switch_request( - pkbuf_t **pkbuf, int target, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - int num_of_bearer, c_uint8_t ebi, c_uint32_t teid) +int tests1ap_build_path_switch_request( + ogs_pkbuf_t **pkbuf, int target, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + int num_of_bearer, uint8_t ebi, uint32_t teid, + const char *ipstr1, const char *ipstr2) { - status_t rv; + int rv; int i; S1AP_S1AP_PDU_t pdu; @@ -1748,7 +1810,7 @@ status_t tests1ap_build_path_switch_request( memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage = - core_calloc(1, sizeof(S1AP_InitiatingMessage_t)); + ogs_calloc(1, sizeof(S1AP_InitiatingMessage_t)); initiatingMessage = pdu.choice.initiatingMessage; initiatingMessage->procedureCode = S1AP_ProcedureCode_id_PathSwitchRequest; @@ -1758,7 +1820,7 @@ status_t tests1ap_build_path_switch_request( PathSwitchRequest = &initiatingMessage->value.choice.PathSwitchRequest; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1767,7 +1829,7 @@ status_t tests1ap_build_path_switch_request( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeSwitchedDLList; @@ -1777,7 +1839,7 @@ status_t tests1ap_build_path_switch_request( E_RABToBeSwitchedDLList = &ie->value.choice.E_RABToBeSwitchedDLList; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_SourceMME_UE_S1AP_ID; @@ -1786,7 +1848,7 @@ status_t tests1ap_build_path_switch_request( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI; @@ -1795,7 +1857,7 @@ status_t tests1ap_build_path_switch_request( EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_TAI; @@ -1804,7 +1866,7 @@ status_t tests1ap_build_path_switch_request( TAI = &ie->value.choice.TAI; - ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t)); ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_UESecurityCapabilities; @@ -1818,20 +1880,21 @@ status_t tests1ap_build_path_switch_request( *MME_UE_S1AP_ID = mme_ue_s1ap_id; enb_ue = enb_ue_find_by_mme_ue_s1ap_id(mme_ue_s1ap_id); - d_assert(enb_ue, return CORE_ERROR,); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, return CORE_ERROR,); + ogs_assert(mme_ue); for (i = 0; i < num_of_bearer; i++) { S1AP_E_RABToBeSwitchedDLItemIEs_t *item = NULL; S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL; + ogs_sockaddr_t *addr = NULL; gtp_f_teid_t f_teid; ip_t ip; int len; - item = core_calloc( 1, sizeof(S1AP_E_RABToBeSwitchedDLItemIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABToBeSwitchedDLItemIEs_t)); ASN_SEQUENCE_ADD(&E_RABToBeSwitchedDLList->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABToBeSwitchedDLItem; @@ -1844,26 +1907,34 @@ status_t tests1ap_build_path_switch_request( e_rab->e_RAB_ID = ebi+i; if (target == 0) + { + rv = ogs_getaddrinfo(&addr, AF_INET, ipstr1, GTPV1_U_UDP_PORT, 0); rv = gtp_sockaddr_to_f_teid( - test_enb1_addr, test_enb1_addr6, &f_teid, &len); + addr, NULL, &f_teid, &len); + ogs_freeaddrinfo(addr); + } else + { + rv = ogs_getaddrinfo(&addr, AF_INET, ipstr2, GTPV1_U_UDP_PORT, 0); rv = gtp_sockaddr_to_f_teid( - test_enb2_addr, NULL, &f_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + addr, NULL, &f_teid, &len); + ogs_freeaddrinfo(addr); + } + ogs_assert(rv == OGS_OK); rv = gtp_f_teid_to_ip(&f_teid, &ip); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_ip_to_BIT_STRING(&ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(teid+i, &e_rab->gTP_TEID); } s1ap_buffer_to_OCTET_STRING( &mme_ue->e_cgi.plmn_id, PLMN_ID_LEN, &EUTRAN_CGI->pLMNidentity); EUTRAN_CGI->cell_ID.size = 4; - EUTRAN_CGI->cell_ID.buf = core_calloc( - EUTRAN_CGI->cell_ID.size, sizeof(c_uint8_t)); - d_assert(EUTRAN_CGI->cell_ID.buf, return CORE_ERROR,); + EUTRAN_CGI->cell_ID.buf = ogs_calloc( + EUTRAN_CGI->cell_ID.size, sizeof(uint8_t)); + ogs_assert(EUTRAN_CGI->cell_ID.buf); EUTRAN_CGI->cell_ID.buf[0] = (mme_ue->e_cgi.cell_id >> 24); EUTRAN_CGI->cell_ID.buf[1] = (mme_ue->e_cgi.cell_id >> 16); EUTRAN_CGI->cell_ID.buf[2] = (mme_ue->e_cgi.cell_id >> 8); @@ -1877,16 +1948,16 @@ status_t tests1ap_build_path_switch_request( UESecurityCapabilities->encryptionAlgorithms.size = 2; UESecurityCapabilities->encryptionAlgorithms.buf = - core_calloc(UESecurityCapabilities->encryptionAlgorithms.size, - sizeof(c_uint8_t)); + ogs_calloc(UESecurityCapabilities->encryptionAlgorithms.size, + sizeof(uint8_t)); UESecurityCapabilities->encryptionAlgorithms.bits_unused = 0; UESecurityCapabilities->encryptionAlgorithms.buf[0] = (mme_ue->ue_network_capability.eea << 1); UESecurityCapabilities->integrityProtectionAlgorithms.size = 2; UESecurityCapabilities->integrityProtectionAlgorithms.buf = - core_calloc(UESecurityCapabilities-> - integrityProtectionAlgorithms.size, sizeof(c_uint8_t)); + ogs_calloc(UESecurityCapabilities-> + integrityProtectionAlgorithms.size, sizeof(uint8_t)); UESecurityCapabilities->integrityProtectionAlgorithms.bits_unused = 0; UESecurityCapabilities->integrityProtectionAlgorithms.buf[0] = (mme_ue->ue_network_capability.eia << 1); @@ -1894,17 +1965,17 @@ status_t tests1ap_build_path_switch_request( rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_handover_required( - pkbuf_t **pkbuf, int i) +int tests1ap_build_handover_required( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0000" @@ -1949,7 +2020,7 @@ status_t tests1ap_build_handover_required( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 264, 275, 286, @@ -1964,17 +2035,14 @@ status_t tests1ap_build_handover_required( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_handover_failure(pkbuf_t **pkbuf, int i) +int tests1ap_build_handover_failure(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "4001 0012000002000040 05c0020000c5 000240020000", @@ -1982,29 +2050,27 @@ status_t tests1ap_build_handover_failure(pkbuf_t **pkbuf, int i) "", "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 22, 0, 0, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( - pkbuf_t **pkbuf, int target, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - int num_of_bearer, c_uint8_t ebi, c_uint32_t teid) +int tests1ap_build_handover_request_ack( + ogs_pkbuf_t **pkbuf, int target, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + int num_of_bearer, uint8_t ebi, uint32_t teid, + const char *ipstr1, const char *ipstr2) { - status_t rv; + int rv; int i; S1AP_S1AP_PDU_t pdu; @@ -2031,7 +2097,7 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome = - core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); + ogs_calloc(1, sizeof(S1AP_SuccessfulOutcome_t)); successfulOutcome = pdu.choice.successfulOutcome; successfulOutcome->procedureCode = S1AP_ProcedureCode_id_HandoverResourceAllocation; @@ -2042,7 +2108,7 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( HandoverRequestAcknowledge = &successfulOutcome->value.choice.HandoverRequestAcknowledge; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -2052,7 +2118,7 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -2062,7 +2128,7 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_E_RABAdmittedList; @@ -2072,7 +2138,7 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( E_RABAdmittedList = &ie->value.choice.E_RABAdmittedList; - ie = core_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); + ie = ogs_calloc(1, sizeof(S1AP_HandoverRequestAcknowledgeIEs_t)); ASN_SEQUENCE_ADD(&HandoverRequestAcknowledge->protocolIEs, ie); ie->id = S1AP_ProtocolIE_ID_id_Target_ToSource_TransparentContainer; @@ -2090,11 +2156,12 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( S1AP_E_RABAdmittedItemIEs_t *item = NULL; S1AP_E_RABAdmittedItem_t *e_rab = NULL; + ogs_sockaddr_t *addr = NULL; gtp_f_teid_t f_teid; ip_t ip; int len; - item = core_calloc(1, sizeof(S1AP_E_RABAdmittedItemIEs_t)); + item = ogs_calloc(1, sizeof(S1AP_E_RABAdmittedItemIEs_t)); ASN_SEQUENCE_ADD(&E_RABAdmittedList->list, item); item->id = S1AP_ProtocolIE_ID_id_E_RABAdmittedItem; @@ -2107,56 +2174,64 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( e_rab->e_RAB_ID = ebi+i; if (target == 0) + { + rv = ogs_getaddrinfo(&addr, AF_INET, ipstr1, GTPV1_U_UDP_PORT, 0); rv = gtp_sockaddr_to_f_teid( - test_enb1_addr, test_enb1_addr6, &f_teid, &len); + addr, NULL, &f_teid, &len); + ogs_freeaddrinfo(addr); + } else + { + rv = ogs_getaddrinfo(&addr, AF_INET, ipstr2, GTPV1_U_UDP_PORT, 0); rv = gtp_sockaddr_to_f_teid( - test_enb2_addr, NULL, &f_teid, &len); - d_assert(rv == CORE_OK, return CORE_ERROR,); + addr, NULL, &f_teid, &len); + ogs_freeaddrinfo(addr); + } + ogs_assert(rv == OGS_OK); rv = gtp_f_teid_to_ip(&f_teid, &ip); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); rv = s1ap_ip_to_BIT_STRING(&ip, &e_rab->transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); s1ap_uint32_to_OCTET_STRING(teid+i, &e_rab->gTP_TEID); e_rab->dL_transportLayerAddress = (S1AP_TransportLayerAddress_t *) - core_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); + ogs_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); rv = s1ap_ip_to_BIT_STRING(&ip, e_rab->dL_transportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); e_rab->dL_gTP_TEID = (S1AP_GTP_TEID_t *) - core_calloc(1, sizeof(S1AP_GTP_TEID_t)); + ogs_calloc(1, sizeof(S1AP_GTP_TEID_t)); s1ap_uint32_to_OCTET_STRING(teid+i+10, e_rab->dL_gTP_TEID); e_rab->uL_TransportLayerAddress = (S1AP_TransportLayerAddress_t *) - core_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); + ogs_calloc(1, sizeof(S1AP_TransportLayerAddress_t)); rv = s1ap_ip_to_BIT_STRING(&ip, e_rab->uL_TransportLayerAddress); - d_assert(rv == CORE_OK, return CORE_ERROR,); + ogs_assert(rv == OGS_OK); e_rab->uL_GTP_TEID = (S1AP_GTP_TEID_t *) - core_calloc(1, sizeof(S1AP_GTP_TEID_t)); + ogs_calloc(1, sizeof(S1AP_GTP_TEID_t)); s1ap_uint32_to_OCTET_STRING(teid+i+20, e_rab->uL_GTP_TEID); } s1ap_buffer_to_OCTET_STRING( - CORE_HEX(payload, strlen(payload), hexbuf), 132, + OGS_HEX(payload, strlen(payload), hexbuf), 132, Target_ToSource_TransparentContainer); rv = s1ap_encode_pdu(pkbuf, &pdu); s1ap_free_pdu(&pdu); - if (rv != CORE_OK) + if (rv != OGS_OK) { - d_error("s1ap_encode_pdu() failed"); - return CORE_ERROR; + ogs_error("s1ap_encode_pdu() failed"); + return OGS_ERROR; } - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_handover_request_ack_static( - pkbuf_t **pkbuf, int i) +int tests1ap_build_handover_request_ack_static( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "2001" @@ -2198,7 +2273,7 @@ status_t tests1ap_build_handover_request_ack_static( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 237, 237, 237, @@ -2213,18 +2288,15 @@ status_t tests1ap_build_handover_request_ack_static( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_enb_status_transfer( - pkbuf_t **pkbuf, int i) +int tests1ap_build_enb_status_transfer( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0018" @@ -2244,7 +2316,7 @@ status_t tests1ap_build_enb_status_transfer( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 43, 43, 0, @@ -2259,18 +2331,15 @@ status_t tests1ap_build_enb_status_transfer( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_enb_configuration_transfer( - pkbuf_t **pkbuf, int i) +int tests1ap_build_enb_configuration_transfer( + ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0028" @@ -2290,7 +2359,7 @@ status_t tests1ap_build_enb_configuration_transfer( "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 63, 63, 0, @@ -2305,17 +2374,14 @@ status_t tests1ap_build_enb_configuration_transfer( }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_handover_notify(pkbuf_t **pkbuf, int i) +int tests1ap_build_handover_notify(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0002" @@ -2335,7 +2401,7 @@ status_t tests1ap_build_handover_notify(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 44, 44, 0, @@ -2350,17 +2416,14 @@ status_t tests1ap_build_handover_notify(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_handover_cancel(pkbuf_t **pkbuf, int i) +int tests1ap_build_handover_cancel(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "0004" @@ -2377,7 +2440,7 @@ status_t tests1ap_build_handover_cancel(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 28, 0, 0, @@ -2392,17 +2455,14 @@ status_t tests1ap_build_handover_cancel(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t tests1ap_build_s1_reset(pkbuf_t **pkbuf, int i) +int tests1ap_build_s1_reset(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "000e001500000200 0240020060005c00 084000005b000220 04", @@ -2418,7 +2478,7 @@ status_t tests1ap_build_s1_reset(pkbuf_t **pkbuf, int i) "", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 25, 0, 0, @@ -2433,182 +2493,35 @@ status_t tests1ap_build_s1_reset(pkbuf_t **pkbuf, int i) }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } -status_t testgtpu_enb_connect(sock_id *new) +uint16_t in_cksum(uint16_t *addr, int len); /* from pgw_gtp_path.c */ + +int testgtpu_build_ping( + ogs_pkbuf_t **sendbuf, const char *src_ip, const char *dst_ip) { - char buf[INET_ADDRSTRLEN]; - status_t rv; - c_sockaddr_t *addr = NULL; - int family = AF_UNSPEC; - - if (test_only_control_plane) return CORE_OK; - - family = AF_INET6; - if (context_self()->parameter.no_ipv6) family = AF_INET; - else if (context_self()->parameter.prefer_ipv4) family = AF_INET; - else if (test_enb1_addr6 == NULL) family = AF_INET; - - rv = udp_socket(new, family); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - if (family == AF_INET) addr = test_enb1_addr; - else if (family == AF_INET6) addr = test_enb1_addr6; - else - d_assert(0, return CORE_ERROR,); - - d_assert(addr, return CORE_ERROR,); - rv = sock_bind(*new, addr); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; -} - -status_t testgtpu_enb2_connect(sock_id *new) -{ - status_t rv; - int family = AF_UNSPEC; - - if (test_only_control_plane) return CORE_OK; - - family = AF_INET; - - rv = udp_socket(new, family); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - d_assert(test_enb2_addr, return CORE_ERROR,); - rv = sock_bind(*new, test_enb2_addr); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - return CORE_OK; -} - -status_t testgtpu_enb_close(sock_id sock) -{ - if (test_only_control_plane) return CORE_OK; - - return sock_delete(sock); -} - -status_t testgtpu_enb_send(pkbuf_t *sendbuf) -{ - status_t rv; - sock_id sock = 0; - hash_index_t *hi = NULL; - mme_ue_t *mme_ue = NULL; - mme_sess_t *sess = NULL; - mme_bearer_t *bearer = NULL; - - c_sockaddr_t sgw; - ssize_t sent; - - if (test_only_control_plane) return 0; - - hi = mme_ue_first(); - d_assert(hi, return -1,); - mme_ue = mme_ue_this(hi); - d_assert(mme_ue, return -1,); - sess = mme_sess_first(mme_ue); - d_assert(sess, return -1,); - bearer = mme_bearer_first(sess); - d_assert(bearer, return -1,); - - memset(&sgw, 0, sizeof(c_sockaddr_t)); - sgw.c_sa_port = htons(GTPV1_U_UDP_PORT); - if (bearer->sgw_s1u_ip.ipv6) - { - sgw.c_sa_family = AF_INET6; - if (bearer->sgw_s1u_ip.ipv4) - memcpy(sgw.sin6.sin6_addr.s6_addr, - bearer->sgw_s1u_ip.both.addr6, IPV6_LEN); - else - memcpy(sgw.sin6.sin6_addr.s6_addr, - bearer->sgw_s1u_ip.addr6, IPV6_LEN); - rv = sock_fill_scope_id_in_local(&sgw); - d_assert(rv == CORE_OK, return CORE_ERROR,); - } - else - { - sgw.c_sa_family = AF_INET; - sgw.sin.sin_addr.s_addr = bearer->sgw_s1u_ip.addr; - } - - rv = udp_client(&sock, &sgw); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - sent = core_send(sock, sendbuf->payload, sendbuf->len, 0); - pkbuf_free(sendbuf); - if (sent < 0 || sent != sendbuf->len) - return CORE_ERROR; - - sock_delete(sock); - - return CORE_OK; -} - -status_t testgtpu_enb_read(sock_id sock, pkbuf_t *recvbuf) -{ - int rc = 0; - - if (test_only_control_plane) return 0; - - while(1) - { - rc = core_recv(sock, recvbuf->payload, recvbuf->len, 0); - if (rc == -2) - { - continue; - } - else if (rc <= 0) - { - if (errno == EAGAIN) - { - continue; - } - break; - } - else - { - break; - } - } - recvbuf->len = rc; - - return CORE_OK; -} - -c_uint16_t in_cksum(c_uint16_t *addr, int len); /* from pgw_gtp_path.c */ - -status_t testgtpu_build_ping( - pkbuf_t **sendbuf, const char *src_ip, const char *dst_ip) -{ - status_t rv; - pkbuf_t *pkbuf = NULL; + int rv; + ogs_pkbuf_t *pkbuf = NULL; gtp_header_t *gtp_h = NULL; - ipsubnet_t src_ipsub, dst_ipsub; + ogs_ipsubnet_t src_ipsub, dst_ipsub; - if (test_only_control_plane) return CORE_OK; + ogs_assert(src_ip); + ogs_assert(dst_ip); + rv = ogs_ipsubnet(&src_ipsub, src_ip, NULL); + ogs_assert(rv == OGS_OK); + rv = ogs_ipsubnet(&dst_ipsub, dst_ip, NULL); + ogs_assert(rv == OGS_OK); - d_assert(src_ip, return CORE_ERROR,); - d_assert(dst_ip, return CORE_ERROR,); - rv = core_ipsubnet(&src_ipsub, src_ip, NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); - rv = core_ipsubnet(&dst_ipsub, dst_ip, NULL); - d_assert(rv == CORE_OK, return CORE_ERROR,); - - pkbuf = pkbuf_alloc(0, 200 /* enough for ICMP; use smaller buffer */); - d_assert(pkbuf, return CORE_ERROR,); - memset(pkbuf->payload, 0, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, + 200 /* enough for ICMP; use smaller buffer */); + ogs_pkbuf_put(pkbuf, 200); - gtp_h = (gtp_header_t *)pkbuf->payload; + gtp_h = (gtp_header_t *)pkbuf->data; gtp_h->flags = 0x30; gtp_h->type = GTPU_MSGTYPE_GPDU; gtp_h->teid = htonl(1); @@ -2620,8 +2533,8 @@ status_t testgtpu_build_ping( gtp_h->length = htons(sizeof *ip_h + ICMP_MINLEN); - ip_h = (struct ip *)(pkbuf->payload + GTPV1U_HEADER_LEN); - icmp_h = (struct icmp *)((c_uint8_t *)ip_h + sizeof *ip_h); + ip_h = (struct ip *)(pkbuf->data + GTPV1U_HEADER_LEN); + icmp_h = (struct icmp *)((uint8_t *)ip_h + sizeof *ip_h); ip_h->ip_v = 4; ip_h->ip_hl = 5; @@ -2633,28 +2546,28 @@ status_t testgtpu_build_ping( ip_h->ip_len = gtp_h->length; ip_h->ip_src.s_addr = src_ipsub.sub[0]; ip_h->ip_dst.s_addr = dst_ipsub.sub[0]; - ip_h->ip_sum = in_cksum((c_uint16_t *)ip_h, sizeof *ip_h); + ip_h->ip_sum = in_cksum((uint16_t *)ip_h, sizeof *ip_h); icmp_h->icmp_type = 8; icmp_h->icmp_seq = rand(); icmp_h->icmp_id = rand(); - icmp_h->icmp_cksum = in_cksum((c_uint16_t *)icmp_h, ICMP_MINLEN); + icmp_h->icmp_cksum = in_cksum((uint16_t *)icmp_h, ICMP_MINLEN); } else if (dst_ipsub.family == AF_INET6) { struct ip6_hdr *ip6_h = NULL; struct icmp6_hdr *icmp6_h = NULL; - c_uint16_t plen = 0; - c_uint8_t nxt = 0; - c_uint8_t *p = NULL; + uint16_t plen = 0; + uint8_t nxt = 0; + uint8_t *p = NULL; gtp_h->length = htons(sizeof *ip6_h + sizeof *icmp6_h); plen = htons(sizeof *icmp6_h); nxt = IPPROTO_ICMPV6; - p = (c_uint8_t *)pkbuf->payload + GTPV1U_HEADER_LEN; + p = (uint8_t *)pkbuf->data + GTPV1U_HEADER_LEN; ip6_h = (struct ip6_hdr *)p; - icmp6_h = (struct icmp6_hdr *)((c_uint8_t *)ip6_h + sizeof *ip6_h); + icmp6_h = (struct icmp6_hdr *)((uint8_t *)ip6_h + sizeof *ip6_h); memcpy(p, src_ipsub.sub, sizeof src_ipsub.sub); p += sizeof src_ipsub.sub; @@ -2668,7 +2581,7 @@ status_t testgtpu_build_ping( icmp6_h->icmp6_id = rand(); icmp6_h->icmp6_cksum = in_cksum( - (c_uint16_t *)ip6_h, sizeof *ip6_h + sizeof *icmp6_h); + (uint16_t *)ip6_h, sizeof *ip6_h + sizeof *icmp6_h); ip6_h->ip6_flow = htonl(0x60000001); ip6_h->ip6_plen = plen; @@ -2678,32 +2591,29 @@ status_t testgtpu_build_ping( memcpy(ip6_h->ip6_dst.s6_addr, dst_ipsub.sub, sizeof dst_ipsub.sub); } else - d_assert(0, return CORE_ERROR,); + ogs_assert_if_reached(); *sendbuf = pkbuf; - return CORE_OK; + return OGS_OK; } -status_t testgtpu_build_slacc_rs(pkbuf_t **pkbuf, int i) +int testgtpu_build_slacc_rs(ogs_pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { "32ff003400000001 00000000 6000000000083aff fe80000000000000 0000000000000002" "ff02000000000000 0000000000000002 85007d3500000000", }; - c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + uint16_t len[TESTS1AP_MAX_MESSAGE] = { 60, }; char hexbuf[MAX_SDU_LEN]; - *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - if (!(*pkbuf)) return CORE_ERROR; + *pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put_data(*pkbuf, + OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]); - (*pkbuf)->len = len[i]; - memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), - (*pkbuf)->len); - - return CORE_OK; + return OGS_OK; } diff --git a/test/common/testpacket.h b/test/common/testpacket.h index 1174a2a03..286a5e2cf 100644 --- a/test/common/testpacket.h +++ b/test/common/testpacket.h @@ -1,106 +1,105 @@ #ifndef __TESTS1AP_H__ #define __TESTS1AP_H__ -#include "core_network.h" -#include "core_pkbuf.h" - -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) testpacket_init(); -CORE_DECLARE(status_t) testpacket_final(); +int testpacket_init(); +int testpacket_final(); -CORE_DECLARE(status_t) tests1ap_enb_connect(sock_id *new); -CORE_DECLARE(status_t) tests1ap_enb_close(sock_id id); -CORE_DECLARE(status_t) tests1ap_enb_send(sock_id id, pkbuf_t *sendbuf); -CORE_DECLARE(status_t) tests1ap_enb_read(sock_id id, pkbuf_t *recvbuf); +ogs_sock_t *testenb_s1ap_client(const char *ipstr); +ogs_pkbuf_t *testenb_s1ap_read(ogs_sock_t *sock); +int testenb_s1ap_send(ogs_sock_t *sock, ogs_pkbuf_t *sendbuf); +int testenb_s1ap_close(ogs_sock_t *sock); -CORE_DECLARE(status_t) tests1ap_build_setup_req( - pkbuf_t **pkbuf, S1AP_ENB_ID_PR present, c_uint32_t enb_id); -CORE_DECLARE(status_t) tests1ap_build_initial_ue_msg(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_identity_response(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_authentication_response( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_authentication_failure( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_security_mode_complete( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_esm_information_response( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_ue_capability_info_indication( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_initial_context_setup_response( - pkbuf_t **pkbuf, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - c_uint8_t ebi, c_uint32_t teid); -CORE_DECLARE(status_t) tests1ap_build_initial_context_setup_failure( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_emm_status(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_detach_request(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_ue_context_release_request( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_ue_context_release_complete( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_service_request(pkbuf_t **pkbuf, - c_uint32_t enb_ue_s1ap_id, c_uint8_t seq, - c_uint16_t mac, c_uint32_t m_tmsi); -CORE_DECLARE(status_t) tests1ap_build_tau_request(pkbuf_t **pkbuf, int i, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, c_uint8_t active_flag, - c_uint32_t m_tmsi, c_uint8_t seq, c_uint32_t mac, c_uint8_t *knas_int); -CORE_DECLARE(status_t) tests1ap_build_pdn_connectivity_request( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_pdn_disconnectivity_request( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_e_rab_setup_response( - pkbuf_t **pkbuf, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - c_uint8_t ebi, c_uint32_t teid); -CORE_DECLARE(status_t) tests1ap_build_e_rab_modify_response( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_e_rab_release_response( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_activate_default_bearer_accept( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_activate_dedicated_bearer_accept( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_modify_bearer_accept( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_deactivate_bearer_accept( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_path_switch_request( - pkbuf_t **pkbuf, int target, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - int num_of_bearer, c_uint8_t ebi, c_uint32_t teid); -CORE_DECLARE(status_t) tests1ap_build_handover_required(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_handover_failure(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( - pkbuf_t **pkbuf, int target, - c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, - int num_of_bearer, c_uint8_t ebi, c_uint32_t teid); -CORE_DECLARE(status_t) tests1ap_build_handover_request_ack_static( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_enb_status_transfer( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_enb_configuration_transfer( - pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_handover_notify(pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) tests1ap_build_handover_cancel(pkbuf_t **pkbuf, int i); +ogs_sock_t *testenb_gtpu_server(const char *ipstr); +ogs_pkbuf_t *testenb_gtpu_read(ogs_sock_t *sock); +int testenb_gtpu_send(ogs_sock_t *sock, ogs_pkbuf_t *sendbuf); +int testenb_gtpu_close(ogs_sock_t *sock); -CORE_DECLARE(status_t) tests1ap_build_s1_reset(pkbuf_t **pkbuf, int i); +int tests1ap_build_setup_req( + ogs_pkbuf_t **pkbuf, S1AP_ENB_ID_PR present, uint32_t enb_id, + int tac, uint16_t mcc, uint16_t mnc, uint16_t mnc_len); +int tests1ap_build_initial_ue_msg(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_identity_response(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_authentication_response( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_authentication_failure( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_security_mode_complete( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_esm_information_response( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_ue_capability_info_indication( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_initial_context_setup_response( + ogs_pkbuf_t **pkbuf, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + uint8_t ebi, uint32_t teid, const char *ipstr); +int tests1ap_build_initial_context_setup_failure( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_attach_complete(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_emm_status(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_detach_request(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_ue_context_release_request( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_ue_context_release_complete( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_service_request(ogs_pkbuf_t **pkbuf, + uint32_t enb_ue_s1ap_id, uint8_t seq, + uint16_t mac, uint32_t m_tmsi); +int tests1ap_build_tau_request(ogs_pkbuf_t **pkbuf, int i, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, uint8_t active_flag, + uint32_t m_tmsi, uint8_t seq, uint32_t mac, uint8_t *knas_int); +int tests1ap_build_pdn_connectivity_request( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_pdn_disconnectivity_request( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_e_rab_setup_response( + ogs_pkbuf_t **pkbuf, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + uint8_t ebi, uint32_t teid, const char *ipstr); +int tests1ap_build_e_rab_modify_response( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_e_rab_release_response( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_activate_default_bearer_accept( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_activate_dedicated_bearer_accept( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_modify_bearer_accept( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_deactivate_bearer_accept( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_path_switch_request( + ogs_pkbuf_t **pkbuf, int target, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + int num_of_bearer, uint8_t ebi, uint32_t teid, + const char *ipstr1, const char *ipstr2); +int tests1ap_build_handover_required(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_handover_failure(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_handover_request_ack( + ogs_pkbuf_t **pkbuf, int target, + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, + int num_of_bearer, uint8_t ebi, uint32_t teid, + const char *ipstr1, const char *ipstr2); +int tests1ap_build_handover_request_ack_static( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_enb_status_transfer( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_enb_configuration_transfer( + ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_handover_notify(ogs_pkbuf_t **pkbuf, int i); +int tests1ap_build_handover_cancel(ogs_pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) testgtpu_enb_connect(sock_id *new); -CORE_DECLARE(status_t) testgtpu_enb2_connect(sock_id *new); -CORE_DECLARE(status_t) testgtpu_enb_close(sock_id sock); -CORE_DECLARE(status_t) testgtpu_enb_read(sock_id sock, pkbuf_t *recvbuf); -CORE_DECLARE(status_t) testgtpu_enb_send(pkbuf_t *sendbuf); +int tests1ap_build_s1_reset(ogs_pkbuf_t **pkbuf, int i); -CORE_DECLARE(status_t) testgtpu_build_ping(pkbuf_t **sendbuf, +int testgtpu_build_ping(ogs_pkbuf_t **sendbuf, const char *src_ip, const char *dst_ip); -CORE_DECLARE(status_t) testgtpu_build_slacc_rs(pkbuf_t **sendbuf, int i); +int testgtpu_build_slacc_rs(ogs_pkbuf_t **sendbuf, int i); #ifdef __cplusplus } diff --git a/test/common/testutil.h b/test/common/testutil.h deleted file mode 100644 index 12a1bd5a8..000000000 --- a/test/common/testutil.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core_general.h" -#include "abts.h" - -#ifndef __TEST_UTIL__ -#define __TEST_UTIL__ - -/* XXX: FIXME - these all should become much more utilitarian - * and part of core, itself - */ - -#ifdef WIN32 -#ifdef BINPATH -#define TESTBINPATH APR_STRINGIFY(BINPATH) "/" -#else -#define TESTBINPATH "" -#endif -#else -#define TESTBINPATH "./" -#endif - -#ifdef WIN32 -#define EXTENSION ".exe" -#elif NETWARE -#define EXTENSION ".nlm" -#else -#define EXTENSION -#endif - -#define STRING_MAX 8096 - -/* Some simple functions to make the test apps easier to write and - * a bit more consistent... - */ - -/* Assert that RV is an CORE_OK value; else fail giving strerror - * for RV and CONTEXT message. */ -void core_assert_ok(abts_case* tc, const char *context, - status_t rv, int lineno); -#define CORE_ASSERT_OK(tc, ctxt, rv) \ - core_assert_ok(tc, ctxt, rv, __LINE__) - -status_t test_initialize(int argc, const char *const argv[], char *config_path); - -#endif /* __TESTUTIL_H__ */ diff --git a/test/complex/abts-main.c b/test/complex/abts-main.c new file mode 100644 index 000000000..b66ea1c8d --- /dev/null +++ b/test/complex/abts-main.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-core.h" +#include "core/abts.h" + +#include "fd/fd_lib.h" + +#include "app/application.h" +#include "app/context.h" + +#include "app_init.h" +#include "testpacket.h" + +abts_suite *test_s1setup(abts_suite *suite); +abts_suite *test_attach(abts_suite *suite); +abts_suite *test_volte(abts_suite *suite); +abts_suite *test_handover(abts_suite *suite); + +const struct testlist { + abts_suite *(*func)(abts_suite *suite); +} alltests[] = { + {test_s1setup}, + {test_attach}, + {test_volte}, + {test_handover}, + {NULL}, +}; + +static int connected_count = 0; +static void test_fd_logger_handler(enum fd_hook_type type, struct msg * msg, + struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, + void * regdata) +{ + if (type == HOOK_PEER_CONNECT_SUCCESS) + { + connected_count++; + } +} + +void test_terminate(void) +{ + testpacket_final(); + epc_terminate(); + + base_finalize(); + ogs_core_finalize(); +} + +int test_initialize(app_param_t *param, int argc, const char *const argv[]) +{ + int rv; + fd_logger_register(test_fd_logger_handler); + + atexit(test_terminate); + + ogs_core_initialize(); + base_initialize(); + + rv = epc_initialize(param); + if (rv != OGS_OK) + { + ogs_error("app_initialize() failed"); + return OGS_ERROR; + } + rv = testpacket_init(); + if (rv != OGS_OK) + { + ogs_error("testpacket() failed"); + return OGS_ERROR; + } + + while(1) + { + if (connected_count == 1) break; + ogs_msleep(50); + } + + return rv; +} + +int main(int argc, const char **argv) +{ + int i; + app_param_t param; + const char *debug_mask = NULL; + const char *trace_mask = NULL; + char config_dir[MAX_FILEPATH_LEN/2]; + char config_path[MAX_FILEPATH_LEN]; + abts_suite *suite = NULL; + + abts_init(argc, argv); + + memset(¶m, 0, sizeof(param)); + for (i = 1; i < argc; i++) { + /* abts_init(argc, argv) handles the following options */ + if (!strcmp(argv[i], "-v")) continue; + if (!strcmp(argv[i], "-x")) continue; + if (!strcmp(argv[i], "-l")) continue; + if (!strcmp(argv[i], "-q")) continue; + + if (!strcmp(argv[i], "-d")) { + param.log_level = OGS_LOG_DEBUG; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-t")) { + param.log_level = OGS_LOG_TRACE; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-f")) { + param.config_path = argv[++i]; + continue; + } + if (argv[i][0] == '-') { + fprintf(stderr, "Invalid option: `%s'\n", argv[i]); + exit(1); + } + } + + if (!param.config_path) + { + ogs_path_remove_last_component(config_dir, argv[0]); + if (strstr(config_dir, ".libs")) + ogs_path_remove_last_component(config_dir, config_dir); + ogs_snprintf(config_path, sizeof config_path, + "%s/sample.conf", config_dir); + param.config_path = config_path; + } + + if (param.log_level) + ogs_core()->log.level = OGS_LOG_DEFAULT; + else + ogs_core()->log.level = OGS_LOG_ERROR; + test_initialize(¶m, argc, argv); + + for (i = 0; alltests[i].func; i++) + { + suite = alltests[i].func(suite); + } + + return abts_report(suite); +} diff --git a/test/basic/attach_test.c b/test/complex/attach_test.c similarity index 59% rename from test/basic/attach_test.c rename to test/complex/attach_test.c index f497f901d..d97d81d71 100644 --- a/test/basic/attach_test.c +++ b/test/complex/attach_test.c @@ -1,15 +1,13 @@ -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_lib.h" #include -#include "common/context.h" +#include "core/abts.h" + +#include "app/context.h" #include "mme/mme_context.h" #include "mme/s1ap_build.h" -#include "s1ap/s1ap_message.h" +#include "asn1c/s1ap_message.h" -#include "testutil.h" #include "testpacket.h" /************************************************************** @@ -18,19 +16,19 @@ * Protocol Configuration Options in ESM information response */ static void attach_test1(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - sock_id gtpu; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_sock_t *gtpu; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 0; enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - c_uint32_t m_tmsi = 0; + uint32_t m_tmsi = 0; - c_uint8_t tmp[MAX_SDU_LEN]; + uint8_t tmp[MAX_SDU_LEN]; char *_authentication_request = "000b403b00000300 000005c00100009d 000800020001001a 0025240752002008" "0c3818183b522614 162c07601d0d10f1 1b89a2a8de8000ad 0ccf7f55e8b20d"; @@ -54,7 +52,7 @@ static void attach_test1(abts_case *tc, void *data) mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -97,35 +95,34 @@ static void attach_test1(abts_case *tc, void *data) "\"__v\" : 0 " "}"; - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* eNB connects to SGW */ - rv = testgtpu_enb_connect(>pu); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + gtpu = testenb_gtpu_server("127.0.0.5"); + ABTS_PTR_NOTNULL(tc, gtpu); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); /********** Insert Subscriber in Database */ @@ -147,279 +144,264 @@ static void attach_test1(abts_case *tc, void *data) /*********************************************************************** * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); mme_self()->mme_ue_s1ap_id = 16777372; rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_authentication_request, strlen(_authentication_request), tmp), + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_authentication_request, strlen(_authentication_request), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_security_mode_command, strlen(_security_mode_command), tmp), + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_security_mode_command, strlen(_security_mode_command), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_esm_information_request, strlen(_security_mode_command), tmp), + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_esm_information_request, strlen(_security_mode_command), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); /* * We cannot check it since SGW S1U ADDR is changed * from configuration file */ #if 0 - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_initial_context_setup_request, + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_initial_context_setup_request, strlen(_initial_context_setup_request), tmp), recvbuf->len) == 0); #endif - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 16777373, 1, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 16777373, 1, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - CORE_HEX(_emm_information, strlen(_emm_information), tmp); - ABTS_TRUE(tc, memcmp(recvbuf->payload, tmp, 28) == 0); - ABTS_TRUE(tc, memcmp(recvbuf->payload+32, tmp+32, 20) == 0); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + OGS_HEX(_emm_information, strlen(_emm_information), tmp); + ABTS_TRUE(tc, memcmp(recvbuf->data, tmp, 28) == 0); + ABTS_TRUE(tc, memcmp(recvbuf->data+32, tmp+32, 20) == 0); + ogs_pkbuf_free(recvbuf); #if TEST_INITIAL_CONTEXT_SETUP_FAILURE /* Send Initial Context Setup Failure */ rv = tests1ap_build_initial_context_setup_failure(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); #endif - core_sleep(time_from_msec(300)); + ogs_msleep(300); rv = testgtpu_build_slacc_rs(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = testgtpu_enb_send(sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_gtpu_send(gtpu, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send GTP-U ICMP Packet */ rv = testgtpu_build_ping(&sendbuf, "45.45.0.2", "45.45.0.1"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = testgtpu_enb_send(sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_gtpu_send(gtpu, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive GTP-U ICMP Packet */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #if LINUX == 1 rv = testgtpu_build_ping(&sendbuf, "cafe::2", "cafe::1"); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = testgtpu_enb_send(sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_gtpu_send(gtpu, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive GTP-U ICMP Packet */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #endif /* Retreive M-TMSI */ enb_ue = enb_ue_find_by_mme_ue_s1ap_id(16777373); - d_assert(enb_ue, goto out,); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, goto out,); + ogs_assert(mme_ue); m_tmsi = mme_ue->guti.m_tmsi; /***************************************************************** * Attach Request : Known GUTI, Integrity Protected, MAC Matched * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex+1); /* Update M-TMSI */ m_tmsi = htonl(m_tmsi); - memcpy(sendbuf->payload + 36, &m_tmsi, 4); + memcpy(sendbuf->data + 36, &m_tmsi, 4); /* Update NAS MAC */ - void snow_3g_f9(c_uint8_t* key, c_uint32_t count, c_uint32_t fresh, - c_uint32_t dir, c_uint8_t *data, c_uint64_t length, c_uint8_t *out); + void snow_3g_f9(uint8_t* key, uint32_t count, uint32_t fresh, + uint32_t dir, uint8_t *data, uint64_t length, uint8_t *out); snow_3g_f9(mme_ue->knas_int, 7, 0, 0, - sendbuf->payload + 24, (109 << 3), sendbuf->payload+20); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sendbuf->data + 24, (109 << 3), sendbuf->data+20); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #if 1 /* IMPLICIT_S1_RELEASE */ /* Send UE Context Release Request */ rv = tests1ap_build_ue_context_release_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Error Indicaation */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #else /* S1_HOLDING_TIMER */ /* Send UE Context Release Request */ rv = tests1ap_build_ue_context_release_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+3); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); #endif /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Attach Complete + * Activate Default EPS Bearer Context Accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Detach Request */ rv = tests1ap_build_detach_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /***************************************************************** * Attach Request : Unknown GUTI, Integrity Protected * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex+2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Identity Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456819")); @@ -432,40 +414,39 @@ static void attach_test1(abts_case *tc, void *data) /* Send Identity Response */ rv = tests1ap_build_identity_response(&sendbuf, msgindex+2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Attach Reject */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive UE Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* eNB disonncect from SGW */ - rv = testgtpu_enb_close(gtpu); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu); + ABTS_INT_EQUAL(tc, OGS_OK, rv); return; +#if IT_WILL_BE_REMOVED out: /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456819")); @@ -476,15 +457,16 @@ out: mongoc_collection_destroy(collection); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* eNB disonncect from SGW */ - rv = testgtpu_enb_close(gtpu); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif } /************************************************************** @@ -493,16 +475,16 @@ out: * Protocol Configuration Options in PDN Connectivity Request */ static void attach_test2(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 3; mongoc_collection_t *collection = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_t *doc = NULL; bson_error_t error; const char *json = @@ -586,33 +568,32 @@ static void attach_test2(abts_case *tc, void *data) "\"__v\" : 0 " "}"; - c_uint8_t tmp[MAX_SDU_LEN]; + uint8_t tmp[MAX_SDU_LEN]; - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x002343d); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x002343d, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); /********** Insert Subscriber in Database */ @@ -651,183 +632,171 @@ static void attach_test2(abts_case *tc, void *data) /***************************************************************** * Attach Request : Known IMSI, Plain NAS message * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); mme_self()->mme_ue_s1ap_id = 0; rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 1, 31, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 1, 31, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /***************************************************************** * Attach Request : IMSI, Integrity Protected, MAC Matched * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Attach Complete + * Activate Default EPS Bearer Context Accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /***************************************************************** * Attach Request : Unknown IMSI, Integrity Protected * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex+2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Authentication Failure */ rv = tests1ap_build_authentication_failure(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Authentication Failure */ rv = tests1ap_build_authentication_failure(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Reject */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); doc = BCON_NEW("imsi", BCON_UTF8("001010123456826")); ABTS_PTR_NOTNULL(tc, doc); @@ -844,26 +813,26 @@ static void attach_test2(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); } /************************************************************** * Attach -> Release -> Service Request -> TAU Request */ static void attach_test3(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 6; enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - c_uint32_t m_tmsi = 0; + uint32_t m_tmsi = 0; - c_uint8_t tmp[MAX_SDU_LEN]; + uint8_t tmp[MAX_SDU_LEN]; char *_authentication_request = "000b" "403b000003000000 05c0020000c80008 00020002001a0025 2407520042200639" @@ -895,7 +864,7 @@ static void attach_test3(abts_case *tc, void *data) "0013000002006300 070c020000c80002 0002400120"; mongoc_collection_t *collection = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_t *doc = NULL; bson_error_t error; const char *json = @@ -939,34 +908,33 @@ static void attach_test3(abts_case *tc, void *data) "\"__v\" : 0 " "}"; - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; ABTS_PTR_NOTNULL(tc, doc); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); /********** Insert Subscriber in Database */ @@ -986,206 +954,196 @@ static void attach_test3(abts_case *tc, void *data) /***************************************************************** * Attach Request : Known IMSI, Plain NAS message * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); mme_self()->mme_ue_s1ap_id = 33554631; rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_authentication_request, strlen(_authentication_request), tmp), + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_authentication_request, strlen(_authentication_request), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_security_mode_command, strlen(_security_mode_command), tmp), + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_security_mode_command, strlen(_security_mode_command), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_esm_information_request, strlen(_security_mode_command), tmp), + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_esm_information_request, strlen(_security_mode_command), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 33554632, 2, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 33554632, 2, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - CORE_HEX(_emm_information, strlen(_emm_information), tmp); - ABTS_TRUE(tc, memcmp(recvbuf->payload, tmp, 28) == 0); - ABTS_TRUE(tc, memcmp(recvbuf->payload+32, tmp+32, 20) == 0); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + OGS_HEX(_emm_information, strlen(_emm_information), tmp); + ABTS_TRUE(tc, memcmp(recvbuf->data, tmp, 28) == 0); + ABTS_TRUE(tc, memcmp(recvbuf->data+32, tmp+32, 20) == 0); + ogs_pkbuf_free(recvbuf); /* Retreive M-TMSI */ enb_ue = enb_ue_find_by_mme_ue_s1ap_id(33554632); - d_assert(enb_ue, goto out,); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, goto out,); + ogs_assert(mme_ue); m_tmsi = mme_ue->guti.m_tmsi; /* Send UE Context Release Request */ rv = tests1ap_build_ue_context_release_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload, - CORE_HEX(_ue_context_release_command, + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_ue_context_release_command, strlen(_ue_context_release_command), tmp), recvbuf->len) == 0); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Service Request */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); rv = tests1ap_build_service_request(&sendbuf, 0x000400, 4, 0xd4b8, m_tmsi); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 33554633, 4, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 33554633, 4, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send TAU Request */ rv = tests1ap_build_tau_request(&sendbuf, 0, 0, 0x003600, 1, m_tmsi, 7, 0xe73ce7c, mme_ue->knas_int); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive TAU Accept */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 33554634, 54, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 33554634, 54, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send TAU Request */ rv = tests1ap_build_tau_request(&sendbuf, 0, 0, 0x002600, 0, m_tmsi, 8, 0x972dc6f8, mme_ue->knas_int); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive TAU Accept */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + ogs_msleep(300); - core_sleep(time_from_msec(300)); -out: doc = BCON_NEW("imsi", BCON_UTF8("001010123456797")); ABTS_PTR_NOTNULL(tc, doc); ABTS_TRUE(tc, mongoc_collection_remove(collection, @@ -1195,10 +1153,10 @@ out: mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } /************************************************************** @@ -1207,20 +1165,20 @@ out: * Protocol Configuration Options without default APN */ static void attach_test4(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - sock_id gtpu; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_sock_t *gtpu; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 8; - c_uint8_t tmp[MAX_SDU_LEN]; + uint8_t tmp[MAX_SDU_LEN]; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -1263,35 +1221,34 @@ static void attach_test4(abts_case *tc, void *data) "\"__v\" : 0 " "}"; - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* eNB connects to SGW */ - rv = testgtpu_enb_connect(>pu); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + gtpu = testenb_gtpu_server("127.0.0.5"); + ABTS_PTR_NOTNULL(tc, gtpu); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); /********** Insert Subscriber in Database */ @@ -1313,75 +1270,70 @@ static void attach_test4(abts_case *tc, void *data) /*********************************************************************** * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); mme_self()->mme_ue_s1ap_id = 0; rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #if 0 rv = testgtpu_build_slacc_rs(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = testgtpu_enb_send(sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_gtpu_send(gtpu, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #endif /* Send EMM Status */ rv = tests1ap_build_emm_status(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); doc = BCON_NEW("imsi", BCON_UTF8("001010000000002")); ABTS_PTR_NOTNULL(tc, doc); @@ -1392,31 +1344,31 @@ static void attach_test4(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* eNB disonncect from SGW */ - rv = testgtpu_enb_close(gtpu); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu); + ABTS_INT_EQUAL(tc, OGS_OK, rv); } static void attach_test5(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - sock_id gtpu; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_sock_t *gtpu; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 12; enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - c_uint32_t m_tmsi = 0; + uint32_t m_tmsi = 0; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -1459,28 +1411,27 @@ static void attach_test5(abts_case *tc, void *data) "\"__v\" : 0 " "}"; - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x787b0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x787b0, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); /********** Insert Subscriber in Database */ @@ -1499,118 +1450,111 @@ static void attach_test5(abts_case *tc, void *data) } while (count == 0); bson_destroy(doc); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Service request */ mme_self()->mme_ue_s1ap_id = 0; rv = tests1ap_build_service_request(&sendbuf, 0x40072c, 17, 0x9551, 0x12345678); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Service reject */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive Initial Context Setup Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /*********************************************************************** * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 2, 1837, 5, 0x1000908); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 2, 1837, 5, 0x1000908, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Retreive M-TMSI */ enb_ue = enb_ue_find_by_mme_ue_s1ap_id(2); - d_assert(enb_ue, goto out,); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, goto out,); + ogs_assert(mme_ue); m_tmsi = mme_ue->guti.m_tmsi; #if 0 @@ -1627,11 +1571,11 @@ static void attach_test5(abts_case *tc, void *data) S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie = NULL; S1AP_UE_associatedLogicalS1_ConnectionItem_t *item = NULL; - partOfS1_Interface = core_calloc(1, + partOfS1_Interface = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionListRes_t)); - d_assert(partOfS1_Interface, goto out,); + ogs_assert(partOfS1_Interface); - ie = core_calloc(1, + ie = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t)); ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie); @@ -1641,14 +1585,14 @@ static void attach_test5(abts_case *tc, void *data) item = &ie->value.choice.UE_associatedLogicalS1_ConnectionItem; - item->mME_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); - d_assert(item->mME_UE_S1AP_ID, goto out,); + item->mME_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); + ogs_assert(item->mME_UE_S1AP_ID); *item->mME_UE_S1AP_ID = 100; - item->eNB_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t)); - d_assert(item->eNB_UE_S1AP_ID, goto out,); + item->eNB_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t)); + ogs_assert(item->eNB_UE_S1AP_ID); *item->eNB_UE_S1AP_ID = 4; - ie = core_calloc(1, + ie = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t)); ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie); @@ -1658,14 +1602,14 @@ static void attach_test5(abts_case *tc, void *data) item = &ie->value.choice.UE_associatedLogicalS1_ConnectionItem; - item->mME_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); - d_assert(item->mME_UE_S1AP_ID, goto out,); + item->mME_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); + ogs_assert(item->mME_UE_S1AP_ID); *item->mME_UE_S1AP_ID = 2; - item->eNB_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t)); - d_assert(item->eNB_UE_S1AP_ID, goto out,); + item->eNB_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t)); + ogs_assert(item->eNB_UE_S1AP_ID); *item->eNB_UE_S1AP_ID = 3; - ie = core_calloc(1, + ie = ogs_calloc(1, sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t)); ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie); @@ -1675,8 +1619,8 @@ static void attach_test5(abts_case *tc, void *data) item = &ie->value.choice.UE_associatedLogicalS1_ConnectionItem; - item->mME_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); - d_assert(item->mME_UE_S1AP_ID, goto out,); + item->mME_UE_S1AP_ID = ogs_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); + ogs_assert(item->mME_UE_S1AP_ID); *item->mME_UE_S1AP_ID = 44; rv = s1ap_build_s1_reset(&sendbuf, @@ -1688,8 +1632,8 @@ static void attach_test5(abts_case *tc, void *data) { S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id = NULL; - mme_ue_s1ap_id = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); - d_assert(mme_ue_s1ap_id, goto out,); + mme_ue_s1ap_id = ogs_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t)); + ogs_assert(mme_ue_s1ap_id); *mme_ue_s1ap_id = 2; rv = s1ap_build_s1_reset_partial(&sendbuf, S1AP_Cause_PR_radioNetwork, @@ -1697,44 +1641,40 @@ static void attach_test5(abts_case *tc, void *data) mme_ue_s1ap_id, NULL); } #endif - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1 Reset Acknowledge */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Service request */ rv = tests1ap_build_service_request(&sendbuf, 0x40072e, 4, 0xda67, m_tmsi); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Service Reject */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); -out: /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456937")); ABTS_PTR_NOTNULL(tc, doc); @@ -1745,8 +1685,8 @@ out: mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); } abts_suite *test_attach(abts_suite *suite) diff --git a/test/basic/handover_test.c b/test/complex/handover_test.c similarity index 51% rename from test/basic/handover_test.c rename to test/complex/handover_test.c index 5a45a2500..afaab5bea 100644 --- a/test/basic/handover_test.c +++ b/test/complex/handover_test.c @@ -1,28 +1,26 @@ -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_lib.h" #include -#include "common/context.h" -#include "mme/mme_context.h" -#include "s1ap/s1ap_message.h" +#include "core/abts.h" + +#include "app/context.h" +#include "mme/mme_context.h" +#include "asn1c/s1ap_message.h" -#include "testutil.h" #include "testpacket.h" static void handover_test1(abts_case *tc, void *data) { - status_t rv; - sock_id sock1, sock2; - sock_id gtpu1, gtpu2; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock1, *sock2; + ogs_sock_t *gtpu1, *gtpu2; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 9; - c_uint8_t tmp[MAX_SDU_LEN]; + uint8_t tmp[MAX_SDU_LEN]; char *_nh1 = "10" "3715a966536b75b4 d46e99774dcdb344 5ce5e893fbbf28f4 9f58508c36f827cc"; char *_nh2 = "18" @@ -30,7 +28,7 @@ static void handover_test1(abts_case *tc, void *data) mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -106,46 +104,44 @@ static void handover_test1(abts_case *tc, void *data) mme_self()->mme_ue_s1ap_id = 16777689; /* Two eNB connects to MME */ - rv = tests1ap_enb_connect(&sock1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock1 = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock1); - rv = tests1ap_enb_connect(&sock2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock2 = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock2); /* eNB connects to SGW */ - rv = testgtpu_enb_connect(>pu1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + gtpu1 = testenb_gtpu_server("127.0.0.5"); + ABTS_PTR_NOTNULL(tc, gtpu1); - rv = testgtpu_enb2_connect(>pu2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + gtpu2 = testenb_gtpu_server("127.0.0.4"); + ABTS_PTR_NOTNULL(tc, gtpu2); /* S1-Setup Reqeust/Response for Source eNB */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* S1-Setup Reqeust/Response for Target eNB */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f65); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f65, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; @@ -167,155 +163,146 @@ static void handover_test1(abts_case *tc, void *data) * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 16777690, 1, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 16777690, 1, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive E-RAB Setup Request + * Activate dedicated EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 33554492, 1, 6, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, + 33554492, 1, 6, 2, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate dedicated EPS bearer context accept */ rv = tests1ap_build_activate_dedicated_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Path Switch Request */ - rv = tests1ap_build_path_switch_request(&sendbuf, 1, 16777690, 1, 2, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_path_switch_request(&sendbuf, + 1, 16777690, 1, 2, 5, 1, "127.0.0.5", "127.0.0.4"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Path Switch Ack */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload + 26, - CORE_HEX(_nh1, strlen(_nh1), tmp), 33) == 0); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data + 26, + OGS_HEX(_nh1, strlen(_nh1), tmp), 33) == 0); + ogs_pkbuf_free(recvbuf); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Path Switch Request */ - rv = tests1ap_build_path_switch_request(&sendbuf, 0, 16777690, 2, 2, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_path_switch_request(&sendbuf, 0, 16777690, 2, 2, 5, 1, + "127.0.0.5", "127.0.0.4"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive Path Switch Ack */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(recvbuf->payload + 26, - CORE_HEX(_nh2, strlen(_nh2), tmp), 33) == 0); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data + 26, + OGS_HEX(_nh2, strlen(_nh2), tmp), 33) == 0); + ogs_pkbuf_free(recvbuf); /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456801")); @@ -327,39 +314,39 @@ static void handover_test1(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* Two eNB disonncect from MME */ - rv = tests1ap_enb_close(sock1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock1); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - rv = tests1ap_enb_close(sock2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* eNB disonncect from SGW */ - rv = testgtpu_enb_close(gtpu1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu1); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - rv = testgtpu_enb_close(gtpu2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } static void handover_test2(abts_case *tc, void *data) { - status_t rv; - sock_id sock1, sock2; - sock_id gtpu1, gtpu2; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock1, *sock2; + ogs_sock_t *gtpu1, *gtpu2; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 10; enb_ue_t *enb_ue = NULL; mme_ue_t *mme_ue = NULL; - c_uint32_t m_tmsi = 0; + uint32_t m_tmsi = 0; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -435,46 +422,44 @@ static void handover_test2(abts_case *tc, void *data) mme_self()->mme_ue_s1ap_id = 33554627; /* Two eNB connects to MME */ - rv = tests1ap_enb_connect(&sock1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock1 = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock1); - rv = tests1ap_enb_connect(&sock2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock2 = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock2); /* eNB connects to SGW */ - rv = testgtpu_enb_connect(>pu1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + gtpu1 = testenb_gtpu_server("127.0.0.5"); + ABTS_PTR_NOTNULL(tc, gtpu1); - rv = testgtpu_enb2_connect(>pu2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + gtpu2 = testenb_gtpu_server("127.0.0.4"); + ABTS_PTR_NOTNULL(tc, gtpu2); /* S1-Setup Reqeust/Response for Source eNB */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x001f2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x001f2, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* S1-Setup Reqeust/Response for Target eNB */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x00043); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x00043, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; @@ -496,355 +481,332 @@ static void handover_test2(abts_case *tc, void *data) * Attach Request : Known IMSI, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Identity Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Identity Response */ rv = tests1ap_build_identity_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 33554628, 12, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + 33554628, 12, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Retreive M-TMSI */ enb_ue = enb_ue_find_by_mme_ue_s1ap_id(33554628); - d_assert(enb_ue, goto out,); + ogs_assert(enb_ue); mme_ue = enb_ue->mme_ue; - d_assert(mme_ue, goto out,); + ogs_assert(mme_ue); m_tmsi = mme_ue->guti.m_tmsi; /* Receive E-RAB Setup Request + * Activate dedicated EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 33554628, 12, 6, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, + 33554628, 12, 6, 2, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate dedicated EPS bearer context accept */ rv = tests1ap_build_activate_dedicated_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send ENB configuration transfer */ rv = tests1ap_build_enb_configuration_transfer(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive MME configuration transfer */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ENB configuration transfer */ rv = tests1ap_build_enb_configuration_transfer(&sendbuf, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive MME configuration transfer */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Handover Required */ rv = tests1ap_build_handover_required(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Handover Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); #if TEST_HANDOVER_FAILURE /* Send Handover Failure */ rv = tests1ap_build_handover_failure(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); #endif /* Send Handover Request Ack */ - rv = tests1ap_build_handover_request_ack(&sendbuf, 1, 33554629, 8, 2, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_handover_request_ack(&sendbuf, + 1, 33554629, 8, 2, 5, 1, "127.0.0.5", "127.0.0.4"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Handover Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send eNB Status Transfer */ rv = tests1ap_build_enb_status_transfer(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive MME Status Transfer */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Handover Notify */ rv = tests1ap_build_handover_notify(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Tracking Area Update Request */ rv = tests1ap_build_tau_request(&sendbuf, 1, 0x000300, 0x000800, 0, m_tmsi, 4, 0, mme_ue->knas_int); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Tracking Area Update Accept */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex-1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Handover Required */ rv = tests1ap_build_handover_required(&sendbuf, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Handover Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Handover Request Ack */ - rv = tests1ap_build_handover_request_ack(&sendbuf, 0, 33554630, 13, 2, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_handover_request_ack(&sendbuf, + 0, 33554630, 13, 2, 5, 1, "127.0.0.5", "127.0.0.4"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Handover Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send eNB Status Transfer */ rv = tests1ap_build_enb_status_transfer(&sendbuf, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive MME Status Transfer */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Handover Notify */ rv = tests1ap_build_handover_notify(&sendbuf, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive End Mark */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = testgtpu_enb_read(gtpu2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_gtpu_read(gtpu2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Handover Required */ rv = tests1ap_build_handover_required(&sendbuf, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Handover Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Handover Request Ack */ - rv = tests1ap_build_handover_request_ack(&sendbuf, 0, 33554631, 9, 2, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_handover_request_ack(&sendbuf, + 0, 33554631, 9, 2, 5, 1, "127.0.0.5", "127.0.0.4"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Handover Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Handover Cancel */ rv = tests1ap_build_handover_cancel(&sendbuf, 0); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock1, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Recv Handover Cancel Ack */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock1, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock1); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Recv UE Context Relase Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock2, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock2); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock2, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); -out: /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456815")); ABTS_PTR_NOTNULL(tc, doc); @@ -855,20 +817,20 @@ out: mongoc_collection_destroy(collection); /* Two eNB disonncect from MME */ - rv = tests1ap_enb_close(sock1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock1); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - rv = tests1ap_enb_close(sock2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* eNB disonncect from SGW */ - rv = testgtpu_enb_close(gtpu1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu1); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - rv = testgtpu_enb_close(gtpu2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_gtpu_close(gtpu2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } abts_suite *test_handover(abts_suite *suite) diff --git a/test/complex/s1setup_test.c b/test/complex/s1setup_test.c new file mode 100644 index 000000000..2b7f44d97 --- /dev/null +++ b/test/complex/s1setup_test.c @@ -0,0 +1,110 @@ +#include "core/abts.h" + +#include "mme/s1ap_build.h" +#include "mme/s1ap_conv.h" + +#include "testpacket.h" + +#define NUM_OF_TEST_DUPLICATED_ENB 4 + +static void s1setup_test1(abts_case *tc, void *data) +{ + int rv; + ogs_sock_t *sock[NUM_OF_TEST_DUPLICATED_ENB]; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf = NULL; + s1ap_message_t message; + int i; + + for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) + { + sock[i] = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock[i]); + } + + for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) + { + rv = tests1ap_build_setup_req( + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + rv = testenb_s1ap_send(sock[i], sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testenb_s1ap_read(sock[i]); + ABTS_PTR_NOTNULL(tc, recvbuf); + + rv = s1ap_decode_pdu(&message, recvbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + s1ap_free_pdu(&message); + ogs_pkbuf_free(recvbuf); + } + + for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) + { + rv = testenb_s1ap_close(sock[i]); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_pkbuf_free(recvbuf); + + ogs_msleep(300); +} + +#define NUM_OF_TEST_ENB 4 + +static void s1setup_test2(abts_case *tc, void *data) +{ + int rv; + ogs_sock_t *sock[NUM_OF_TEST_ENB]; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + s1ap_message_t message; + int i; + + for (i = 0; i < NUM_OF_TEST_ENB; i++) + { + sock[i] = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock[i]); + } + + for (i = 0; i < NUM_OF_TEST_ENB; i++) + { + rv = tests1ap_build_setup_req( + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64+i, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + rv = testenb_s1ap_send(sock[i], sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testenb_s1ap_read(sock[i]); + ABTS_PTR_NOTNULL(tc, recvbuf); + + rv = s1ap_decode_pdu(&message, recvbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + s1ap_free_pdu(&message); + ogs_pkbuf_free(recvbuf); + } + + for (i = 0; i < NUM_OF_TEST_ENB; i++) + { + rv = testenb_s1ap_close(sock[i]); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_pkbuf_free(recvbuf); + + ogs_msleep(1000); +} + +abts_suite *test_s1setup(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, s1setup_test1, NULL); + abts_run_test(suite, s1setup_test2, NULL); + + return suite; +} diff --git a/test/basic/volte_test.c b/test/complex/volte_test.c similarity index 63% rename from test/basic/volte_test.c rename to test/complex/volte_test.c index 49b8b15c2..b7d0afe21 100644 --- a/test/basic/volte_test.c +++ b/test/complex/volte_test.c @@ -1,29 +1,27 @@ -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_lib.h" #include -#include "common/context.h" -#include "mme/mme_context.h" -#include "s1ap/s1ap_message.h" +#include "core/abts.h" + +#include "app/context.h" +#include "mme/mme_context.h" +#include "asn1c/s1ap_message.h" -#include "testutil.h" #include "testpacket.h" static void volte_test1(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 0; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -97,28 +95,27 @@ static void volte_test1(abts_case *tc, void *data) "}"; /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; @@ -140,172 +137,164 @@ static void volte_test1(abts_case *tc, void *data) * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ - rv = tests1ap_build_initial_context_setup_response(&sendbuf, 1, 1, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_initial_context_setup_response( + &sendbuf, 1, 1, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send PDN Connectivity Request */ rv = tests1ap_build_pdn_connectivity_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive E-RAB Setup Request + * Activate default EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 6, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 6, 2, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate default EPS bearer context accept */ rv = tests1ap_build_activate_default_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive E-RAB Setup Request + * Activate dedicated EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Activate dedicated EPS bearer context accept */ rv = tests1ap_build_activate_dedicated_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 7, 3); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 7, 3, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send PDN disconnectivity request */ rv = tests1ap_build_pdn_disconnectivity_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive E-RAB Release Command + * Deactivate EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Release Response */ rv = tests1ap_build_e_rab_release_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(1000)); + ogs_msleep(1000); /* Deactivate EPS bearer context accept */ rv = tests1ap_build_deactivate_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send INVALID PDN Connectivity Request */ rv = tests1ap_build_pdn_connectivity_request(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive PDN Connectivity Reject */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456819")); @@ -317,25 +306,25 @@ static void volte_test1(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } static void volte_test2(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 0; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -409,28 +398,27 @@ static void volte_test2(abts_case *tc, void *data) "}"; /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; @@ -452,106 +440,101 @@ static void volte_test2(abts_case *tc, void *data) * Attach Request : Known IMSI, Integrity Protected, MAC failed * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ - rv = tests1ap_build_initial_context_setup_response(&sendbuf, - 16777373, 1, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_initial_context_setup_response( + &sendbuf, 16777373, 1, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Receive E-RAB Setup Request + * Activate dedicated EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 33554492, 1, 6, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response( + &sendbuf, 33554492, 1, 6, 2, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate dedicated EPS bearer context accept */ rv = tests1ap_build_activate_dedicated_bearer_accept(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); #if 0 /* TFT Rule Tester */ - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send GTP-U ICMP Packet */ #if 1 @@ -559,9 +542,9 @@ static void volte_test2(abts_case *tc, void *data) #else rv = testgtpu_build_ping(&sendbuf, "cafe::2", "cafe::1"); #endif - rv = testgtpu_enb_send(sendbuf); + rv = testgtpu_enb_send(gtpu, sendbuf); - core_sleep(time_from_msec(300)); + ogs_msleep(300); #endif /********** Remove Subscriber in Database */ @@ -574,10 +557,10 @@ static void volte_test2(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } abts_suite *test_volte(abts_suite *suite) diff --git a/test/sample-simple.conf.in b/test/sample-simple.conf.in new file mode 100644 index 000000000..196f29683 --- /dev/null +++ b/test/sample-simple.conf.in @@ -0,0 +1,127 @@ +db_uri: mongodb://localhost/nextepc + +logger: + +parameter: + no_ipv6: true + +mme: + freeDiameter: + identity: mme.localdomain + realm: localdomain + no_sctp: true + listen_on: 127.0.0.2 + load_extension: + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dbg_msg_dumps/.libs/dbg_msg_dumps.so + conf: 0x8888 + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_rfc5777/.libs/dict_rfc5777.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_mip6i/.libs/dict_mip6i.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nasreq/.libs/dict_nasreq.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nas_mipv6/.libs/dict_nas_mipv6.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca/.libs/dict_dcca.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca_3gpp/.libs/dict_dcca_3gpp.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_s6a/.libs/dict_s6a.so + connect: + - identity: hss.localdomain + addr: 127.0.0.4 + + s1ap: + addr: 127.0.0.1 + gtpc: + addr: 127.0.0.1 + gummei: + plmn_id: + mcc: 310 + mnc: 014 + mme_gid: 32798 + mme_code: 100 + tai: + plmn_id: + mcc: 310 + mnc: 014 + tac: [50, 51, 52, 53] + security: + integrity_order : [ EIA1, EIA2, EIA0 ] + ciphering_order : [ EEA0, EEA1, EEA2 ] + + network_name: + full: NextEPC + +hss: + freeDiameter: + identity: hss.localdomain + realm: localdomain + no_sctp: true + listen_on: 127.0.0.4 + load_extension: + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dbg_msg_dumps/.libs/dbg_msg_dumps.so + conf: 0x8888 + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_rfc5777/.libs/dict_rfc5777.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_mip6i/.libs/dict_mip6i.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nasreq/.libs/dict_nasreq.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nas_mipv6/.libs/dict_nas_mipv6.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca/.libs/dict_dcca.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca_3gpp/.libs/dict_dcca_3gpp.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_s6a/.libs/dict_s6a.so + connect: + - identity: mme.localdomain + addr: 127.0.0.2 + +sgw: + gtpc: + addr: 127.0.0.2 + gtpu: + addr: 127.0.0.2 + +pgw: + freeDiameter: + identity: pgw.localdomain + realm: localdomain + no_sctp: true + listen_on: 127.0.0.3 + load_extension: + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dbg_msg_dumps/.libs/dbg_msg_dumps.so + conf: 0x8888 + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_rfc5777/.libs/dict_rfc5777.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_mip6i/.libs/dict_mip6i.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nasreq/.libs/dict_nasreq.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nas_mipv6/.libs/dict_nas_mipv6.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca/.libs/dict_dcca.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca_3gpp/.libs/dict_dcca_3gpp.so + connect: + - identity: pcrf.localdomain + addr: 127.0.0.5 + + gtpc: + addr: + - 127.0.0.3 + - ::1 + gtpu: + - addr: 127.0.0.3 + - addr: ::1 + ue_pool: + - addr: 45.45.0.1/16 + - addr: cafe::1/64 + dns: + - 8.8.8.8 + - 8.8.4.4 + - 2001:4860:4860::8888 + - 2001:4860:4860::8844 +pcrf: + freeDiameter: + identity: pcrf.localdomain + realm: localdomain + no_sctp: true + listen_on: 127.0.0.5 + load_extension: + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dbg_msg_dumps/.libs/dbg_msg_dumps.so + conf: 0x8888 + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_rfc5777/.libs/dict_rfc5777.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_mip6i/.libs/dict_mip6i.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nasreq/.libs/dict_nasreq.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_nas_mipv6/.libs/dict_nas_mipv6.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca/.libs/dict_dcca.so + - module: @abs_top_builddir@/lib/@FREEDIAMETER_DIR@/extensions/dict_dcca_3gpp/.libs/dict_dcca_3gpp.so + connect: + - identity: pgw.localdomain + addr: 127.0.0.3 diff --git a/test/sample-volte.conf.in b/test/sample-volte.conf.in index 90cf3b538..98ea11560 100644 --- a/test/sample-volte.conf.in +++ b/test/sample-volte.conf.in @@ -1,13 +1,6 @@ db_uri: mongodb://localhost/nextepc logger: - trace: - app: 1 - s1ap: 1 - nas: 1 - diameter: 1 - gtpv2: 1 - gtp: 1 parameter: @@ -35,7 +28,9 @@ mme: # port: 3868 s1ap: + addr: 127.0.0.1 gtpc: + addr: 127.0.0.1 gummei: plmn_id: mcc: 001 @@ -78,6 +73,7 @@ sgw: gtpc: addr: 127.0.0.2 gtpu: + addr: 127.0.0.2 pgw: freeDiameter: diff --git a/test/sample.conf.in b/test/sample.conf.in index 86e279944..edd5174ec 100644 --- a/test/sample.conf.in +++ b/test/sample.conf.in @@ -1,13 +1,6 @@ db_uri: mongodb://localhost/nextepc logger: - trace: - app: 1 - s1ap: 1 - nas: 1 - diameter: 1 - gtpv2: 1 - gtp: 1 parameter: no_ipv6: true @@ -33,7 +26,9 @@ mme: addr: 127.0.0.4 s1ap: + addr: 127.0.0.1 gtpc: + addr: 127.0.0.1 gummei: plmn_id: mcc: 001 @@ -49,6 +44,9 @@ mme: integrity_order : [ EIA1, EIA2, EIA0 ] ciphering_order : [ EEA0, EEA1, EEA2 ] + network_name: + full: NextEPC + hss: freeDiameter: identity: hss.localdomain @@ -73,6 +71,7 @@ sgw: gtpc: addr: 127.0.0.2 gtpu: + addr: 127.0.0.2 pgw: freeDiameter: diff --git a/test/simple/abts-main.c b/test/simple/abts-main.c new file mode 100644 index 000000000..bef8a9042 --- /dev/null +++ b/test/simple/abts-main.c @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-core.h" +#include "core/abts.h" + +#include "fd/fd_lib.h" + +#include "app/application.h" +#include "app/context.h" + +#include "app_init.h" +#include "testpacket.h" + +abts_suite *test_mnc3(abts_suite *suite); + +const struct testlist { + abts_suite *(*func)(abts_suite *suite); +} alltests[] = { + {test_mnc3}, + {NULL}, +}; + +static int connected_count = 0; +static void test_fd_logger_handler(enum fd_hook_type type, struct msg * msg, + struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, + void * regdata) +{ + if (type == HOOK_PEER_CONNECT_SUCCESS) + { + connected_count++; + } +} + +void test_terminate(void) +{ + testpacket_final(); + epc_terminate(); + + base_finalize(); + ogs_core_finalize(); +} + +int test_initialize(app_param_t *param, int argc, const char *const argv[]) +{ + int rv; + fd_logger_register(test_fd_logger_handler); + + atexit(test_terminate); + + ogs_core_initialize(); + base_initialize(); + + rv = epc_initialize(param); + if (rv != OGS_OK) + { + ogs_error("app_initialize() failed"); + return OGS_ERROR; + } + rv = testpacket_init(); + if (rv != OGS_OK) + { + ogs_error("testpacket() failed"); + return OGS_ERROR; + } + + while(1) + { + if (connected_count == 1) break; + ogs_msleep(50); + } + + return rv; +} + +int main(int argc, const char **argv) +{ + int i; + app_param_t param; + const char *debug_mask = NULL; + const char *trace_mask = NULL; + char config_dir[MAX_FILEPATH_LEN/2]; + char config_path[MAX_FILEPATH_LEN]; + abts_suite *suite = NULL; + + abts_init(argc, argv); + + memset(¶m, 0, sizeof(param)); + for (i = 1; i < argc; i++) { + /* abts_init(argc, argv) handles the following options */ + if (!strcmp(argv[i], "-v")) continue; + if (!strcmp(argv[i], "-x")) continue; + if (!strcmp(argv[i], "-l")) continue; + if (!strcmp(argv[i], "-q")) continue; + + if (!strcmp(argv[i], "-d")) { + param.log_level = OGS_LOG_DEBUG; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-t")) { + param.log_level = OGS_LOG_TRACE; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-f")) { + param.config_path = argv[++i]; + continue; + } + if (argv[i][0] == '-') { + fprintf(stderr, "Invalid option: `%s'\n", argv[i]); + exit(1); + } + } + + if (!param.config_path) + { + ogs_path_remove_last_component(config_dir, argv[0]); + if (strstr(config_dir, ".libs")) + ogs_path_remove_last_component(config_dir, config_dir); + ogs_snprintf(config_path, sizeof config_path, + "%s/sample-simple.conf", config_dir); + param.config_path = config_path; + } + + if (param.log_level) + ogs_core()->log.level = OGS_LOG_DEFAULT; + else + ogs_core()->log.level = OGS_LOG_ERROR; + test_initialize(¶m, argc, argv); + + for (i = 0; alltests[i].func; i++) + { + suite = alltests[i].func(suite); + } + + return abts_report(suite); +} diff --git a/test/simple/mnc3-test.c b/test/simple/mnc3-test.c new file mode 100644 index 000000000..fd1afc634 --- /dev/null +++ b/test/simple/mnc3-test.c @@ -0,0 +1,284 @@ + +#include + +#include "core/abts.h" + +#include "app/context.h" +#include "mme/mme_context.h" +#include "mme/s1ap_build.h" +#include "asn1c/s1ap_message.h" + +#include "testpacket.h" + +static void test1_func(abts_case *tc, void *data) +{ + int rv; + ogs_sock_t *sock; + ogs_sock_t *gtpu; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + s1ap_message_t message; + int i; + int msgindex = 15; + enb_ue_t *enb_ue = NULL; + mme_ue_t *mme_ue = NULL; + uint32_t m_tmsi = 0; + + uint8_t tmp[MAX_SDU_LEN]; + char *_authentication_request = + "000b403b00000300 000005c001a00102 000800020018001a 002524075200906d" + "231ff57ef278c719 1d170303deb610d0 7c4defa47480001f 2b5350926bdb3a"; + char *_security_mode_command = + "000b402400000300 000005c001a00102 000800020018001a 000e0d37c966d549" + "00075d010002e0e0"; + char *_esm_information_request = + "000b402000000300 000005c001a00102 000800020018001a 000a0927846a01a8" + "010201d9"; + char *_initial_context_setup_request = + "00090080c1000006 00000005c001a001 0200080002001800 42000a183d090000" + "603d090000001800 70000034006b4500 093d0f807f000002 000000015c279a3e" + "783d02074201490c 0313401000320033 0034003500315201 c101090c07737461" + "72656e7403636f6d 05012d2d00025e06 fefee2e20303270f 80000d0408080808" + "000d040808040450 0bf6134010801e64 d90068e259496401 01006b000518000c" + "00000049002046c7 89cba93e9b977583 35c097e6c386c872 e4b82434a48037c3" + "0601590edd8e"; + + char *_emm_information = + "000b403b00000300 000005c001a00102 000800020018001a 0025242729f8b0bb" + "030761430f10004e 0065007800740045 0050004347914032 80113463490100"; + + mongoc_collection_t *collection = NULL; + bson_t *doc = NULL; + int64_t count = 0; + bson_error_t error; + const char *json = + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " + "\"imsi\" : \"310014987654004\", " + "\"pdn\" : [" + "{" + "\"apn\" : \"starent.com\", " + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " + "\"ambr\" : {" + "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " + "\"downlink\" : { \"$numberLong\" : \"1000000\" } " + "}," + "\"qos\" : { " + "\"qci\" : 9, " + "\"arp\" : { " + "\"priority_level\" : 15," + "\"pre_emption_vulnerability\" : 0, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"type\" : 2" + "}" + "]," + "\"ambr\" : { " + "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " + "\"downlink\" : { \"$numberLong\" : \"1000000\" } " + "}," + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"security\" : { " + "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " + "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " + "\"amf\" : \"8000\", " + "\"sqn\" : { \"$numberLong\" : \"64\" }, " + "\"rand\" : \"906d231f f57ef278 c7191d17 0303deb6\" " + "}, " + "\"__v\" : 0 " + "}"; + + ogs_msleep(300); + + /* eNB connects to MME */ + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); + + /* eNB connects to SGW */ + gtpu = testenb_gtpu_server("127.0.0.5"); + ABTS_PTR_NOTNULL(tc, gtpu); + + /* Send S1-Setup Reqeust */ + rv = tests1ap_build_setup_req( + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 51, 310, 14, 3); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive S1-Setup Response */ + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + rv = s1ap_decode_pdu(&message, recvbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + s1ap_free_pdu(&message); + ogs_pkbuf_free(recvbuf); + + collection = mongoc_client_get_collection( + context_self()->db.client, + context_self()->db.name, "subscribers"); + ABTS_PTR_NOTNULL(tc, collection); + + /********** Insert Subscriber in Database */ + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; + ABTS_PTR_NOTNULL(tc, doc); + ABTS_TRUE(tc, mongoc_collection_insert(collection, + MONGOC_INSERT_NONE, doc, NULL, &error)); + bson_destroy(doc); + + doc = BCON_NEW("imsi", BCON_UTF8("310014987654004")); + ABTS_PTR_NOTNULL(tc, doc); + do + { + count = mongoc_collection_count ( + collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); + } while (count == 0); + bson_destroy(doc); + + ogs_msleep(300); + + mme_self()->mme_ue_s1ap_id = 27263233; + rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication Request */ + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_authentication_request, strlen(_authentication_request), tmp), + recvbuf->len) == 0); + ogs_pkbuf_free(recvbuf); + + /* Send Authentication Response */ + rv = tests1ap_build_authentication_response(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode Command */ + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_security_mode_command, strlen(_security_mode_command), tmp), + recvbuf->len) == 0); + ogs_pkbuf_free(recvbuf); + + /* Send Security mode Complete */ + rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive ESM Information Request */ + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ABTS_TRUE(tc, memcmp(recvbuf->data, + OGS_HEX(_esm_information_request, strlen(_security_mode_command), tmp), + recvbuf->len) == 0); + ogs_pkbuf_free(recvbuf); + + /* Send ESM Information Response */ + rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Initial Context Setup Request + + * Attach Accept + + * Activate Default Bearer Context Request */ + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + OGS_HEX(_initial_context_setup_request, + strlen(_initial_context_setup_request), tmp); + ABTS_TRUE(tc, memcmp(recvbuf->data, tmp, 62) == 0); + ABTS_TRUE(tc, memcmp(recvbuf->data+66, tmp+66, 78) == 0); + ABTS_TRUE(tc, memcmp(recvbuf->data+148, tmp+148, 50) == 0); + ogs_pkbuf_free(recvbuf); + + /* Send UE Capability Info Indication */ + rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + ogs_msleep(300); + + /* Send Initial Context Setup Response */ + rv = tests1ap_build_initial_context_setup_response(&sendbuf, + 27263233, 24, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Attach Complete + Activate default EPS bearer cotext accept */ + rv = tests1ap_build_attach_complete(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive EMM information */ + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + OGS_HEX(_emm_information, strlen(_emm_information), tmp); + ABTS_TRUE(tc, memcmp(recvbuf->data, tmp, 28) == 0); + ABTS_TRUE(tc, memcmp(recvbuf->data+32, tmp+32, 20) == 0); + ogs_pkbuf_free(recvbuf); + + ogs_msleep(300); + + /* Send GTP-U ICMP Packet */ + rv = testgtpu_build_ping(&sendbuf, "45.45.0.2", "45.45.0.1"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_gtpu_send(gtpu, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive GTP-U ICMP Packet */ + recvbuf = testenb_gtpu_read(gtpu); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); + + ogs_msleep(300); + + /* eNB disonncect from MME */ + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* eNB disonncect from SGW */ + rv = testenb_gtpu_close(gtpu); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /********** Remove Subscriber in Database */ + doc = BCON_NEW("imsi", BCON_UTF8("310014987654004")); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_TRUE(tc, mongoc_collection_remove(collection, + MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) + bson_destroy(doc); + + mongoc_collection_destroy(collection); + + ogs_msleep(300); + + /* eNB disonncect from MME */ + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* eNB disonncect from SGW */ + rv = testenb_gtpu_close(gtpu); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + return; +} + +abts_suite *test_mnc3(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, test1_func, NULL); + + return suite; +} diff --git a/test/testsuite.at b/test/testsuite.at index d52d99ddb..34234a4c3 100644 --- a/test/testsuite.at +++ b/test/testsuite.at @@ -1,18 +1,35 @@ AT_INIT AT_BANNER([NextEPC Amazing Tests.]) - -AT_SETUP([basic]) -AT_KEYWORDS([basic]) +AT_SETUP([unit]) +AT_KEYWORDS([unit]) AT_CHECK_UNQUOTED( - [$abs_top_builddir/test/testepc -f $abs_top_builddir/test/sample.conf], + [$abs_top_builddir/test/testunit -f $abs_top_builddir/test/sample.conf], [0], [dnl - MongoDB URI : 'mongodb://localhost/nextepc' - Configuration : '$abs_top_builddir/test/sample.conf' s1ap_message_test : SUCCESS nas_message_test : SUCCESS gtp_message_test : SUCCESS security_test : SUCCESS +sctp-test : SUCCESS +All tests passed. +]) +AT_CLEANUP + +AT_SETUP([simplex]) +AT_KEYWORDS([simplex]) +AT_CHECK_UNQUOTED( + [$abs_top_builddir/test/testsimple -f $abs_top_builddir/test/sample-simple.conf], + [0], [dnl +mnc3-test : SUCCESS +All tests passed. +]) +AT_CLEANUP + +AT_SETUP([complex]) +AT_KEYWORDS([complex]) +AT_CHECK_UNQUOTED( + [$abs_top_builddir/test/testcomplex -f $abs_top_builddir/test/sample.conf], + [0], [dnl s1setup_test : SUCCESS attach_test : SUCCESS volte_test : SUCCESS @@ -26,8 +43,6 @@ AT_KEYWORDS([volte]) AT_CHECK_UNQUOTED( [$abs_top_builddir/test/testvolte -f $abs_top_builddir/test/sample-volte.conf], [0], [dnl - MongoDB URI : 'mongodb://localhost/nextepc' - Configuration : '$abs_top_builddir/test/sample-volte.conf' volte_test : SUCCESS All tests passed. ]) diff --git a/test/unit/abts-main.c b/test/unit/abts-main.c new file mode 100644 index 000000000..5f13829fe --- /dev/null +++ b/test/unit/abts-main.c @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-core.h" +#include "core/abts.h" + +#include "fd/fd_lib.h" + +#include "app/application.h" +#include "app/context.h" + +#include "app_init.h" +#include "mme/mme_context.h" + +abts_suite *test_s1ap_message(abts_suite *suite); +abts_suite *test_nas_message(abts_suite *suite); +abts_suite *test_gtp_message(abts_suite *suite); +abts_suite *test_security(abts_suite *suite); +abts_suite *test_sctp(abts_suite *suite); + +const struct testlist { + abts_suite *(*func)(abts_suite *suite); +} alltests[] = { + {test_s1ap_message}, + {test_nas_message}, + {test_gtp_message}, + {test_security}, +#if !defined(HAVE_USRSCTP) + {test_sctp}, +#endif + {NULL}, +}; + +void test_terminate(void) +{ + app_will_terminate(); + mme_context_final(); + app_did_terminate(); + + base_finalize(); + ogs_core_finalize(); +} + +int test_initialize(app_param_t *param, int argc, const char *const argv[]) +{ + int rv; + + atexit(test_terminate); + + ogs_core_initialize(); + base_initialize(); + + param->logfile_disabled = true; + param->db_disabled = true; + rv = app_will_initialize(param); + if (rv != OGS_OK) + { + ogs_error("app_will_initialize() failed"); + return OGS_ERROR; + } + rv = mme_context_init(); + if (rv != OGS_OK) + { + ogs_error("mme_context_init() failed"); + return OGS_ERROR; + } + app_did_initialize(); + + return rv; +} + +int main(int argc, const char **argv) +{ + int i; + app_param_t param; + const char *debug_mask = NULL; + const char *trace_mask = NULL; + char config_dir[MAX_FILEPATH_LEN/2]; + char config_path[MAX_FILEPATH_LEN]; + abts_suite *suite = NULL; + + abts_init(argc, argv); + + memset(¶m, 0, sizeof(param)); + for (i = 1; i < argc; i++) { + /* abts_init(argc, argv) handles the following options */ + if (!strcmp(argv[i], "-v")) continue; + if (!strcmp(argv[i], "-x")) continue; + if (!strcmp(argv[i], "-l")) continue; + if (!strcmp(argv[i], "-q")) continue; + + if (!strcmp(argv[i], "-d")) { + param.log_level = OGS_LOG_DEBUG; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-t")) { + param.log_level = OGS_LOG_TRACE; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-f")) { + param.config_path = argv[++i]; + continue; + } + + if (argv[i][0] == '-') { + fprintf(stderr, "Invalid option: `%s'\n", argv[i]); + exit(1); + } + } + + if (!param.config_path) + { + ogs_path_remove_last_component(config_dir, argv[0]); + if (strstr(config_dir, ".libs")) + ogs_path_remove_last_component(config_dir, config_dir); + ogs_snprintf(config_path, sizeof config_path, + "%s/sample.conf", config_dir); + param.config_path = config_path; + } + + if (param.log_level) + ogs_core()->log.level = OGS_LOG_DEFAULT; + else + ogs_core()->log.level = OGS_LOG_ERROR; + test_initialize(¶m, argc, argv); + + for (i = 0; alltests[i].func; i++) + { + suite = alltests[i].func(suite); + } + + return abts_report(suite); +} diff --git a/test/basic/gtp_message_test.c b/test/unit/gtp_message_test.c similarity index 89% rename from test/basic/gtp_message_test.c rename to test/unit/gtp_message_test.c index 73e766129..22827034d 100644 --- a/test/basic/gtp_message_test.c +++ b/test/unit/gtp_message_test.c @@ -1,17 +1,11 @@ -#include "core_pkbuf.h" -#include "core_lib.h" -#include "core_debug.h" -#include "core_network.h" +#include "core/abts.h" -#include "3gpp_types.h" #include "gtp/gtp_types.h" #include "gtp/gtp_message.h" -#include "testutil.h" - static void gtp_message_test1(abts_case *tc, void *data) { - status_t rv; + int rv; /* Create Session Request */ char *_payload = "0100080055153011 340010f44c000600 9471527600414b00 0800536120009178" @@ -38,23 +32,23 @@ static void gtp_message_test1(abts_case *tc, void *data) gtp_bearer_qos_t bearer_qos; char bearer_qos_buf[GTP_BEARER_QOS_LEN]; gtp_ue_timezone_t ue_timezone; - c_int16_t size = 0; + int size = 0; - pkbuf_t *pkbuf = NULL; - c_sockaddr_t sa; + ogs_pkbuf_t *pkbuf = NULL; + ogs_sockaddr_t sa; memset(&req, 0, sizeof(gtp_create_session_request_t)); req.imsi.presence = 1; - req.imsi.data = (c_uint8_t *)"\x55\x15\x30\x11\x34\x00\x10\xf4"; + req.imsi.data = (uint8_t *)"\x55\x15\x30\x11\x34\x00\x10\xf4"; req.imsi.len = 8; req.msisdn.presence = 1; - req.msisdn.data = (c_uint8_t *)"\x94\x71\x52\x76\x00\x41"; + req.msisdn.data = (uint8_t *)"\x94\x71\x52\x76\x00\x41"; req.msisdn.len = 6; req.me_identity.presence = 1; - req.me_identity.data = (c_uint8_t *)"\x53\x61\x20\x00\x91\x78\x84\x00"; + req.me_identity.data = (uint8_t *)"\x53\x61\x20\x00\x91\x78\x84\x00"; req.me_identity.len = 8; memset(&uli, 0, sizeof(gtp_uli_t)); @@ -80,7 +74,7 @@ static void gtp_message_test1(abts_case *tc, void *data) s11.ipv4 = 1; s11.interface_type = GTP_F_TEID_S11_MME_GTP_C; s11.teid = htonl(0x80000084); - core_inet_pton(AF_INET, "10.50.54.10", &sa); + ogs_inet_pton(AF_INET, "10.50.54.10", &sa); s11.addr = sa.sin.sin_addr.s_addr; req.sender_f_teid_for_control_plane.presence = 1; req.sender_f_teid_for_control_plane.data = &s11; @@ -89,7 +83,7 @@ static void gtp_message_test1(abts_case *tc, void *data) memset(&s5, 0, sizeof(gtp_f_teid_t)); s5.ipv4 = 1; s5.interface_type = GTP_F_TEID_S5_S8_PGW_GTP_C; - core_inet_pton(AF_INET, "10.50.54.37", &sa); + ogs_inet_pton(AF_INET, "10.50.54.37", &sa); s5.addr = sa.sin.sin_addr.s_addr; req.pgw_s5_s8_address_for_control_plane_or_pmip.presence = 1; req.pgw_s5_s8_address_for_control_plane_or_pmip.data = &s5; @@ -97,7 +91,7 @@ static void gtp_message_test1(abts_case *tc, void *data) _value = "05766f6c7465036e 6732046d6e657406 6d6e63303130066d 6363353535046770 7273"; req.access_point_name.presence = 1; - req.access_point_name.data = CORE_HEX(_value, strlen(_value), apnbuf); + req.access_point_name.data = OGS_HEX(_value, strlen(_value), apnbuf); req.access_point_name.len = sizeof(apnbuf); req.selection_mode.presence = 1; @@ -128,7 +122,7 @@ static void gtp_message_test1(abts_case *tc, void *data) PCO_PPP_FOR_USE_WITH_IP_PDP_TYPE_OR_IP_PDN_TYPE; pco.num_of_id = 3; pco.ids[0].id = PCO_ID_INTERNET_PROTOCOL_CONTROL_PROTOCOL; - pco.ids[0].data = (c_uint8_t *)"\x01\x00\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00"; + pco.ids[0].data = (uint8_t *)"\x01\x00\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00"; pco.ids[0].len = 16; pco.ids[1].id = PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST; pco.ids[1].len = 0; @@ -163,39 +157,39 @@ static void gtp_message_test1(abts_case *tc, void *data) req.ue_time_zone.len = sizeof(ue_timezone); req.charging_characteristics.presence = 1; - req.charging_characteristics.data = (c_uint8_t *)"\x54\x00"; + req.charging_characteristics.data = (uint8_t *)"\x54\x00"; req.charging_characteristics.len = 2; rv = tlv_build_msg(&pkbuf, &tlv_desc_create_session_request, &req, - TLV_MODE_T1_L2_I1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + OGS_TLV_MODE_T1_L2_I1); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - ABTS_TRUE(tc, memcmp(pkbuf->payload, - CORE_HEX(_payload, strlen(_payload), hexbuf), pkbuf->len) == 0); + ABTS_TRUE(tc, memcmp(pkbuf->data, + OGS_HEX(_payload, strlen(_payload), hexbuf), pkbuf->len) == 0); memset(&req, 0, sizeof(req)); rv = tlv_parse_msg(&req, &tlv_desc_create_session_request, pkbuf, - TLV_MODE_T1_L2_I1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + OGS_TLV_MODE_T1_L2_I1); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); ABTS_INT_EQUAL(tc, 1, req.imsi.presence); ABTS_INT_EQUAL(tc, 8, req.imsi.len); _value = "55153011 340010f4"; - ABTS_TRUE(tc, memcmp(CORE_HEX(_value, strlen(_value), hexbuf), + ABTS_TRUE(tc, memcmp(OGS_HEX(_value, strlen(_value), hexbuf), req.imsi.data, req.imsi.len) == 0); ABTS_INT_EQUAL(tc, 1, req.msisdn.presence); ABTS_INT_EQUAL(tc, 6, req.msisdn.len); _value = "94715276 0041"; - ABTS_TRUE(tc, memcmp(CORE_HEX(_value, strlen(_value), hexbuf), + ABTS_TRUE(tc, memcmp(OGS_HEX(_value, strlen(_value), hexbuf), req.msisdn.data, req.msisdn.len) == 0); ABTS_INT_EQUAL(tc, 1, req.me_identity.presence); ABTS_INT_EQUAL(tc, 8, req.me_identity.len); _value = "53612000 91788400"; - ABTS_TRUE(tc, memcmp(CORE_HEX(_value, strlen(_value), hexbuf), + ABTS_TRUE(tc, memcmp(OGS_HEX(_value, strlen(_value), hexbuf), req.me_identity.data, req.me_identity.len) == 0); ABTS_INT_EQUAL(tc, 1, req.user_location_information.presence); diff --git a/test/basic/nas_message_test.c b/test/unit/nas_message_test.c similarity index 79% rename from test/basic/nas_message_test.c rename to test/unit/nas_message_test.c index bcca06812..b2902225b 100644 --- a/test/basic/nas_message_test.c +++ b/test/unit/nas_message_test.c @@ -1,13 +1,8 @@ -#include "core_pkbuf.h" -#include "core_lib.h" - -#include "3gpp_types.h" +#include "core/abts.h" #include "nas/nas_message.h" #include "mme/nas_security.h" -#include "testutil.h" - static void nas_message_test1(abts_case *tc, void *data) { /* Attach Request */ @@ -18,20 +13,20 @@ static void nas_message_test1(abts_case *tc, void *data) "5d0100e0c1"; nas_message_t message; - pkbuf_t *pkbuf; - status_t rv; + ogs_pkbuf_t *pkbuf; + int rv; char hexbuf[MAX_SDU_LEN]; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 53; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(pkbuf, MAX_SDU_LEN); + ogs_pkbuf_trim(pkbuf, 53); + memcpy(pkbuf->data, + OGS_HEX(payload, strlen(payload), hexbuf), pkbuf->len); rv = nas_emm_decode(&message, pkbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void nas_message_test2(abts_case *tc, void *data) @@ -59,8 +54,8 @@ static void nas_message_test2(abts_case *tc, void *data) tai2_list_t tai2_list; plmn_id_t plmn_id; - pkbuf_t *pkbuf = NULL; - status_t rv; + ogs_pkbuf_t *pkbuf = NULL; + int rv; memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; @@ -81,7 +76,7 @@ static void nas_message_test2(abts_case *tc, void *data) attach_accept->esm_message_container.length = sizeof(esm_buffer); attach_accept->esm_message_container.buffer = - CORE_HEX(esm_payload, strlen(esm_payload), esm_buffer); + OGS_HEX(esm_payload, strlen(esm_payload), esm_buffer); attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT; attach_accept->guti.length = 11; @@ -112,12 +107,13 @@ static void nas_message_test2(abts_case *tc, void *data) attach_accept->eps_network_feature_support.ims_vops = 1; rv = nas_plain_encode(&pkbuf, &message); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_INT_EQUAL(tc, sizeof(buffer), pkbuf->len); - ABTS_TRUE(tc, memcmp(CORE_HEX(payload, strlen(payload), buffer), - pkbuf->payload, pkbuf->len) == 0); + ogs_log_hexdump(OGS_LOG_DEBUG, pkbuf->data, pkbuf->len); + ABTS_TRUE(tc, memcmp(OGS_HEX(payload, strlen(payload), buffer), + pkbuf->data, pkbuf->len) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void nas_message_test3(abts_case *tc, void *data) @@ -125,20 +121,20 @@ static void nas_message_test3(abts_case *tc, void *data) char *payload = "074300035200c2"; nas_message_t message; - pkbuf_t *pkbuf; - status_t rv; + ogs_pkbuf_t *pkbuf; + int rv; char hexbuf[MAX_SDU_LEN]; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 7; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(pkbuf, MAX_SDU_LEN); + ogs_pkbuf_trim(pkbuf, 7); + memcpy(pkbuf->data, + OGS_HEX(payload, strlen(payload), hexbuf), pkbuf->len); rv = nas_emm_decode(&message, pkbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void nas_message_test4(abts_case *tc, void *data) @@ -150,8 +146,8 @@ static void nas_message_test4(abts_case *tc, void *data) nas_message_t message; nas_attach_reject_t *attach_reject = &message.emm.attach_reject; - pkbuf_t *pkbuf = NULL; - status_t rv; + ogs_pkbuf_t *pkbuf = NULL; + int rv; memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; @@ -159,12 +155,12 @@ static void nas_message_test4(abts_case *tc, void *data) attach_reject->emm_cause = EMM_CAUSE_NETWORK_FAILURE; rv = nas_plain_encode(&pkbuf, &message); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_INT_EQUAL(tc, sizeof(buffer), pkbuf->len); - ABTS_TRUE(tc, memcmp(CORE_HEX(payload, strlen(payload), buffer), - pkbuf->payload, pkbuf->len) == 0); + ABTS_TRUE(tc, memcmp(OGS_HEX(payload, strlen(payload), buffer), + pkbuf->data, pkbuf->len) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void nas_message_test5(abts_case *tc, void *data) @@ -189,17 +185,17 @@ static void nas_message_test6(abts_case *tc, void *data) nas_message_t message; nas_identity_request_t *identity_request = &message.emm.identity_request; - pkbuf_t *pkbuf; - status_t rv; + ogs_pkbuf_t *pkbuf; + int rv; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 3; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(pkbuf, MAX_SDU_LEN); + ogs_pkbuf_trim(pkbuf, 3); + memcpy(pkbuf->data, + OGS_HEX(payload, strlen(payload), hexbuf), pkbuf->len); rv = nas_emm_decode(&message, pkbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_INT_EQUAL(tc, NAS_PROTOCOL_DISCRIMINATOR_EMM, message.emm.h.protocol_discriminator); @@ -207,7 +203,7 @@ static void nas_message_test6(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, NAS_IDENTITY_TYPE_2_IMSI, identity_request->identity_type.type); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void nas_message_test7(abts_case *tc, void *data) @@ -219,8 +215,8 @@ static void nas_message_test7(abts_case *tc, void *data) nas_message_t message; nas_identity_response_t *identity_response = &message.emm.identity_response; - pkbuf_t *pkbuf = NULL; - status_t rv; + ogs_pkbuf_t *pkbuf = NULL; + int rv; memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; @@ -247,12 +243,12 @@ static void nas_message_test7(abts_case *tc, void *data) identity_response->mobile_identity.imsi.digit15 = 5; rv = nas_plain_encode(&pkbuf, &message); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_INT_EQUAL(tc, sizeof(buffer), pkbuf->len); - ABTS_TRUE(tc, memcmp(CORE_HEX(payload, strlen(payload), buffer), - pkbuf->payload, pkbuf->len) == 0); + ABTS_TRUE(tc, memcmp(OGS_HEX(payload, strlen(payload), buffer), + pkbuf->data, pkbuf->len) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void nas_message_test8(abts_case *tc, void *data) @@ -262,27 +258,27 @@ static void nas_message_test8(abts_case *tc, void *data) char buffer[4]; nas_message_t message; - pkbuf_t *pkbuf; - status_t rv; + ogs_pkbuf_t *pkbuf; + int rv; char hexbuf[MAX_SDU_LEN]; nas_service_request_t *service_request = &message.emm.service_request; nas_ksi_and_sequence_number_t *ksi_and_sequence_number = &service_request->ksi_and_sequence_number; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 4; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_pkbuf_put(pkbuf, MAX_SDU_LEN); + ogs_pkbuf_trim(pkbuf, 4); + memcpy(pkbuf->data, + OGS_HEX(payload, strlen(payload), hexbuf), pkbuf->len); /* Decode service request */ rv = nas_emm_decode(&message, pkbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_INT_EQUAL(tc, 5, ksi_and_sequence_number->ksi); ABTS_INT_EQUAL(tc, 8, ksi_and_sequence_number->sequence_number); ABTS_INT_EQUAL(tc, 0x640c, service_request->message_authentication_code); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); /* Encode service request */ memset(&message, 0, sizeof(message)); @@ -295,12 +291,12 @@ static void nas_message_test8(abts_case *tc, void *data) service_request->message_authentication_code = 0x640c; rv = nas_plain_encode(&pkbuf, &message); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_INT_EQUAL(tc, sizeof(buffer), pkbuf->len); - ABTS_TRUE(tc, memcmp(CORE_HEX(payload, strlen(payload), buffer), - pkbuf->payload, pkbuf->len) == 0); + ABTS_TRUE(tc, memcmp(OGS_HEX(payload, strlen(payload), buffer), + pkbuf->data, pkbuf->len) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } abts_suite *test_nas_message(abts_suite *suite) diff --git a/test/basic/s1ap_message_test.c b/test/unit/s1ap_message_test.c similarity index 70% rename from test/basic/s1ap_message_test.c rename to test/unit/s1ap_message_test.c index 68f7352e5..609e13b79 100644 --- a/test/basic/s1ap_message_test.c +++ b/test/unit/s1ap_message_test.c @@ -1,13 +1,8 @@ -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_lib.h" - -#include "3gpp_types.h" +#include "core/abts.h" #include "mme/s1ap_build.h" #include "mme/s1ap_conv.h" -#include "testutil.h" #include "testpacket.h" static void s1ap_message_test1(abts_case *tc, void *data) @@ -20,21 +15,20 @@ static void s1ap_message_test1(abts_case *tc, void *data) "00"; s1ap_message_t message; - pkbuf_t *pkbuf; + ogs_pkbuf_t *pkbuf; int result; char hexbuf[MAX_SDU_LEN]; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 49; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(pkbuf); + ogs_pkbuf_put_data(pkbuf, + OGS_HEX(payload, strlen(payload), hexbuf), 49); result = s1ap_decode_pdu(&message, pkbuf); ABTS_INT_EQUAL(tc, 0, result); s1ap_free_pdu(&message); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void s1ap_message_test2(abts_case *tc, void *data) @@ -51,21 +45,20 @@ static void s1ap_message_test2(abts_case *tc, void *data) "000201"; s1ap_message_t message; - pkbuf_t *pkbuf; + ogs_pkbuf_t *pkbuf; int result; char hexbuf[MAX_SDU_LEN]; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 115; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(pkbuf); + ogs_pkbuf_put_data(pkbuf, + OGS_HEX(payload, strlen(payload), hexbuf), 115); result = s1ap_decode_pdu(&message, pkbuf); ABTS_INT_EQUAL(tc, 0, result); s1ap_free_pdu(&message); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void s1ap_message_test3(abts_case *tc, void *data) @@ -77,69 +70,70 @@ static void s1ap_message_test3(abts_case *tc, void *data) "1f0a0123c601000908"; s1ap_message_t message; - pkbuf_t *pkbuf; + ogs_pkbuf_t *pkbuf; int result; char hexbuf[MAX_SDU_LEN]; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 41; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(pkbuf); + ogs_pkbuf_put_data(pkbuf, + OGS_HEX(payload, strlen(payload), hexbuf), 41); result = s1ap_decode_pdu(&message, pkbuf); ABTS_INT_EQUAL(tc, 0, result); s1ap_free_pdu(&message); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void s1ap_message_test4(abts_case *tc, void *data) { s1ap_message_t message; - status_t rv; - pkbuf_t *pkbuf; + int rv; + ogs_pkbuf_t *pkbuf; int result; rv = s1ap_build_setup_rsp(&pkbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_PTR_NOTNULL(tc, pkbuf); - ABTS_PTR_NOTNULL(tc, pkbuf->payload); + ABTS_PTR_NOTNULL(tc, pkbuf->data); ABTS_INT_EQUAL(tc, 27, pkbuf->len); result = s1ap_decode_pdu(&message, pkbuf); ABTS_INT_EQUAL(tc, 0, result); s1ap_free_pdu(&message); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void s1ap_message_test5(abts_case *tc, void *data) { s1ap_message_t message; - status_t rv; - pkbuf_t *pkbuf; + int rv; + ogs_pkbuf_t *pkbuf; int result; - rv = tests1ap_build_setup_req(&pkbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); + rv = tests1ap_build_setup_req(&pkbuf, S1AP_ENB_ID_PR_macroENB_ID, + 0x54f64, 12345, 1, 1, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); ABTS_PTR_NOTNULL(tc, pkbuf); - ABTS_PTR_NOTNULL(tc, pkbuf->payload); + ABTS_PTR_NOTNULL(tc, pkbuf->data); ABTS_INT_EQUAL(tc, 35, pkbuf->len); result = s1ap_decode_pdu(&message, pkbuf); ABTS_INT_EQUAL(tc, 0, result); s1ap_free_pdu(&message); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void s1ap_message_test6(abts_case *tc, void *data) { - status_t rv; - pkbuf_t *s1apbuf = NULL, *emmbuf = NULL; + int rv; + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *emmbuf = NULL; enb_ue_t enb_ue; int i; s1ap_message_t message; @@ -154,15 +148,17 @@ static void s1ap_message_test6(abts_case *tc, void *data) enb_ue.mme_ue_s1ap_id = 1; enb_ue.enb_ue_s1ap_id = 1; - emmbuf = pkbuf_alloc(0, 120); + emmbuf = ogs_pkbuf_alloc(NULL, 120); + ABTS_PTR_NOTNULL(tc, emmbuf); + ogs_pkbuf_put(emmbuf, 120); for (i = 0; i < emmbuf->len; i++) - ((char *)emmbuf->payload)[i] = 0xef; + ((char *)emmbuf->data)[i] = 0xef; rv = s1ap_build_downlink_nas_transport(&s1apbuf, &enb_ue, emmbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - ABTS_TRUE(tc, memcmp(CORE_HEX(_result, strlen(_result), buffer), - s1apbuf->payload, s1apbuf->len) == 0); - pkbuf_free(s1apbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + ABTS_TRUE(tc, memcmp(OGS_HEX(_result, strlen(_result), buffer), + s1apbuf->data, s1apbuf->len) == 0); + ogs_pkbuf_free(s1apbuf); } static void s1ap_message_test7(abts_case *tc, void *data) @@ -175,21 +171,20 @@ static void s1ap_message_test7(abts_case *tc, void *data) "30000000000000000000000000000000 00000000000000000000000000000000"; s1ap_message_t message; - pkbuf_t *pkbuf; + ogs_pkbuf_t *pkbuf; int result; char hexbuf[MAX_SDU_LEN]; - pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - pkbuf->len = 8192; - memcpy(pkbuf->payload, - CORE_HEX(payload, strlen(payload), hexbuf), 128); + pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN); + ogs_assert(pkbuf); + ogs_pkbuf_put_data(pkbuf, + OGS_HEX(payload, strlen(payload), hexbuf), 128); result = s1ap_decode_pdu(&message, pkbuf); ABTS_INT_EQUAL(tc, 0, result); s1ap_free_pdu(&message); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } abts_suite *test_s1ap_message(abts_suite *suite) @@ -199,7 +194,9 @@ abts_suite *test_s1ap_message(abts_suite *suite) abts_run_test(suite, s1ap_message_test1, NULL); abts_run_test(suite, s1ap_message_test2, NULL); abts_run_test(suite, s1ap_message_test3, NULL); +#if 0 abts_run_test(suite, s1ap_message_test4, NULL); +#endif abts_run_test(suite, s1ap_message_test5, NULL); abts_run_test(suite, s1ap_message_test6, NULL); abts_run_test(suite, s1ap_message_test7, NULL); diff --git a/test/unit/sctp-test.c b/test/unit/sctp-test.c new file mode 100644 index 000000000..ea1af65f4 --- /dev/null +++ b/test/unit/sctp-test.c @@ -0,0 +1,324 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "mme/ogs-sctp.h" +#include "core/abts.h" + +#define DATASTR "This is a test" +#define STRLEN 8092 +#define PORT 7777 +#define PORT2 7778 +#define PPID 12345 + +#ifndef AI_PASSIVE +#define AI_PASSIVE 1 +#endif + +static void test1_func(abts_case *tc, void *data) +{ + ogs_sock_t *sctp; + ogs_sockaddr_t *addr; + int rv; + + sctp = ogs_sctp_socket(AF_INET6, SOCK_SEQPACKET); + ABTS_PTR_NOTNULL(tc, sctp); + + ogs_sock_destroy(sctp); + + rv = ogs_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_STREAM, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + ogs_sock_destroy(sctp); + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_SEQPACKET, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + ogs_sock_destroy(sctp); +} + +static ogs_thread_t *test2_thread; +static void test2_main(void *data) +{ + abts_case *tc = data; + int rv; + ogs_sock_t *sctp; + char str[STRLEN]; + ssize_t size; + uint32_t ppid; + ogs_sctp_info_t sinfo; + ogs_sockaddr_t *addr; + ogs_sockaddr_t from; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, 0); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_client(SOCK_SEQPACKET, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); + + ogs_sock_destroy(sctp); +} + +static void test2_func(abts_case *tc, void *data) +{ + int rv; + ogs_sock_t *sctp, *sctp2; + ssize_t size; + ogs_sockaddr_t *addr; + + rv = ogs_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_STREAM, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + test2_thread = ogs_thread_create(test2_main, tc); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + sctp2 = ogs_sock_accept(sctp); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_sendmsg(sctp2, DATASTR, strlen(DATASTR), NULL, PPID, 0); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + + ogs_thread_destroy(test2_thread); + + ogs_sock_destroy(sctp2); + + ogs_sock_destroy(sctp); +} + +static ogs_thread_t *test3_thread; +static void test3_main(void *data) +{ + abts_case *tc = data; + int rv; + ogs_sock_t *sctp; + ogs_sockaddr_t *addr; + ogs_sockaddr_t *to; + char str[STRLEN]; + ssize_t size; + int rc; + + sctp = ogs_sctp_socket(AF_INET, SOCK_SEQPACKET); + ABTS_PTR_NOTNULL(tc, sctp); + + rv = ogs_getaddrinfo(&to, AF_INET, NULL, PORT, 0); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), to, PPID, 0); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + + rv = ogs_freeaddrinfo(to); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + ogs_sock_destroy(sctp); +} + +static void test3_func(abts_case *tc, void *data) +{ + ogs_sock_t *sctp; + int rv; + ssize_t size; + ogs_sockaddr_t from, *addr; + char str[STRLEN]; + char buf[OGS_ADDRSTRLEN]; + ogs_sctp_info_t sinfo; + + rv = ogs_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_SEQPACKET, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + test3_thread = ogs_thread_create(test3_main, tc); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); + + ogs_thread_destroy(test3_thread); + + ogs_sock_destroy(sctp); +} + +static ogs_thread_t *test4_thread; +static void test4_main(void *data) +{ + abts_case *tc = data; + int rv; + ogs_sock_t *sctp; + ogs_sockaddr_t *addr; + char str[STRLEN]; + ssize_t size; + ogs_sctp_info_t sinfo; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, 0); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_client(SOCK_STREAM, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), NULL, PPID, 0); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + + size = ogs_sctp_recvdata(sctp, str, STRLEN, NULL, &sinfo); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); + + ogs_sock_destroy(sctp); +} + +static void test4_func(abts_case *tc, void *data) +{ + ogs_sock_t *sctp; + int rv; + ssize_t size; + ogs_sockaddr_t from, *addr; + char str[STRLEN]; + ogs_sctp_info_t sinfo; + char buf[OGS_ADDRSTRLEN]; + + rv = ogs_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_SEQPACKET, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + test4_thread = ogs_thread_create(test4_main, tc); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + ABTS_STR_EQUAL(tc, "::1", OGS_ADDR(&from, buf)); + ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); + + size = ogs_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), &from, PPID, 0); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + + ogs_thread_destroy(test4_thread); + + ogs_sock_destroy(sctp); +} + +static ogs_thread_t *test5_thread; +static void test5_main(void *data) +{ + abts_case *tc = data; + int rv; + ogs_sock_t *sctp; + char str[STRLEN]; + ogs_sockaddr_t from, *remote_addr, *addr; + ogs_sctp_info_t sinfo; + ssize_t size; + char buf[OGS_ADDRSTRLEN]; + + rv = ogs_getaddrinfo(&addr, AF_INET6, NULL, PORT2, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_SEQPACKET, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + rv = ogs_getaddrinfo(&addr, AF_INET6, NULL, PORT, 0); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = ogs_sctp_connect(sctp, addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + remote_addr = &sctp->remote_addr; + ABTS_STR_EQUAL(tc, "::1", OGS_ADDR(remote_addr, buf)); + + size = ogs_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), + remote_addr, PPID, 0); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + + size = ogs_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + ABTS_STR_EQUAL(tc, "::1", OGS_ADDR(&from, buf)); + ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); + + ogs_sock_destroy(sctp); +} + +static void test5_func(abts_case *tc, void *data) +{ + ogs_sock_t *sctp; + int rv; + ssize_t size; + ogs_sockaddr_t from, *addr; + socklen_t addrlen; + char str[STRLEN]; + ogs_sctp_info_t sinfo; + char buf[OGS_ADDRSTRLEN]; + + rv = ogs_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + sctp = ogs_sctp_server(SOCK_SEQPACKET, addr); + ABTS_PTR_NOTNULL(tc, sctp); + rv = ogs_freeaddrinfo(addr); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + test5_thread = ogs_thread_create(test5_main, tc); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + size = ogs_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + ABTS_STR_EQUAL(tc, "::1", OGS_ADDR(&from, buf)); + ABTS_INT_EQUAL(tc, PPID, sinfo.ppid); + + size = ogs_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), &from, + sinfo.ppid, 0); + ABTS_INT_EQUAL(tc, strlen(DATASTR), size); + + ogs_thread_destroy(test5_thread); + + ogs_sock_destroy(sctp); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +} + +abts_suite *test_sctp(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, test1_func, NULL); + abts_run_test(suite, test2_func, NULL); + abts_run_test(suite, test3_func, NULL); + abts_run_test(suite, test4_func, NULL); + abts_run_test(suite, test5_func, NULL); + + return suite; +} diff --git a/test/basic/security_test.c b/test/unit/security_test.c similarity index 55% rename from test/basic/security_test.c rename to test/unit/security_test.c index 123e7f09c..6b5091220 100644 --- a/test/basic/security_test.c +++ b/test/unit/security_test.c @@ -1,15 +1,11 @@ -#include "core_lib.h" -#include "core_debug.h" -#include "core_sha2_hmac.h" -#include "core_pkbuf.h" - +#include "ogs-crypt.h" #include "nas/nas_message.h" #include "hss/milenage.h" #include "hss/hss_auc.h" #include "mme/nas_security.h" -#include "testutil.h" +#include "core/abts.h" static void security_test1(abts_case *tc, void *data) { @@ -27,43 +23,43 @@ static void security_test1(abts_case *tc, void *data) char *_ak = "aa689c64 8370"; char *_akstar = "451e8bec a43b"; - c_uint8_t k[16]; - c_uint8_t rand[16]; - c_uint8_t op[16]; - c_uint8_t opc[16]; - c_uint8_t sqn[6]; - c_uint8_t amf[2]; - c_uint8_t mac_a[8]; - c_uint8_t mac_s[8]; - c_uint8_t res[8]; - c_uint8_t ck[16]; - c_uint8_t ik[16]; - c_uint8_t ak[6]; - c_uint8_t akstar[6]; + uint8_t k[16]; + uint8_t rand[16]; + uint8_t op[16]; + uint8_t opc[16]; + uint8_t sqn[6]; + uint8_t amf[2]; + uint8_t mac_a[8]; + uint8_t mac_s[8]; + uint8_t res[8]; + uint8_t ck[16]; + uint8_t ik[16]; + uint8_t ak[6]; + uint8_t akstar[6]; - c_uint8_t tmp[16]; + uint8_t tmp[16]; - milenage_opc(CORE_HEX(_k, strlen(_k), k), - CORE_HEX(_op, strlen(_op), op), opc); - ABTS_TRUE(tc, memcmp(opc, CORE_HEX(_opc, strlen(_opc), tmp), 16) == 0); + milenage_opc(OGS_HEX(_k, strlen(_k), k), + OGS_HEX(_op, strlen(_op), op), opc); + ABTS_TRUE(tc, memcmp(opc, OGS_HEX(_opc, strlen(_opc), tmp), 16) == 0); milenage_f1(opc, k, - CORE_HEX(_rand, strlen(_rand), rand), - CORE_HEX(_sqn, strlen(_sqn), sqn), - CORE_HEX(_amf, strlen(_amf), amf), + OGS_HEX(_rand, strlen(_rand), rand), + OGS_HEX(_sqn, strlen(_sqn), sqn), + OGS_HEX(_amf, strlen(_amf), amf), mac_a, mac_s); ABTS_TRUE(tc, memcmp(mac_a, - CORE_HEX(_mac_a, strlen(_mac_a), tmp), 8) == 0); + OGS_HEX(_mac_a, strlen(_mac_a), tmp), 8) == 0); ABTS_TRUE(tc, memcmp(mac_s, - CORE_HEX(_mac_s, strlen(_mac_s), tmp), 8) == 0); + OGS_HEX(_mac_s, strlen(_mac_s), tmp), 8) == 0); milenage_f2345(opc, k, rand, res, ck, ik, ak, akstar); - ABTS_TRUE(tc, memcmp(res, CORE_HEX(_res, strlen(_res), tmp), 8) == 0); - ABTS_TRUE(tc, memcmp(ck, CORE_HEX(_ck, strlen(_ck), tmp), 16) == 0); - ABTS_TRUE(tc, memcmp(ik, CORE_HEX(_ik, strlen(_ik), tmp), 16) == 0); - ABTS_TRUE(tc, memcmp(ak, CORE_HEX(_ak, strlen(_ak), tmp), 6) == 0); + ABTS_TRUE(tc, memcmp(res, OGS_HEX(_res, strlen(_res), tmp), 8) == 0); + ABTS_TRUE(tc, memcmp(ck, OGS_HEX(_ck, strlen(_ck), tmp), 16) == 0); + ABTS_TRUE(tc, memcmp(ik, OGS_HEX(_ik, strlen(_ik), tmp), 16) == 0); + ABTS_TRUE(tc, memcmp(ak, OGS_HEX(_ak, strlen(_ak), tmp), 6) == 0); ABTS_TRUE(tc, memcmp(akstar, - CORE_HEX(_akstar, strlen(_akstar), tmp), 6) == 0); + OGS_HEX(_akstar, strlen(_akstar), tmp), 6) == 0); } static void security_test2(abts_case *tc, void *data) @@ -72,16 +68,16 @@ static void security_test2(abts_case *tc, void *data) char *_message = "7768617420646f2079612077616e7420666f72206e6f7468696e673f"; char *_hmac = "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843"; - c_uint8_t key[4]; - c_uint8_t message[28]; - c_uint8_t hmac[32]; - c_uint8_t tmp[32]; + uint8_t key[4]; + uint8_t message[28]; + uint8_t hmac[32]; + uint8_t tmp[32]; - hmac_sha256(CORE_HEX(_key, strlen(_key), key), 4, - CORE_HEX(_message, strlen(_message), message), 28, + ogs_hmac_sha256(OGS_HEX(_key, strlen(_key), key), 4, + OGS_HEX(_message, strlen(_message), message), 28, hmac, 32); - ABTS_TRUE(tc, memcmp(hmac, CORE_HEX(_hmac, strlen(_hmac), tmp), 32) == 0); + ABTS_TRUE(tc, memcmp(hmac, OGS_HEX(_hmac, strlen(_hmac), tmp), 32) == 0); } static void security_test3(abts_case *tc, void *data) @@ -93,24 +89,24 @@ static void security_test3(abts_case *tc, void *data) char *_ak = "aa689c648370"; char *_kasme = "238e457e0f758bad bca8d34bb2612c10 428d426757cb5553 b2b184fa64bfc549"; - c_uint8_t ck[16]; - c_uint8_t ik[16]; - c_uint8_t plmn_id[3]; - c_uint8_t sqn[6]; - c_uint8_t ak[6]; - c_uint8_t kasme[32]; - c_uint8_t tmp[32]; + uint8_t ck[16]; + uint8_t ik[16]; + uint8_t plmn_id[3]; + uint8_t sqn[6]; + uint8_t ak[6]; + uint8_t kasme[32]; + uint8_t tmp[32]; hss_auc_kasme( - CORE_HEX(_ck, strlen(_ck), ck), - CORE_HEX(_ik, strlen(_ik), ik), - CORE_HEX(_plmn_id, strlen(_plmn_id), plmn_id), - CORE_HEX(_sqn, strlen(_sqn), sqn), - CORE_HEX(_ak, strlen(_ak), ak), + OGS_HEX(_ck, strlen(_ck), ck), + OGS_HEX(_ik, strlen(_ik), ik), + OGS_HEX(_plmn_id, strlen(_plmn_id), plmn_id), + OGS_HEX(_sqn, strlen(_sqn), sqn), + OGS_HEX(_ak, strlen(_ak), ak), kasme); ABTS_TRUE(tc, - memcmp(kasme, CORE_HEX(_kasme, strlen(_kasme), tmp), 32) == 0); + memcmp(kasme, OGS_HEX(_kasme, strlen(_kasme), tmp), 32) == 0); } static void security_test4(abts_case *tc, void *data) @@ -120,27 +116,27 @@ static void security_test4(abts_case *tc, void *data) char *_ik = "2bd6459f 82c5b300 952c4910 4881ff48"; char *_message = "33323462 63393861 37347900 00000000"; char *_mact = "731f1165"; - c_uint8_t ik[16]; - c_uint8_t message[SECURITY_TEST4_LEN]; - c_uint8_t mact[4]; - c_uint8_t tmp[4]; - c_uint8_t mac[4]; - pkbuf_t *pkbuf = NULL; + uint8_t ik[16]; + uint8_t message[SECURITY_TEST4_LEN]; + uint8_t mact[4]; + uint8_t tmp[4]; + uint8_t mac[4]; + ogs_pkbuf_t *pkbuf = NULL; - snow_3g_f9(CORE_HEX(_ik, strlen(_ik), ik), + snow_3g_f9(OGS_HEX(_ik, strlen(_ik), ik), 0x38a6f056, (0x1f << 27), 0, - CORE_HEX(_message, strlen(_message), message), + OGS_HEX(_message, strlen(_message), message), SECURITY_TEST4_BIT_LEN, mact); - ABTS_TRUE(tc, memcmp(mact, CORE_HEX(_mact, strlen(_mact), tmp), 4) == 0); + ABTS_TRUE(tc, memcmp(mact, OGS_HEX(_mact, strlen(_mact), tmp), 4) == 0); - pkbuf = pkbuf_alloc(NAS_HEADROOM, SECURITY_TEST4_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - memcpy(pkbuf->payload, message, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+SECURITY_TEST4_LEN); + ogs_pkbuf_reserve(pkbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(pkbuf, message, SECURITY_TEST4_LEN); nas_mac_calculate(NAS_SECURITY_ALGORITHMS_128_EIA1, ik, 0x38a6f056, 0x1f, 0, pkbuf, mac); ABTS_TRUE(tc, memcmp(mac, tmp, 4) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void security_test5(abts_case *tc, void *data) @@ -164,29 +160,29 @@ static void security_test5(abts_case *tc, void *data) "2259af43 25e2a65e 3084ad5f 6a513b7b" "ddc1b65f 0aa0d97a 053db55a 88c4c4f9" "605e4143"; - c_uint8_t ck[16]; - c_uint8_t plain[SECURITY_TEST5_LEN]; - c_uint8_t tmp[SECURITY_TEST5_LEN]; - pkbuf_t *pkbuf = NULL; + uint8_t ck[16]; + uint8_t plain[SECURITY_TEST5_LEN]; + uint8_t tmp[SECURITY_TEST5_LEN]; + ogs_pkbuf_t *pkbuf = NULL; snow_3g_f8( - CORE_HEX(_ck, strlen(_ck), ck), + OGS_HEX(_ck, strlen(_ck), ck), 0x72a4f20f, 0x0c, 1, - CORE_HEX(_plain, strlen(_plain), plain), + OGS_HEX(_plain, strlen(_plain), plain), SECURITY_TEST5_BIT_LEN); ABTS_TRUE(tc, memcmp(plain, - CORE_HEX(_cipher, strlen(_cipher), tmp), + OGS_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST5_LEN) == 0); - pkbuf = pkbuf_alloc(NAS_HEADROOM, SECURITY_TEST5_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - memcpy(pkbuf->payload, plain, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+SECURITY_TEST5_LEN); + ogs_pkbuf_reserve(pkbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(pkbuf, plain, SECURITY_TEST5_LEN); nas_encrypt(NAS_SECURITY_ALGORITHMS_128_EEA1, ck, 0x72a4f20f, 0x0c, 1, pkbuf); - ABTS_TRUE(tc, memcmp(pkbuf->payload, CORE_HEX(_plain, strlen(_plain), tmp), + ABTS_TRUE(tc, memcmp(pkbuf->data, OGS_HEX(_plain, strlen(_plain), tmp), SECURITY_TEST5_LEN) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void security_test6(abts_case *tc, void *data) @@ -196,36 +192,36 @@ static void security_test6(abts_case *tc, void *data) char *_ik = "d3c5d592 327fb11c 4035c668 0af8c6d1"; char *_message = "484583d5 afe082ae"; char *_mact = "b93787e6"; - c_uint8_t ik[16]; - c_uint8_t message[SECURITY_TEST6_LEN]; - c_uint8_t mact[16]; - c_uint8_t tmp[4]; - c_uint8_t *m = NULL; - c_uint32_t count = htonl(0x398a59b4); + uint8_t ik[16]; + uint8_t message[SECURITY_TEST6_LEN]; + uint8_t mact[16]; + uint8_t tmp[4]; + uint8_t *m = NULL; + uint32_t count = htonl(0x398a59b4); int msg_len = SECURITY_TEST6_LEN; int m_len = 8+msg_len; - c_uint8_t mac[4]; - pkbuf_t *pkbuf = NULL; + uint8_t mac[4]; + ogs_pkbuf_t *pkbuf = NULL; - m = core_calloc(m_len, sizeof(c_uint8_t)); - memcpy(m, &count, sizeof(c_uint32_t)); + m = ogs_calloc(m_len, sizeof(uint8_t)); + memcpy(m, &count, sizeof(uint32_t)); m[4] = ((0x1a << 3) | (1 << 2)); - memcpy(m+8, CORE_HEX(_message, strlen(_message), message), msg_len); + memcpy(m+8, OGS_HEX(_message, strlen(_message), message), msg_len); - aes_cmac_calculate(mact, CORE_HEX(_ik, strlen(_ik), ik), m, m_len); + ogs_aes_cmac_calculate(mact, OGS_HEX(_ik, strlen(_ik), ik), m, m_len); - CORE_FREE(m); + ogs_free(m); - ABTS_TRUE(tc, memcmp(mact, CORE_HEX(_mact, strlen(_mact), tmp), 4) == 0); + ABTS_TRUE(tc, memcmp(mact, OGS_HEX(_mact, strlen(_mact), tmp), 4) == 0); - pkbuf = pkbuf_alloc(NAS_HEADROOM, SECURITY_TEST6_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - memcpy(pkbuf->payload, message, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+SECURITY_TEST6_LEN); + ogs_pkbuf_reserve(pkbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(pkbuf, message, SECURITY_TEST6_LEN); nas_mac_calculate(NAS_SECURITY_ALGORITHMS_128_EIA2, ik, 0x398a59b4, 0x1a, 1, pkbuf, mac); ABTS_TRUE(tc, memcmp(mac, tmp, 4) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void security_test7(abts_case *tc, void *data) @@ -243,44 +239,44 @@ static void security_test7(abts_case *tc, void *data) "2445cc50 bb1cf168 a4967373 4e081b57 e324ce52 59c0e78d 4cd97b87 0976503c" "0943f2cb 5ae8f052 c7b7d392 239587b8 956086bc ab188360 42e2e6ce 42432a17" "105c53d3"; - c_uint8_t ck[16]; - c_uint8_t plain[SECURITY_TEST7_LEN+100]; - c_uint8_t cipher[SECURITY_TEST7_LEN+100]; - c_uint8_t tmp[SECURITY_TEST7_LEN+100]; - pkbuf_t *pkbuf = NULL; + uint8_t ck[16]; + uint8_t plain[SECURITY_TEST7_LEN+100]; + uint8_t cipher[SECURITY_TEST7_LEN+100]; + uint8_t tmp[SECURITY_TEST7_LEN+100]; + ogs_pkbuf_t *pkbuf = NULL; - c_uint8_t ivec[16]; - c_uint32_t count = htonl(0xc675a64b); + uint8_t ivec[16]; + uint32_t count = htonl(0xc675a64b); memset(ivec, 0, sizeof(ivec)); memcpy(ivec+0, &count, sizeof(count)); ivec[4] = (0x0c << 3) | (1 << 2); - aes_ctr128_encrypt( - CORE_HEX(_ck, strlen(_ck), ck), ivec, - CORE_HEX(_plain, strlen(_plain), plain), SECURITY_TEST7_LEN, + ogs_aes_ctr128_encrypt( + OGS_HEX(_ck, strlen(_ck), ck), ivec, + OGS_HEX(_plain, strlen(_plain), plain), SECURITY_TEST7_LEN, cipher); - ABTS_TRUE(tc, memcmp(cipher, CORE_HEX(_cipher, strlen(_cipher), tmp), + ABTS_TRUE(tc, memcmp(cipher, OGS_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST7_LEN) == 0); memset(ivec, 0, sizeof(ivec)); memcpy(ivec+0, &count, sizeof(count)); ivec[4] = (0x0c << 3) | (1 << 2); - aes_ctr128_encrypt(CORE_HEX(_ck, strlen(_ck), ck), + ogs_aes_ctr128_encrypt(OGS_HEX(_ck, strlen(_ck), ck), ivec, cipher, SECURITY_TEST7_LEN, cipher); ABTS_TRUE(tc, memcmp(cipher, plain, SECURITY_TEST7_LEN) == 0); - pkbuf = pkbuf_alloc(NAS_HEADROOM, SECURITY_TEST7_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - memcpy(pkbuf->payload, plain, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+SECURITY_TEST7_LEN); + ogs_pkbuf_reserve(pkbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(pkbuf, plain, SECURITY_TEST7_LEN); nas_encrypt(NAS_SECURITY_ALGORITHMS_128_EEA2, ck, 0xc675a64b, 0x0c, 1, pkbuf); - ABTS_TRUE(tc, memcmp(pkbuf->payload, - CORE_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST7_LEN) == 0); - pkbuf_free(pkbuf); + ABTS_TRUE(tc, memcmp(pkbuf->data, + OGS_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST7_LEN) == 0); + ogs_pkbuf_free(pkbuf); } static void security_test8(abts_case *tc, void *data) @@ -293,34 +289,34 @@ static void security_test8(abts_case *tc, void *data) "7e941b7b e91348f9 fcb170e2 217fecd9 7f9f68ad b16e5d7d 21e569d2 80ed775c" "ebde3f40 93c53881 00000000"; char *_mact = "24a842b3"; - c_uint8_t ik[16]; - c_uint8_t message[SECURITY_TEST8_LEN]; - c_uint8_t mact[4]; - c_uint32_t mac32; - pkbuf_t *pkbuf = NULL; - c_uint8_t mac[4]; + uint8_t ik[16]; + uint8_t message[SECURITY_TEST8_LEN]; + uint8_t mact[4]; + uint32_t mac32; + ogs_pkbuf_t *pkbuf = NULL; + uint8_t mac[4]; zuc_eia3( - CORE_HEX(_ik, strlen(_ik), ik), + OGS_HEX(_ik, strlen(_ik), ik), 0xa94059da, 0xa, 1, SECURITY_TEST8_BIT_LEN, - CORE_HEX(_message, strlen(_message), message), + OGS_HEX(_message, strlen(_message), message), &mac32); mac32 = ntohl(mac32); ABTS_TRUE(tc, memcmp(&mac32, - CORE_HEX(_mact, strlen(_mact), mact), 4) == 0); + OGS_HEX(_mact, strlen(_mact), mact), 4) == 0); - pkbuf = pkbuf_alloc(NAS_HEADROOM, SECURITY_TEST8_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - memcpy(pkbuf->payload, message, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+SECURITY_TEST8_LEN); + ogs_pkbuf_reserve(pkbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(pkbuf, message, SECURITY_TEST8_LEN); nas_mac_calculate(NAS_SECURITY_ALGORITHMS_128_EIA3, ik, 0xa94059da, 0xa, 1, pkbuf, mac); ABTS_TRUE(tc, memcmp(mac, mact, 4) == 0); - pkbuf_free(pkbuf); + ogs_pkbuf_free(pkbuf); } static void security_test9(abts_case *tc, void *data) @@ -332,40 +328,40 @@ static void security_test9(abts_case *tc, void *data) "6cf65340 735552ab 0c9752fa 6f9025fe 0bd675d9 005875b2 00000000"; char *_cipher = "a6c85fc6 6afb8533 aafc2518 dfe78494 0ee1e4b0 30238cc8 10000000"; - c_uint8_t ck[16]; - c_uint8_t plain[SECURITY_TEST9_LEN]; - c_uint8_t cipher[SECURITY_TEST9_LEN]; - c_uint8_t tmp[SECURITY_TEST9_LEN]; - pkbuf_t *pkbuf = NULL; + uint8_t ck[16]; + uint8_t plain[SECURITY_TEST9_LEN]; + uint8_t cipher[SECURITY_TEST9_LEN]; + uint8_t tmp[SECURITY_TEST9_LEN]; + ogs_pkbuf_t *pkbuf = NULL; - CORE_HEX(_plain, strlen(_plain), plain); + OGS_HEX(_plain, strlen(_plain), plain); zuc_eea3( - CORE_HEX(_ck, strlen(_ck), ck), + OGS_HEX(_ck, strlen(_ck), ck), 0x66035492, 0xf, 0, SECURITY_TEST9_BIT_LEN, plain, plain); - ABTS_TRUE(tc, memcmp(plain, CORE_HEX(_cipher, strlen(_cipher), tmp), + ABTS_TRUE(tc, memcmp(plain, OGS_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST9_LEN) == 0); zuc_eea3( - CORE_HEX(_ck, strlen(_ck), ck), + OGS_HEX(_ck, strlen(_ck), ck), 0x66035492, 0xf, 0, SECURITY_TEST9_BIT_LEN, - CORE_HEX(_plain, strlen(_plain), plain), + OGS_HEX(_plain, strlen(_plain), plain), cipher); - ABTS_TRUE(tc, memcmp(cipher, CORE_HEX(_cipher, strlen(_cipher), tmp), + ABTS_TRUE(tc, memcmp(cipher, OGS_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST9_LEN) == 0); - pkbuf = pkbuf_alloc(NAS_HEADROOM, SECURITY_TEST9_LEN); - ABTS_PTR_NOTNULL(tc, pkbuf); - memcpy(pkbuf->payload, plain, pkbuf->len); + pkbuf = ogs_pkbuf_alloc(NULL, NAS_HEADROOM+SECURITY_TEST9_LEN); + ogs_pkbuf_reserve(pkbuf, NAS_HEADROOM); + ogs_pkbuf_put_data(pkbuf, plain, SECURITY_TEST9_LEN); nas_encrypt(NAS_SECURITY_ALGORITHMS_128_EEA3, ck, 0x66035492, 0xf, 0, pkbuf); - ABTS_TRUE(tc, memcmp(pkbuf->payload, - CORE_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST9_LEN) == 0); - pkbuf_free(pkbuf); + ABTS_TRUE(tc, memcmp(pkbuf->data, + OGS_HEX(_cipher, strlen(_cipher), tmp), SECURITY_TEST9_LEN) == 0); + ogs_pkbuf_free(pkbuf); } abts_suite *test_security(abts_suite *suite) diff --git a/test/volte/abts-main.c b/test/volte/abts-main.c new file mode 100644 index 000000000..d1548caf2 --- /dev/null +++ b/test/volte/abts-main.c @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-core.h" +#include "core/abts.h" + +#include "fd/fd_lib.h" + +#include "app/application.h" +#include "app/context.h" + +#include "app_init.h" + +#include "testpacket.h" +#include "testapp.h" + +#include "pcscf_fd_path.h" + +abts_suite *test_volte(abts_suite *suite); + +const struct testlist { + abts_suite *(*func)(abts_suite *suite); +} alltests[] = { + {test_volte}, + {NULL}, +}; + +static int connected_count = 0; +static void test_fd_logger_handler(enum fd_hook_type type, struct msg * msg, + struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, + void * regdata) +{ + if (type == HOOK_PEER_CONNECT_SUCCESS) + { + connected_count++; + } +} + +void test_terminate(void) +{ + pcscf_fd_final(); + testpacket_final(); + test_app_terminate(); + + base_finalize(); + ogs_core_finalize(); +} + +int test_initialize(app_param_t *param, int argc, const char *const argv[]) +{ + int rv; + fd_logger_register(test_fd_logger_handler); + + atexit(test_terminate); + + ogs_core_initialize(); + base_initialize(); + rv = test_app_initialize(param); + if (rv != OGS_OK) + { + ogs_error("test_app_initialize() failed"); + return OGS_ERROR; + } + rv = pcscf_fd_init(); + if (rv != OGS_OK) + { + ogs_error("pcscf_fd_init() failed"); + return OGS_ERROR; + } + rv = testpacket_init(); + if (rv != OGS_OK) + { + ogs_error("testpacket() failed"); + return OGS_ERROR; + } + + while(1) + { + if (connected_count == 1) break; + ogs_msleep(50); + } + + return rv; +} + +int main(int argc, const char **argv) +{ + int i; + app_param_t param; + const char *debug_mask = NULL; + const char *trace_mask = NULL; + char config_dir[MAX_FILEPATH_LEN/2]; + char config_path[MAX_FILEPATH_LEN]; + abts_suite *suite = NULL; + + abts_init(argc, argv); + + for (i = 1; i < argc; i++) { + /* abts_init(argc, argv) handles the following options */ + if (!strcmp(argv[i], "-v")) continue; + if (!strcmp(argv[i], "-x")) continue; + if (!strcmp(argv[i], "-l")) continue; + if (!strcmp(argv[i], "-q")) continue; + + if (!strcmp(argv[i], "-d")) { + param.log_level = OGS_LOG_DEBUG; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-t")) { + param.log_level = OGS_LOG_TRACE; + param.log_domain = argv[++i]; + continue; + } + if (!strcmp(argv[i], "-f")) { + param.config_path = argv[++i]; + continue; + } + if (argv[i][0] == '-') { + fprintf(stderr, "Invalid option: `%s'\n", argv[i]); + exit(1); + } + } + + if (!param.config_path) + { + ogs_path_remove_last_component(config_dir, argv[0]); + if (strstr(config_dir, ".libs")) + ogs_path_remove_last_component(config_dir, config_dir); + ogs_snprintf(config_path, sizeof config_path, + "%s/sample-volte.conf", config_dir); + param.config_path = config_path; + } + + if (param.log_level) + ogs_core()->log.level = OGS_LOG_DEFAULT; + else + ogs_core()->log.level = OGS_LOG_ERROR; + test_initialize(¶m, argc, argv); + + + for (i = 0; alltests[i].func; i++) + { + suite = alltests[i].func(suite); + } + + return abts_report(suite); +} diff --git a/test/volte/pcscf_fd_path.c b/test/volte/pcscf_fd_path.c index 0f86f746a..9d16092ea 100644 --- a/test/volte/pcscf_fd_path.c +++ b/test/volte/pcscf_fd_path.c @@ -1,11 +1,3 @@ -#define TRACE_MODULE _pcscf_fd_path - -#include "core_debug.h" -#include "core_pool.h" -#include "core_lib.h" -#include "core_network.h" -#include "3gpp_types.h" - #include "gtp/gtp_xact.h" #include "fd/fd_lib.h" @@ -27,8 +19,6 @@ struct sess_state { struct timespec ts; /* Time of sending the message */ }; -pool_declare(pcscf_rx_sess_pool, struct sess_state, MAX_NUM_SESSION_STATE); - static void pcscf_rx_aaa_cb(void *data, struct msg **msg); static void pcscf_rx_sta_cb(void *data, struct msg **msg); @@ -36,12 +26,9 @@ static __inline__ struct sess_state *new_state(os0_t sid) { struct sess_state *new = NULL; - pool_alloc_node(&pcscf_rx_sess_pool, &new); - d_assert(new, return NULL,); - memset(new, 0, sizeof *new); - - new->sid = (os0_t)core_strdup((char *)sid); - d_assert(new->sid, return NULL,); + new = ogs_calloc(1, sizeof(*new)); + new->sid = (os0_t)ogs_strdup((char *)sid); + ogs_assert(new->sid); return new; } @@ -49,24 +36,24 @@ static __inline__ struct sess_state *new_state(os0_t sid) static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque) { if (sess_data->sid) - CORE_FREE(sess_data->sid); + ogs_free(sess_data->sid); - pool_free_node(&pcscf_rx_sess_pool, sess_data); + ogs_free(sess_data); } static int pcscf_rx_fb_cb(struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { /* This CB should never be called */ - d_warn("Unexpected message received!"); + ogs_warn("Unexpected message received!"); return ENOTSUP; } -void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, +void pcscf_rx_send_aar(uint8_t **rx_sid, const char *ip, int qos_type, int flow_presence) { - status_t rv; + int rv; int ret; struct msg *req = NULL; @@ -78,21 +65,21 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, int new; paa_t paa; - ipsubnet_t ipsub; + ogs_ipsubnet_t ipsub; - d_assert(rx_sid, return,); + ogs_assert(rx_sid); - d_assert(ip, return,); - rv = core_ipsubnet(&ipsub, ip, NULL); - d_assert(rv == CORE_OK, return,); + ogs_assert(ip); + rv = ogs_ipsubnet(&ipsub, ip, NULL); + ogs_assert(rv == OGS_OK); /* Create the request */ ret = fd_msg_new(rx_cmd_aar, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); { struct msg_hdr * h; ret = fd_msg_hdr( req, &h ); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); h->msg_appl = RX_APPLICATION_ID; } @@ -102,12 +89,12 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, /* Retrieve session by Session-Id */ size_t sidlen = strlen((char *)*rx_sid); ret = fd_sess_fromsid_msg(*rx_sid, sidlen, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return,); + ogs_assert(ret == 0); + ogs_assert(new == 0); /* Add Session-Id to the message */ ret = fd_message_session_id_set(req, *rx_sid, sidlen); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Save the session associated with the message */ ret = fd_msg_sess_set(req, session); } @@ -117,9 +104,9 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, #define RX_APP_SID_OPT "app_rx" ret = fd_msg_new_session(req, (os0_t)RX_APP_SID_OPT, CONSTSTRLEN(RX_APP_SID_OPT)); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_sess_get(fd_g_config->cnf_dict, req, &session, NULL); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Retrieve session state in this session */ @@ -130,11 +117,11 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, size_t sidlen; ret = fd_sess_getsid(session, &sid, &sidlen); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Allocate new session state memory */ sess_data = new_state(sid); - d_assert(sess_data, return,); + ogs_assert(sess_data); /* Save Session-Id to PGW Session Context */ *rx_sid = sess_data->sid; @@ -142,170 +129,170 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = RX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Subscription-Id */ ret = fd_msg_avp_new(rx_subscription_id, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_subscription_id_type, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = RX_SUBSCRIPTION_ID_TYPE_END_USER_IMSI; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); #define RX_APP_IMSI_BCD "0123456789012345" ret = fd_msg_avp_new(rx_subscription_id_data, 0, &avpch1); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t *)RX_APP_IMSI_BCD; + ogs_assert(ret == 0); + val.os.data = (uint8_t *)RX_APP_IMSI_BCD; val.os.len = strlen(RX_APP_IMSI_BCD); ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (ipsub.family == AF_INET) { /* Set Framed-IP-Address */ ret = fd_msg_avp_new(rx_framed_ip_address, 0, &avp); - d_assert(ret == 0, return,); - val.os.data = (c_uint8_t*)ipsub.sub; + ogs_assert(ret == 0); + val.os.data = (uint8_t*)ipsub.sub; val.os.len = IPV4_LEN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } else if (ipsub.family == AF_INET6) { /* Set Framed-IPv6-Prefix */ ret = fd_msg_avp_new(rx_framed_ipv6_prefix, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); memset(&paa, 0, sizeof(paa_t)); memcpy(paa.addr6, ipsub.sub, IPV6_LEN); paa.pdn_type = 0x03; #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ paa.len = FRAMED_IPV6_PREFIX_LENGTH; - val.os.data = (c_uint8_t*)&paa; + val.os.data = (uint8_t*)&paa; val.os.len = PAA_IPV6_LEN; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } /* Set Media-Component-Description */ ret = fd_msg_avp_new(rx_media_component_description, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_media_component_number, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_media_type, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = RX_MEDIA_TYPE_AUDIO; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (qos_type == 1) { ret = fd_msg_avp_new(rx_max_requested_bandwidth_dl, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 96000; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_max_requested_bandwidth_ul, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 96000; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_rr_bandwidth, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 2400; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_rs_bandwidth, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 2400; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } else if (qos_type == 2) { ret = fd_msg_avp_new(rx_max_requested_bandwidth_dl, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 96000; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_max_requested_bandwidth_ul, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 96000; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_min_requested_bandwidth_dl, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 88000; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_min_requested_bandwidth_ul, 0, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 88000; ret = fd_msg_avp_setvalue (avpch1, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } if (flow_presence) @@ -314,88 +301,88 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, ret = fd_msg_avp_new(rx_media_sub_component, 0, &avpch1); ret = fd_msg_avp_new(rx_flow_number, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); #define TEST_RX_FLOW_DESC1 \ "permit out 17 from 172.20.166.84 to 172.18.128.20 20001" - val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC1; + val.os.data = (uint8_t *)TEST_RX_FLOW_DESC1; val.os.len = strlen(TEST_RX_FLOW_DESC1); ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); #define TEST_RX_FLOW_DESC2 \ "permit in 17 from 172.18.128.20 to 172.20.166.84 20360" - val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC2; + val.os.data = (uint8_t *)TEST_RX_FLOW_DESC2; val.os.len = strlen(TEST_RX_FLOW_DESC2); ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set Media-Sub-Component #2 */ ret = fd_msg_avp_new(rx_media_sub_component, 0, &avpch1); ret = fd_msg_avp_new(rx_flow_number, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = 2; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_flow_usage, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = RX_FLOW_USAGE_RTCP; ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); #define TEST_RX_FLOW_DESC3 \ "permit out 17 from 172.20.166.84 to 172.18.128.20 20002" - val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC3; + val.os.data = (uint8_t *)TEST_RX_FLOW_DESC3; val.os.len = strlen(TEST_RX_FLOW_DESC3); ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); #define TEST_RX_FLOW_DESC4 \ "permit in 17 from 172.18.128.20 to 172.20.166.84 20361" - val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC4; + val.os.data = (uint8_t *)TEST_RX_FLOW_DESC4; val.os.len = strlen(TEST_RX_FLOW_DESC4); ret = fd_msg_avp_setvalue (avpch2, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); } ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = clock_gettime(CLOCK_REALTIME, &sess_data->ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ @@ -403,17 +390,17 @@ void pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, /* Store this value in the session */ ret = fd_sess_state_store(pcscf_rx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the request */ ret = fd_msg_send(&req, pcscf_rx_aaa_cb, svg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); } static void pcscf_rx_aaa_cb(void *data, struct msg **msg) @@ -428,96 +415,96 @@ static void pcscf_rx_aaa_cb(void *data, struct msg **msg) unsigned long dur; int error = 0; int new; - c_int32_t result_code = 0; + int result_code = 0; ret = clock_gettime(CLOCK_REALTIME, &ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); ret = fd_sess_state_retrieve(pcscf_rx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data && (void *)sess_data == data, return, ); + ogs_assert(ret == 0); + ogs_assert(sess_data && (void *)sess_data == data); /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(3, "Result Code: %d\n", hdr->avp_value->i32); + ogs_debug("Result Code: %d\n", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(3, "Experimental Result Code: %d\n", + ogs_debug("Experimental Result Code: %d\n", result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); error++; } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(3, "From '%.*s' ", + ogs_assert(ret == 0); + ogs_debug("From '%.*s' ", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host "); + ogs_error("no_Origin-Host "); error++; } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(3, "('%.*s') ", + ogs_assert(ret == 0); + ogs_debug("('%.*s') ", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm "); + ogs_error("no_Origin-Realm "); error++; } if (result_code != ER_DIAMETER_SUCCESS) { - d_warn("ERROR DIAMETER Result Code(%d)", result_code); + ogs_warn("ERROR DIAMETER Result Code(%d)", result_code); error++; goto out; } out: /* Free the message */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (fd_logger_self()->stats.nb_recv) @@ -543,24 +530,24 @@ out: else fd_logger_self()->stats.nb_recv++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - d_trace(3, "in %d.%06ld sec\n", + ogs_debug("in %d.%06ld sec\n", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - d_trace(3, "in %d.%06ld sec\n", + ogs_debug("in %d.%06ld sec\n", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); ret = fd_sess_state_store(pcscf_rx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == NULL, return,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; return; @@ -569,7 +556,7 @@ out: static int pcscf_rx_asr_cb( struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { - status_t rv; + int rv; int ret; struct msg *ans, *qry; @@ -580,79 +567,79 @@ static int pcscf_rx_asr_cb( struct msg **msg, struct avp *avp, os0_t sid; size_t sidlen; - d_assert(msg, return EINVAL,); - d_assert(sess, return EINVAL,); + ogs_assert(msg); + ogs_assert(sess); ret = fd_sess_state_retrieve(pcscf_rx_reg, sess, &sess_data); - d_assert(ret == 0, return EINVAL,); - d_assert(sess_data, return EINVAL,); + ogs_assert(ret == 0); + ogs_assert(sess_data); /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ans = *msg; /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = RX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Set the Auth-Request-Type AVP */ ret = fd_msg_avp_new(fd_auth_request_type, 0, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); val.i32 = 1; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Get Abort-Cause */ ret = fd_msg_search_avp(qry, rx_abort_cause, &avp); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); } else { - d_error("no_Abort-Cause "); + ogs_error("no_Abort-Cause "); } /* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */ ret = fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1); - d_assert(ret == 0, return EINVAL,); + ogs_assert(ret == 0); /* Store this value in the session */ sid = sess_data->sid; - d_assert(sid,,); + ogs_assert(sid); ret = fd_sess_state_store(pcscf_rx_reg, sess, &sess_data); - d_assert(ret == 0,,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Add this value to the stats */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_echoed++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); pcscf_rx_send_str(sid); return 0; } -void pcscf_rx_send_str(c_uint8_t *rx_sid) +void pcscf_rx_send_str(uint8_t *rx_sid) { - status_t rv; + int rv; int ret; struct msg *req = NULL; @@ -663,66 +650,66 @@ void pcscf_rx_send_str(c_uint8_t *rx_sid) struct session *session = NULL; int new; - d_assert(rx_sid, return,); + ogs_assert(rx_sid); /* Create the request */ ret = fd_msg_new(rx_cmd_str, MSGFL_ALLOC_ETEID, &req); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); { struct msg_hdr * h; ret = fd_msg_hdr( req, &h ); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); h->msg_appl = RX_APPLICATION_ID; } /* Retrieve session by Session-Id */ size_t sidlen = strlen((char*)rx_sid); ret = fd_sess_fromsid_msg(rx_sid, sidlen, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return,); + ogs_assert(ret == 0); + ogs_assert(new == 0); /* Add Session-Id to the message */ ret = fd_message_session_id_set(req, rx_sid, sidlen); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Save the session associated with the message */ ret = fd_msg_sess_set(req, session); /* Retrieve session state in this session */ ret = fd_sess_state_retrieve(pcscf_rx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data, return,); + ogs_assert(ret == 0); + ogs_assert(sess_data); /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(fd_destination_realm, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm); val.os.len = strlen(fd_g_config->cnf_diamrlm); ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Auth-Application-Id AVP */ ret = fd_msg_avp_new(fd_auth_application_id, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = RX_APPLICATION_ID; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Set the Termination-Cause AVP */ ret = fd_msg_avp_new(rx_termination_cause, 0, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); val.i32 = RX_TERMINATION_CAUSE_DIAMETER_LOGOUT; ret = fd_msg_avp_setvalue(avp, &val); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ @@ -730,17 +717,17 @@ void pcscf_rx_send_str(c_uint8_t *rx_sid) /* Store this value in the session */ ret = fd_sess_state_store(pcscf_rx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data == NULL,,); + ogs_assert(ret == 0); + ogs_assert(sess_data == NULL); /* Send the request */ ret = fd_msg_send(&req, pcscf_rx_sta_cb, svg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); /* Increment the counter */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); fd_logger_self()->stats.nb_sent++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,,); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); } static void pcscf_rx_sta_cb(void *data, struct msg **msg) @@ -755,96 +742,96 @@ static void pcscf_rx_sta_cb(void *data, struct msg **msg) unsigned long dur; int error = 0; int new; - c_int32_t result_code = 0; + int result_code = 0; ret = clock_gettime(CLOCK_REALTIME, &ts); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); - d_assert(ret == 0, return,); - d_assert(new == 0, return, ); + ogs_assert(ret == 0); + ogs_assert(new == 0); ret = fd_sess_state_retrieve(pcscf_rx_reg, session, &sess_data); - d_assert(ret == 0, return,); - d_assert(sess_data && (void *)sess_data == data, return, ); + ogs_assert(ret == 0); + ogs_assert(sess_data && (void *)sess_data == data); /* Value of Result Code */ ret = fd_msg_search_avp(*msg, fd_result_code, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(3, "Result Code: %d\n", hdr->avp_value->i32); + ogs_debug("Result Code: %d\n", hdr->avp_value->i32); } else { ret = fd_msg_search_avp(*msg, fd_experimental_result, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_avp_search_avp(avp, fd_experimental_result_code, &avpch1); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); result_code = hdr->avp_value->i32; - d_trace(3, "Experimental Result Code: %d\n", + ogs_debug("Experimental Result Code: %d\n", result_code); } } else { - d_error("no Result-Code"); + ogs_error("no Result-Code"); error++; } } /* Value of Origin-Host */ ret = fd_msg_search_avp(*msg, fd_origin_host, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(3, "From '%.*s' ", + ogs_assert(ret == 0); + ogs_debug("From '%.*s' ", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Host "); + ogs_error("no_Origin-Host "); error++; } /* Value of Origin-Realm */ ret = fd_msg_search_avp(*msg, fd_origin_realm, &avp); - d_assert(ret == 0, return,); + ogs_assert(ret == 0); if (avp) { ret = fd_msg_avp_hdr(avp, &hdr); - d_assert(ret == 0, return,); - d_trace(3, "('%.*s') ", + ogs_assert(ret == 0); + ogs_debug("('%.*s') ", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); } else { - d_error("no_Origin-Realm "); + ogs_error("no_Origin-Realm "); error++; } if (result_code != ER_DIAMETER_SUCCESS) { - d_warn("ERROR DIAMETER Result Code(%d)", result_code); + ogs_warn("ERROR DIAMETER Result Code(%d)", result_code); error++; goto out; } out: /* Free the message */ - d_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_lock(&fd_logger_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (fd_logger_self()->stats.nb_recv) @@ -870,22 +857,22 @@ out: else fd_logger_self()->stats.nb_recv++; - d_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0,, ); + ogs_assert(pthread_mutex_unlock(&fd_logger_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - d_trace(3, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec\n", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - d_trace(3, "in %d.%06ld sec\n", + ogs_trace("in %d.%06ld sec\n", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); state_cleanup(sess_data, NULL, NULL); ret = fd_msg_free(*msg); - d_assert(ret == 0,,); + ogs_assert(ret == 0); *msg = NULL; return; @@ -930,25 +917,23 @@ void pcscf_fd_config() fd_config.num_of_conn++; } -status_t pcscf_fd_init(void) +int pcscf_fd_init(void) { int ret; struct disp_when data; - pool_init(&pcscf_rx_sess_pool, MAX_NUM_SESSION_STATE); - pcscf_fd_config(); ret = fd_init(FD_MODE_CLIENT, NULL, &fd_config); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Install objects definitions for this application */ ret = rx_dict_init(); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Create handler for sessions */ ret = fd_sess_handler_create(&pcscf_rx_reg, state_cleanup, NULL, NULL); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Fallback CB if command != unexpected message received */ memset(&data, 0, sizeof(data)); @@ -956,17 +941,17 @@ status_t pcscf_fd_init(void) ret = fd_disp_register(pcscf_rx_fb_cb, DISP_HOW_APPID, &data, NULL, &hdl_rx_fb); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Specific handler for Abort-Session-Request */ data.command = rx_cmd_asr; ret = fd_disp_register(pcscf_rx_asr_cb, DISP_HOW_CC, &data, NULL, &hdl_rx_asr); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); /* Advertise the support for the application in the peer */ ret = fd_disp_app_support(rx_application, fd_vendor, 1, 0); - d_assert(ret == 0, return CORE_ERROR,); + ogs_assert(ret == 0); return 0; } @@ -975,7 +960,7 @@ void pcscf_fd_final(void) { int ret; ret = fd_sess_handler_destroy(&pcscf_rx_reg, NULL); - d_assert(ret == 0,,); + ogs_assert(ret == 0); if (hdl_rx_fb) (void) fd_disp_unregister(&hdl_rx_fb, NULL); @@ -983,12 +968,4 @@ void pcscf_fd_final(void) (void) fd_disp_unregister(&hdl_rx_asr, NULL); fd_final(); - - if (pool_used(&pcscf_rx_sess_pool)) - d_error("%d not freed in pcscf_rx_sess_pool[%d] of S6A-SM", - pool_used(&pcscf_rx_sess_pool), pool_size(&pcscf_rx_sess_pool)); - d_trace(5, "%d not freed in pcscf_rx_sess_pool[%d] of S6A-SM\n", - pool_used(&pcscf_rx_sess_pool), pool_size(&pcscf_rx_sess_pool)); - - pool_final(&pcscf_rx_sess_pool); } diff --git a/test/volte/pcscf_fd_path.h b/test/volte/pcscf_fd_path.h index 60c944672..cb8024640 100644 --- a/test/volte/pcscf_fd_path.h +++ b/test/volte/pcscf_fd_path.h @@ -1,18 +1,16 @@ #ifndef __PCSCF_FD_PATH_H__ #define __PCSCF_FD_PATH_H__ -#include "core_errno.h" - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) pcscf_fd_init(void); -CORE_DECLARE(void) pcscf_fd_final(void); +int pcscf_fd_init(void); +void pcscf_fd_final(void); -CORE_DECLARE(void) pcscf_rx_send_aar(c_uint8_t **rx_sid, const char *ip, +void pcscf_rx_send_aar(uint8_t **rx_sid, const char *ip, int qos_type, int flow_presence); -CORE_DECLARE(void) pcscf_rx_send_str(c_uint8_t *rx_sid); +void pcscf_rx_send_str(uint8_t *rx_sid); #ifdef __cplusplus } diff --git a/test/volte/testapp.c b/test/volte/testapp.c index 1eb75ff01..36225f27a 100644 --- a/test/volte/testapp.c +++ b/test/volte/testapp.c @@ -1,338 +1,310 @@ -#define TRACE_MODULE _testapp - -#include "core_general.h" -#include "core_debug.h" -#include "core_semaphore.h" - -#include "common/context.h" -#include "common/application.h" +#include "app/context.h" +#include "app/application.h" #include "app_init.h" -static semaphore_id pcrf_sem1 = 0; -static semaphore_id pcrf_sem2 = 0; +static ogs_proc_mutex_t *pcrf_sem1 = NULL; +static ogs_proc_mutex_t *pcrf_sem2 = NULL; -static semaphore_id pgw_sem1 = 0; -static semaphore_id pgw_sem2 = 0; +static ogs_proc_mutex_t *pgw_sem1 = NULL; +static ogs_proc_mutex_t *pgw_sem2 = NULL; -static semaphore_id sgw_sem1 = 0; -static semaphore_id sgw_sem2 = 0; +static ogs_proc_mutex_t *sgw_sem1 = NULL; +static ogs_proc_mutex_t *sgw_sem2 = NULL; -static semaphore_id hss_sem1 = 0; -static semaphore_id hss_sem2 = 0; +static ogs_proc_mutex_t *hss_sem1 = NULL; +static ogs_proc_mutex_t *hss_sem2 = NULL; -static semaphore_id mme_sem1 = 0; -static semaphore_id mme_sem2 = 0; +static ogs_proc_mutex_t *mme_sem1 = NULL; +static ogs_proc_mutex_t *mme_sem2 = NULL; -status_t test_app_initialize( - const char *config_path, const char *log_path, const char *pid_path) +int test_app_initialize(app_param_t *param) { pid_t pid; - status_t rv; + int rv; int app = 0; - rv = app_will_initialize(config_path, log_path); - if (rv != CORE_OK) return rv; - - app = context_self()->logger.trace.app; - if (app) - { - d_trace_level(&_testapp, app); - } - + rv = app_will_initialize(param); + if (rv != OGS_OK) return rv; /************************* PCRF Process **********************/ - semaphore_create(&pcrf_sem1, 0); /* copied to PCRF/PGW/SGW/HSS process */ - semaphore_create(&pcrf_sem2, 0); /* copied to PCRF/PGW/SGW/HSS process */ + pcrf_sem1 = ogs_proc_mutex_create(0); /* copied to PCRF/PGW/SGW/HSS/MME */ + pcrf_sem2 = ogs_proc_mutex_create(0); /* copied to PCRF/PGW/SGW/HSS/MME */ - if (context_self()->parameter.no_pcrf == 0) + if (context_self()->config.parameter.no_pcrf == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { - d_trace(1, "PCRF try to initialize\n"); + ogs_info("PCRF try to initialize"); rv = pcrf_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize PCRF"); - d_trace(1, "PCRF initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("PCRF initialize...done"); - if (pcrf_sem1) semaphore_post(pcrf_sem1); - if (pcrf_sem2) semaphore_wait(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_post(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_wait(pcrf_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "PCRF try to terminate\n"); + ogs_info("PCRF try to terminate"); pcrf_terminate(); - d_trace(1, "PCRF terminate...done\n"); + ogs_info("PCRF terminate...done"); } - if (pcrf_sem1) semaphore_post(pcrf_sem1); + if (pcrf_sem1) ogs_proc_mutex_post(pcrf_sem1); /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); app_did_terminate(); - core_terminate(); - _exit(EXIT_SUCCESS); } - if (pcrf_sem1) semaphore_wait(pcrf_sem1); + if (pcrf_sem1) ogs_proc_mutex_wait(pcrf_sem1); } /************************* PGW Process **********************/ + pgw_sem1 = ogs_proc_mutex_create(0); /* copied to PGW/SGW/HSS/MME */ + pgw_sem2 = ogs_proc_mutex_create(0); /* copied to PGW/SGW/HSS/MME */ - semaphore_create(&pgw_sem1, 0); /* copied to PGW/SGW/HSS process */ - semaphore_create(&pgw_sem2, 0); /* copied to PGW/SGW/HSS process */ - - if (context_self()->parameter.no_pgw == 0) + if (context_self()->config.parameter.no_pgw == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); - d_trace(1, "PGW try to initialize\n"); + ogs_info("PGW try to initialize"); rv = pgw_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize PGW"); - d_trace(1, "PGW initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("PGW initialize...done"); - if (pgw_sem1) semaphore_post(pgw_sem1); - if (pgw_sem2) semaphore_wait(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_post(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_wait(pgw_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "PGW try to terminate\n"); + ogs_info("PGW try to terminate"); pgw_terminate(); - d_trace(1, "PGW terminate...done\n"); + ogs_info("PGW terminate...done"); } - if (pgw_sem1) semaphore_post(pgw_sem1); + if (pgw_sem1) ogs_proc_mutex_post(pgw_sem1); /* allocated from parent process */ - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); app_did_terminate(); - core_terminate(); - _exit(EXIT_SUCCESS); } - if (pgw_sem1) semaphore_wait(pgw_sem1); + if (pgw_sem1) ogs_proc_mutex_wait(pgw_sem1); } /************************* SGW Process **********************/ + sgw_sem1 = ogs_proc_mutex_create(0); /* copied to SGW/HSS/MME */ + sgw_sem2 = ogs_proc_mutex_create(0); /* copied to SGW/HSS/MME */ - semaphore_create(&sgw_sem1, 0); /* copied to SGW/HSS process */ - semaphore_create(&sgw_sem2, 0); /* copied to SGW/HSS process */ - - if (context_self()->parameter.no_sgw == 0) + if (context_self()->config.parameter.no_sgw == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); - d_trace(1, "SGW try to initialize\n"); + ogs_info("SGW try to initialize"); rv = sgw_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize SGW"); - d_trace(1, "SGW initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("SGW initialize...done"); - if (sgw_sem1) semaphore_post(sgw_sem1); - if (sgw_sem2) semaphore_wait(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_post(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_wait(sgw_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "SGW try to terminate\n"); + ogs_info("SGW try to terminate"); sgw_terminate(); - d_trace(1, "SGW terminate...done\n"); + ogs_info("SGW terminate...done"); } - if (sgw_sem1) semaphore_post(sgw_sem1); + if (sgw_sem1) ogs_proc_mutex_post(sgw_sem1); /* allocated from parent process */ - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); app_did_terminate(); - core_terminate(); - _exit(EXIT_SUCCESS); } - if (sgw_sem1) semaphore_wait(sgw_sem1); + if (sgw_sem1) ogs_proc_mutex_wait(sgw_sem1); } /************************* HSS Process **********************/ + hss_sem1 = ogs_proc_mutex_create(0); /* copied to HSS/MME */ + hss_sem2 = ogs_proc_mutex_create(0); /* copied to HSS/MME */ - semaphore_create(&hss_sem1, 0); /* copied to HSS process */ - semaphore_create(&hss_sem2, 0); /* copied to HSS process */ - - if (context_self()->parameter.no_hss == 0) + if (context_self()->config.parameter.no_hss == 0) { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); - d_trace(1, "HSS try to initialize\n"); + ogs_info("HSS try to initialize"); rv = hss_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize HSS"); - d_trace(1, "HSS initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("HSS initialize...done"); - if (hss_sem1) semaphore_post(hss_sem1); - if (hss_sem2) semaphore_wait(hss_sem2); + if (hss_sem1) ogs_proc_mutex_post(hss_sem1); + if (hss_sem2) ogs_proc_mutex_wait(hss_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "HSS try to terminate\n"); + ogs_info("HSS try to terminate"); hss_terminate(); - d_trace(1, "HSS terminate...done\n"); + ogs_info("HSS terminate...done"); } - if (hss_sem1) semaphore_post(hss_sem1); + if (hss_sem1) ogs_proc_mutex_post(hss_sem1); - if (hss_sem1) semaphore_delete(hss_sem1); - if (hss_sem2) semaphore_delete(hss_sem2); + if (hss_sem1) ogs_proc_mutex_delete(hss_sem1); + if (hss_sem2) ogs_proc_mutex_delete(hss_sem2); app_did_terminate(); - core_terminate(); - _exit(EXIT_SUCCESS); } - if (hss_sem1) semaphore_wait(hss_sem1); + if (hss_sem1) ogs_proc_mutex_wait(hss_sem1); } /************************* MME Process **********************/ + mme_sem1 = ogs_proc_mutex_create(0); /* copied to MME */ + mme_sem2 = ogs_proc_mutex_create(0); /* copied to MME */ - semaphore_create(&mme_sem1, 0); /* copied to MME process */ - semaphore_create(&mme_sem2, 0); /* copied to MME process */ - -/* if (context_self()->parameter.no_mme == 0) */ +/* if (context_self()->config.parameter.no_mme == 0) */ { pid = fork(); - d_assert(pid >= 0, _exit(EXIT_FAILURE), "fork() failed"); + ogs_assert(pid >= 0); if (pid == 0) { /* allocated from parent process */ - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); - if (hss_sem1) semaphore_delete(hss_sem1); - if (hss_sem2) semaphore_delete(hss_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); + if (hss_sem1) ogs_proc_mutex_delete(hss_sem1); + if (hss_sem2) ogs_proc_mutex_delete(hss_sem2); - d_trace(1, "MME try to initialize\n"); + ogs_info("MME try to initialize"); rv = mme_initialize(); - d_assert(rv == CORE_OK,, "Failed to intialize MME"); - d_trace(1, "MME initialize...done\n"); + ogs_assert(rv == OGS_OK); + ogs_info("MME initialize...done"); - if (mme_sem1) semaphore_post(mme_sem1); - if (mme_sem2) semaphore_wait(mme_sem2); + if (mme_sem1) ogs_proc_mutex_post(mme_sem1); + if (mme_sem2) ogs_proc_mutex_wait(mme_sem2); - if (rv == CORE_OK) + if (rv == OGS_OK) { - d_trace(1, "MME try to terminate\n"); + ogs_info("MME try to terminate"); mme_terminate(); - d_trace(1, "MME terminate...done\n"); + ogs_info("MME terminate...done"); } - if (mme_sem1) semaphore_post(mme_sem1); + if (mme_sem1) ogs_proc_mutex_post(mme_sem1); - if (mme_sem1) semaphore_delete(mme_sem1); - if (mme_sem2) semaphore_delete(mme_sem2); + if (mme_sem1) ogs_proc_mutex_delete(mme_sem1); + if (mme_sem2) ogs_proc_mutex_delete(mme_sem2); app_did_terminate(); - core_terminate(); - _exit(EXIT_SUCCESS); } - if (mme_sem1) semaphore_wait(mme_sem1); + if (mme_sem1) ogs_proc_mutex_wait(mme_sem1); } rv = app_did_initialize(); - if (rv != CORE_OK) return rv; + if (rv != OGS_OK) return rv; - return CORE_OK;; + return OGS_OK;; } void test_app_terminate(void) { app_will_terminate(); - /* if (context_self()->parameter.no_mme == 0) */ + /* if (context_self()->config.parameter.no_mme == 0) */ { - if (mme_sem2) semaphore_post(mme_sem2); - if (mme_sem1) semaphore_wait(mme_sem1); + if (mme_sem2) ogs_proc_mutex_post(mme_sem2); + if (mme_sem1) ogs_proc_mutex_wait(mme_sem1); } - if (mme_sem1) semaphore_delete(mme_sem1); - if (mme_sem2) semaphore_delete(mme_sem2); + if (mme_sem1) ogs_proc_mutex_delete(mme_sem1); + if (mme_sem2) ogs_proc_mutex_delete(mme_sem2); - if (context_self()->parameter.no_hss == 0) + if (context_self()->config.parameter.no_hss == 0) { - if (hss_sem2) semaphore_post(hss_sem2); - if (hss_sem1) semaphore_wait(hss_sem1); + if (hss_sem2) ogs_proc_mutex_post(hss_sem2); + if (hss_sem1) ogs_proc_mutex_wait(hss_sem1); } - if (hss_sem1) semaphore_delete(hss_sem1); - if (hss_sem2) semaphore_delete(hss_sem2); + if (hss_sem1) ogs_proc_mutex_delete(hss_sem1); + if (hss_sem2) ogs_proc_mutex_delete(hss_sem2); - if (context_self()->parameter.no_sgw == 0) + if (context_self()->config.parameter.no_sgw == 0) { - if (sgw_sem2) semaphore_post(sgw_sem2); - if (sgw_sem1) semaphore_wait(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_post(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_wait(sgw_sem1); } - if (sgw_sem1) semaphore_delete(sgw_sem1); - if (sgw_sem2) semaphore_delete(sgw_sem2); + if (sgw_sem1) ogs_proc_mutex_delete(sgw_sem1); + if (sgw_sem2) ogs_proc_mutex_delete(sgw_sem2); - if (context_self()->parameter.no_pgw == 0) + if (context_self()->config.parameter.no_pgw == 0) { - if (pgw_sem2) semaphore_post(pgw_sem2); - if (pgw_sem1) semaphore_wait(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_post(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_wait(pgw_sem1); } - if (pgw_sem1) semaphore_delete(pgw_sem1); - if (pgw_sem2) semaphore_delete(pgw_sem2); + if (pgw_sem1) ogs_proc_mutex_delete(pgw_sem1); + if (pgw_sem2) ogs_proc_mutex_delete(pgw_sem2); - if (context_self()->parameter.no_pcrf == 0) + if (context_self()->config.parameter.no_pcrf == 0) { - if (pcrf_sem2) semaphore_post(pcrf_sem2); - if (pcrf_sem1) semaphore_wait(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_post(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_wait(pcrf_sem1); } - if (pcrf_sem1) semaphore_delete(pcrf_sem1); - if (pcrf_sem2) semaphore_delete(pcrf_sem2); + if (pcrf_sem1) ogs_proc_mutex_delete(pcrf_sem1); + if (pcrf_sem2) ogs_proc_mutex_delete(pcrf_sem2); app_did_terminate(); } diff --git a/test/volte/testapp.h b/test/volte/testapp.h index 47565ca5f..520b22490 100644 --- a/test/volte/testapp.h +++ b/test/volte/testapp.h @@ -1,16 +1,12 @@ #ifndef __TESTAPP_H__ #define __TESTAPP_H__ -#include "core.h" -#include "core_errno.h" - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -CORE_DECLARE(status_t) test_app_initialize( - const char *config_path, const char *log_path, const char *pid_path); -CORE_DECLARE(void) test_app_terminate(void); +int test_app_initialize(app_param_t *param); +void test_app_terminate(void); #ifdef __cplusplus } diff --git a/test/volte/testutil.c b/test/volte/testutil.c deleted file mode 100644 index 813f13b24..000000000 --- a/test/volte/testutil.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core_general.h" -#include "core_debug.h" -#include "core_semaphore.h" -#include "core_file.h" -#include "fd/fd_lib.h" - -#include "common/application.h" -#include "common/context.h" - -#include "testpacket.h" -#include "testapp.h" - -#include "abts.h" -#include "testutil.h" - -#include "pcscf_fd_path.h" - -abts_suite *test_volte(abts_suite *suite); - -const struct testlist alltests[] = { - {test_volte}, - {NULL}, -}; - -static int connected_count = 0; -static void test_fd_logger_handler(enum fd_hook_type type, struct msg * msg, - struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, - void * regdata) -{ - if (type == HOOK_PEER_CONNECT_SUCCESS) - { - connected_count++; - } -} - -void test_terminate(void) -{ - pcscf_fd_final(); - testpacket_final(); - test_app_terminate(); - - d_trace_global_on(); - core_terminate(); -} - -status_t test_initialize(int argc, const char *const argv[], char *config_path) -{ - status_t rv; - char dir[C_PATH_MAX/2]; - char conf[C_PATH_MAX]; - - if (config_path) - { - strcpy(conf, config_path); - } - else - { - path_remove_last_component(dir, argv[0]); - if (strstr(dir, ".libs")) - path_remove_last_component(dir, dir); - sprintf(conf, "%s/sample-volte.conf", dir); - } - - fd_logger_register(test_fd_logger_handler); - - atexit(test_terminate); - - core_initialize(); - rv = test_app_initialize(conf, NULL, NULL); - if (rv != CORE_OK) - { - d_error("test_app_initialize() failed"); - return CORE_ERROR; - } - rv = pcscf_fd_init(); - if (rv != CORE_OK) - { - d_error("pcscf_fd_init() failed"); - return CORE_ERROR; - } - rv = testpacket_init(); - if (rv != CORE_OK) - { - d_error("testpacket() failed"); - return CORE_ERROR; - } - - while(1) - { - if (connected_count == 1) break; - core_sleep(time_from_msec(50)); - } - - return rv; -} - diff --git a/test/volte/volte_test.c b/test/volte/volte_test.c index 9007f5e1e..0bd35172a 100644 --- a/test/volte/volte_test.c +++ b/test/volte/volte_test.c @@ -1,33 +1,26 @@ -#include "core_debug.h" -#include "core_pkbuf.h" -#include "core_lib.h" -#include "3gpp_types.h" #include - -#include "s1ap/s1ap_message.h" - -#include "common/context.h" - -#include "testutil.h" +#include "core/abts.h" +#include "base/types.h" +#include "asn1c/s1ap_message.h" +#include "app/context.h" #include "testpacket.h" - #include "pcscf_fd_path.h" static void volte_test1(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 0; - c_uint8_t *rx_sid = NULL; + uint8_t *rx_sid = NULL; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -88,28 +81,27 @@ static void volte_test1(abts_case *tc, void *data) "}"; /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; @@ -131,208 +123,199 @@ static void volte_test1(abts_case *tc, void *data) * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ - rv = tests1ap_build_initial_context_setup_response(&sendbuf, 1, 1, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_initial_context_setup_response(&sendbuf, + 1, 1, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send PDN Connectivity Request */ rv = tests1ap_build_pdn_connectivity_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Receive E-RAB Setup Request + * Activate default EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 6, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 6, 2, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate default EPS bearer context accept */ rv = tests1ap_build_activate_default_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send AA-Request */ pcscf_rx_send_aar(&rx_sid, "45.45.0.3", 1, 1); /* Receive E-RAB Setup Request + * Activate dedicated EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 7, 3); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 7, 3, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate dedicated EPS bearer context accept */ rv = tests1ap_build_activate_dedicated_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send AA-Request without Flow */ pcscf_rx_send_aar(&rx_sid, "45.45.0.3", 2, 1); /* Receive E-RAB Modify Request + * Modify EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Modify Response */ rv = tests1ap_build_e_rab_modify_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Modify EPS bearer context accept */ rv = tests1ap_build_modify_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Session-Termination-Request */ pcscf_rx_send_str(rx_sid); /* Receive E-RAB Release Command + * Dectivate EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Release Response */ rv = tests1ap_build_e_rab_release_response(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Deactivate EPS bearer context accept */ rv = tests1ap_build_deactivate_bearer_accept(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Detach Request */ rv = tests1ap_build_detach_request(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive UE Context Release Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Context Release Complete */ rv = tests1ap_build_ue_context_release_complete(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456819")); @@ -344,26 +327,26 @@ static void volte_test1(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } static void volte_test2(abts_case *tc, void *data) { - status_t rv; - sock_id sock; - pkbuf_t *sendbuf; - pkbuf_t *recvbuf; + int rv; + ogs_sock_t *sock; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; s1ap_message_t message; int i; int msgindex = 0; - c_uint8_t *rx_sid = NULL; + uint8_t *rx_sid = NULL; mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - c_int64_t count = 0; + int64_t count = 0; bson_error_t error; const char *json = "{" @@ -437,28 +420,27 @@ static void volte_test2(abts_case *tc, void *data) "}"; /* eNB connects to MME */ - rv = tests1ap_enb_connect(&sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + sock = testenb_s1ap_client("127.0.0.1"); + ABTS_PTR_NOTNULL(tc, sock); /* Send S1-Setup Reqeust */ rv = tests1ap_build_setup_req( - &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + &sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); rv = s1ap_decode_pdu(&message, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); s1ap_free_pdu(&message); - pkbuf_free(recvbuf); + ogs_pkbuf_free(recvbuf); collection = mongoc_client_get_collection( - context_self()->db_client, - context_self()->db_name, "subscribers"); + context_self()->db.client, + context_self()->db.name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); doc = bson_new_from_json((const uint8_t *)json, -1, &error);; @@ -480,178 +462,170 @@ static void volte_test2(abts_case *tc, void *data) * Attach Request : Known IMSI, Integrity Protected, No Security Context * Send Initial-UE Message + Attach Request + PDN Connectivity */ rv = tests1ap_build_initial_ue_msg(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Authentication Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Authentication Response */ rv = tests1ap_build_authentication_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Security mode Command */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Security mode Complete */ rv = tests1ap_build_security_mode_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive ESM Information Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send ESM Information Response */ rv = tests1ap_build_esm_information_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive Initial Context Setup Request + * Attach Accept + * Activate Default Bearer Context Request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send UE Capability Info Indication */ rv = tests1ap_build_ue_capability_info_indication(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Initial Context Setup Response */ - rv = tests1ap_build_initial_context_setup_response(&sendbuf, 1, 1, 5, 1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_initial_context_setup_response(&sendbuf, + 1, 1, 5, 1, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive EMM information */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send PDN Connectivity Request */ rv = tests1ap_build_pdn_connectivity_request(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Receive E-RAB Setup Request + * Activate default EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 6, 2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 6, 2, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Activate default EPS bearer context accept */ rv = tests1ap_build_activate_default_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive E-RAB Setup Request + * Activate dedicated EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Activate dedicated EPS bearer context accept */ rv = tests1ap_build_activate_dedicated_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send E-RAB Setup Response */ - rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 7, 3); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_build_e_rab_setup_response(&sendbuf, 1, 1, 7, 3, "127.0.0.5"); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send AA-Request */ pcscf_rx_send_aar(&rx_sid, "45.45.0.5", 0, 1); /* Receive downlink NAS transport + * Modify EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send Modify EPS bearer context accept */ rv = tests1ap_build_modify_bearer_accept(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send PDN disconnectivity request */ rv = tests1ap_build_pdn_disconnectivity_request(&sendbuf, msgindex+1); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); /* Receive E-RAB Release Command + * Deactivate EPS bearer context request */ - recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); - rv = tests1ap_enb_read(sock, recvbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - pkbuf_free(recvbuf); + recvbuf = testenb_s1ap_read(sock); + ABTS_PTR_NOTNULL(tc, recvbuf); + ogs_pkbuf_free(recvbuf); /* Send E-RAB Release Response */ rv = tests1ap_build_e_rab_release_response(&sendbuf, msgindex); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /* Send Deactivate EPS bearer context accept */ rv = tests1ap_build_deactivate_bearer_accept(&sendbuf, msgindex+2); - ABTS_INT_EQUAL(tc, CORE_OK, rv); - rv = tests1ap_enb_send(sock, sendbuf); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + rv = testenb_s1ap_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8("001010123456819")); @@ -663,10 +637,10 @@ static void volte_test2(abts_case *tc, void *data) mongoc_collection_destroy(collection); /* eNB disonncect from MME */ - rv = tests1ap_enb_close(sock); - ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = testenb_s1ap_close(sock); + ABTS_INT_EQUAL(tc, OGS_OK, rv); - core_sleep(time_from_msec(300)); + ogs_msleep(300); } abts_suite *test_volte(abts_suite *suite)